From 576a1903ecdfab8df7aaeb1a16379bcac448ac1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Georget?= Date: Wed, 7 Dec 2016 13:19:01 +0100 Subject: [PATCH] Make the easiest installation as possible --- .travis.yml | 54 +++---------------- Makefile | 3 ++ package.json | 3 +- .../configuration/hooks/core/static/index.js | 2 +- scripts/setup.sh | 54 +++++++++++++++++++ 5 files changed, 67 insertions(+), 49 deletions(-) create mode 100755 scripts/setup.sh diff --git a/.travis.yml b/.travis.yml index 57f3516a42..5dd12b2f0e 100755 --- a/.travis.yml +++ b/.travis.yml @@ -5,58 +5,18 @@ git: language: node_js +cache: + yarn: true + directories: + - node_modules + before_install: - export CHROME_BIN=chromium-browser - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start install: - - cd packages/strapi-utils - - npm link - - cd ../strapi-mongoose - - npm link strapi-utils - - npm link - - cd ../strapi-bookshelf - - npm link strapi-utils - - npm link - - cd ../strapi-generate-migrations - - npm link strapi-bookshelf - - npm link strapi-utils - - npm link - - cd ../strapi-generate - - npm link strapi-utils - - npm link - - cd ../strapi-generate-admin - - npm link strapi-utils - - npm link - - cd ../strapi-generate-api - - npm link - - cd ../strapi-generate-policy - - npm link - - cd ../strapi-generate-service - - npm link - - cd ../strapi-generate-new - - npm link strapi-utils - - npm link - - cd ../strapi - - npm link strapi-generate-new - - npm link strapi-generate - - npm link strapi-generate-admin - - npm link strapi-generate-api - - npm link strapi-generate-policy - - npm link strapi-generate-service - - npm link strapi-generate-migrations - - npm link strapi-mongoose - - npm link strapi-utils - - npm install - - cd ./node_modules/koa-joi-router - - sed -i.bu 's/await-busboy/co-busboy/' joi-router.js - - npm install co-busboy - - cd .. - - cd .. - - cd .. - - cd .. - - npm install + - yarn run setup node_js: - "7" @@ -64,4 +24,4 @@ node_js: sudo: false script: - - npm test + - yarn run test diff --git a/Makefile b/Makefile index 54322be7fc..e370586897 100755 --- a/Makefile +++ b/Makefile @@ -12,3 +12,6 @@ test: lint docs: mkdocs build --clean + +setup: + ./scripts/setup.sh diff --git a/package.json b/package.json index a4aaadb9d8..e9e00ce022 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,8 @@ } }, "scripts": { - "test": "make test" + "test": "make test", + "setup": "make setup" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi/lib/configuration/hooks/core/static/index.js b/packages/strapi/lib/configuration/hooks/core/static/index.js index f84d2d477a..6e38a0f4de 100644 --- a/packages/strapi/lib/configuration/hooks/core/static/index.js +++ b/packages/strapi/lib/configuration/hooks/core/static/index.js @@ -32,7 +32,7 @@ module.exports = strapi => { initialize: cb => { if (strapi.config.static === true) { - const isIndexRoute = strapi.config.routes.find(route => route.path === '/'); + const isIndexRoute = _.isEmpty(strapi.config.routes) ? false : strapi.config.routes.find(route => route.path === '/'); strapi.app.use(strapi.middlewares.convert(strapi.middlewares.betterStatic(path.resolve(strapi.config.appPath, strapi.config.paths.static), { index: isIndexRoute ? false : 'index.html', diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000000..a8f01cdbdf --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,54 @@ +#!/bin/sh +set -e + +cd packages/strapi-utils +npm link +cd ../strapi-mongoose +npm link strapi-utils +npm link +cd ../strapi-bookshelf +npm link strapi-utils +npm link +cd ../strapi-generate-migrations +npm link strapi-bookshelf +npm link strapi-utils +npm link +cd ../strapi-generate +npm link strapi-utils +npm link +cd ../strapi-generate-admin +npm link strapi-utils +npm link +cd files/admin/public +npm install +npm run build +cd ../../../ +cd ../strapi-generate-api +npm link +cd ../strapi-generate-policy +npm link +cd ../strapi-generate-service +npm link +cd ../strapi-generate-new +npm link strapi-utils +npm link +cd ../strapi +npm link strapi-generate-new +npm link strapi-generate +npm link strapi-generate-admin +npm link strapi-generate-api +npm link strapi-generate-policy +npm link strapi-generate-service +npm link strapi-generate-migrations +npm link strapi-mongoose +npm link strapi-utils +npm install +npm link +cd ./node_modules/koa-joi-router +sed -i.bu 's/await-busboy/co-busboy/' joi-router.js +npm install co-busboy +cd .. +cd .. +cd .. +cd .. +npm install