From 5aec047a3e0fcb27b06c54dc692cfa78145057df Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Thu, 6 Sep 2018 15:00:02 +0100 Subject: [PATCH 1/2] Some minor improvements for setup script Since we use `yarn` for our container setup and try to enforce dependencies, we should also use yarn in the setup script. Signed-off-by: Sheogorath --- bin/setup | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/setup b/bin/setup index 122cb7a..38aa05a 100755 --- a/bin/setup +++ b/bin/setup @@ -8,11 +8,12 @@ if [ -d .git ]; then cd "$(git rev-parse --show-toplevel)" fi -if ! type npm > /dev/null +if ! type yarn > /dev/null then cat << EOF -npm is not installed, please install Node.js and npm. +yarn is not installed, please install Node.js, npm and yarn. Read more on Node.js official website: https://nodejs.org +And for yarn package manager at: https://yarnpkg.com/en/ Setup will not be run EOF exit 0 @@ -27,8 +28,9 @@ if [ ! -f .sequelizerc ]; then cp .sequelizerc.example .sequelizerc fi -echo "install npm packages" -BUILD_ASSETS=false npm install +echo "install packages" +yarn install --pure-lockfile +yarn install --production=false --pure-lockfile cat << EOF From db59bb99dc59d56e1f807a09845750d05fef43b1 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Tue, 25 Sep 2018 00:31:21 +0200 Subject: [PATCH 2/2] Run db migrations on start We should force db migrations to run on every start. This will minimize the impact of breaking migrations in future. While it may causes some issues with the next start since CodiMD won't start when the migrations fail. Signed-off-by: Sheogorath --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b257a11..f0781c2 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "dev": "webpack --config webpack.config.js --progress --colors --watch", "build": "webpack --config webpack.production.js --progress --colors --bail", "postinstall": "bin/heroku", - "start": "node app.js", + "start": "sequelize db:migrate && node app.js", "doctoc": "doctoc --title='# Table of Contents' README.md" }, "dependencies": {