Merge pull request #76 from houdiniproject/deploying_build_improvements

Improvements to builds
This commit is contained in:
Eric Schultz 2018-06-27 15:10:58 -05:00 committed by GitHub
commit 68dcbaf515
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 3 deletions

View file

@ -6,8 +6,8 @@
"url": "https://github.com/houdiniproject/houdini" "url": "https://github.com/houdiniproject/houdini"
}, },
"scripts": { "scripts": {
"watch": "npm run export-button-config && npm run export-i18n && npm run generate-api-js && npx webpack --watch", "watch": "HOUDINI_WATCH=1 script/build.sh",
"build": "npm run export-button-config && npm run export-i18n && npm run generate-api-js && NODE_ENV=production npx webpack -p", "build": "script/build.sh",
"build-all": "script/compile-assets.sh && npm run build", "build-all": "script/compile-assets.sh && npm run build",
"test": "rake spec && npm run build && npx jest", "test": "rake spec && npm run build && npx jest",
"export-button-config": "bundle exec rake settings:generate_json", "export-button-config": "bundle exec rake settings:generate_json",

18
script/build.sh Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
(
echo $HOUDINI_WATCH
set -e
set -o pipefail
export DATABASE_URL=${BUILD_DATABASE_URL:-postgres://admin:password@db/commitchange_development}
echo $DATABASE_URL
npm run export-button-config && npm run export-i18n && npm run generate-api-js
if [ -z "$HOUDINI_WATCH"} ];
then
npx webpack --watch
else
NODE_ENV=production npx webpack -p
fi
)

View file

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
(source .env; RAILS_ENV=production bundle exec rake assets:precompile) ( RAILS_ENV=${RAILS_ENV:-production} DATABASE_URL=${BUILD_DATABASE_URL:-postgres://admin:password@db/commitchange_development} bundle exec rake assets:precompile )