Skip to content

Commit

Permalink
Add JS watch convenience script
Browse files Browse the repository at this point in the history
Add a convenience script to run the default gulp command, which rebuilds the
frontend on file change. Also add linting to the default and watch commands.
  • Loading branch information
flibbertigibbet committed Nov 25, 2019
1 parent 44434fe commit c283f1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Development Installation
3. Copy `deployment/ansible/group_vars/development_template` to `deployment/ansible/group_vars/development`
4. Run `vagrant up`
5. See the app at http://localhost:8024! See OpenTripPlanner at http://localhost:9090.
6. Running `npm run gulp` from `/opt/app/src` will rebuild the front-end app on file change (the browser must be reloaded manually to pick up the change). Alternatively, `npm run gulp-development` can be run manually whenever changes are made to the static files.
6. Running `./scripts/serve-js-dev.sh` on the host will rebuild the front-end app on file change (the browser must be reloaded manually to pick up the change). Alternatively, `cd /opt/app/src && npm run gulp-development` can be run manually in the VM to pick up changes to the static files.

Note that if there is an existing build Graph.obj in `otp_data`, vagrant provisioning in development mode will not attempt to rebuild the graph, but will use the one already present.

Expand Down
7 changes: 7 additions & 0 deletions scripts/serve-js-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -x

# Run JS and styles watcher to rebuild frontend on file change
# (Page reload still required)
vagrant ssh app -c "cd /opt/app/src && npm run gulp"
4 changes: 2 additions & 2 deletions src/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ gulp.task('watch', function () {
'app/scripts/**/*.js',
'app/styles/**/*.css',
'app/styles/**/*.scss'
], { usePolling: true }, gulp.parallel('development'));
], { usePolling: true }, gulp.parallel('jshint', 'development'));
});

gulp.task('default', gulp.series('development', 'watch'));
gulp.task('default', gulp.series('jshint', 'development', 'watch'));

0 comments on commit c283f1e

Please sign in to comment.