Skip to content

Commit

Permalink
Update 'grunt watch' to watch src/ and tests/ concurrently.
Browse files Browse the repository at this point in the history
It will trigger the correct webpack task when it notices a changed file.
  • Loading branch information
ronyeh committed May 6, 2021
1 parent ba717d8 commit ecf0a20
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
40 changes: 26 additions & 14 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,24 @@ module.exports = (grunt) => {
build: webpackProd,
buildDev: webpackDev,
buildTest: webpackTest,
watch: {
watchDev: {
...webpackDev,
watch: true,
keepalive: true,
failOnError: false,
},
watchTest: {
...webpackTest,
watch: true,
keepalive: true,
failOnError: false,
},
},
concurrent: {
options: {
logConcurrentOutput: true,
},
tasks: ['webpack:watchDev', 'webpack:watchTest'],
},
eslint: {
target: SOURCES.concat('./tests'),
Expand All @@ -96,15 +108,6 @@ module.exports = (grunt) => {
qunit: {
files: ['tests/flow.html'],
},
watch: {
tests: {
files: ['tests/*', 'src/*'],
tasks: ['concat:tests'],
options: {
interrupt: true,
},
},
},
copy: {
release: {
files: [
Expand Down Expand Up @@ -140,8 +143,8 @@ module.exports = (grunt) => {
out: 'build/typedocs',
name: 'vexflow',
},
src: ['./typedoc.ts']
}
src: ['./typedoc.ts'],
},
},
gitcommit: {
releases: {
Expand Down Expand Up @@ -178,7 +181,6 @@ module.exports = (grunt) => {

// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
Expand All @@ -189,9 +191,19 @@ module.exports = (grunt) => {
grunt.loadNpmTasks('grunt-git');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-webpack');
grunt.loadNpmTasks('grunt-concurrent');

// Default task(s).
grunt.registerTask('default', ['clean', 'eslint', 'webpack:build', 'webpack:buildDev', 'webpack:buildTest', 'docco', 'typedoc']);
grunt.registerTask('default', [
'clean',
'eslint',
'webpack:build',
'webpack:buildDev',
'webpack:buildTest',
'docco',
'typedoc',
]);
grunt.registerTask('watch', 'Watch src/ and tests/ concurrently', ['clean', 'eslint', 'concurrent']);
grunt.registerTask('test', 'Run qunit tests.', [
'clean',
'webpack:build',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"grunt": "^1.0.4",
"grunt-bump": "^0.8.0",
"grunt-cli": "^1.4.1",
"grunt-concurrent": "^3.0.0",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-copy": "^1.0.0",
Expand Down

0 comments on commit ecf0a20

Please sign in to comment.