Add more useful setup_dev script

[ci skip]
pull/6394/head
Oliver Günther 7 years ago
parent 4799abb0fe
commit 2a924dcc74
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 2
      .gitignore
  2. 7
      bin/rebuild_frontend
  3. 34
      bin/setup_dev
  4. 2
      package.json

2
.gitignore vendored

@ -92,5 +92,7 @@ npm-debug.log*
/frontend/dist/
/frontend/tests/*.gif
node_modules/
# Ignore global package-lock.json that generates
/package-lock.json
plaintext.yml
structure.sql

@ -1,7 +0,0 @@
#!/bin/sh
#
# Deletes bundled javascript assets and rebuilds them.
# Useful for when your frontend doesn't work (jQuery not defined etc.) for seemingly no reason at all.
rm -rf app/assets/javascripts/bundles/*
bundle install && npm install && npm run webpack

@ -0,0 +1,34 @@
#!/bin/bash
#
# Deletes bundled javascript assets and rebuilds them.
# Useful for when your frontend doesn't work (jQuery not defined etc.) for seemingly no reason at all.
yell() { echo -e "$0: $*" >&2; }
die() { yell "$*"; exit 1; }
try() { eval "$@" || die "\n\nFailed to run '$*', check log/setup_dev.log for more information."; }
printf "Clearing previous bundle ... "
rm -rf app/assets/javascripts/bundles/*
rm -f log/setup_dev.log
echo "done."
printf "Bundling rails dependencies ... "
try 'bundle install >> log/setup_dev.log'
echo "done."
echo "Installing node_modules ... "
try 'npm install >> log/setup_dev.log'
printf "Building legacy webpack bundle ... "
try 'npm run legacy-webpack >> log/setup_dev.log'
echo "done."
echo "---------------------------------------"
echo "Done. Now start the following services"
echo '- Rails server `RAILS_ENV=development ./bin/rails s`'
echo '- Angular CLI: `npm run serve`'
echo '- (Optional, only if you work on frontend/legacy): `npm run legacy-webpack-watch`'
echo ""
echo 'You can also run `foreman start -f Procfile.dev` to run all the above on a single terminal.'

@ -6,7 +6,7 @@
"test": "cd frontend && npm test && cd ..",
"tslint_typechecks": "cd frontend && npm run tslint_typechecks && cd ..",
"serve": "cd frontend && npm run serve",
"legacy-webpack": "cd frontend && npm run webpack && cd ..",
"legacy-webpack": "cd frontend && npm run legacy-webpack && cd ..",
"legacy-webpack-watch": "cd frontend && npm run legacy-webpack-watch"
},
"private": true,

Loading…
Cancel
Save