Skip to content

Commit

Permalink
chore(build): unify client bundling scripts (#3600)
Browse files Browse the repository at this point in the history
Remove bundling logic from Grunt and introduce watch mode into the scripts/client.js. New script (`npm run build:watch`) allows to watch for the changes in client sources and bundle them automatically.

This also fixes a bug where `npm run build` could swallow errors and silently do nothing.

Fixes #3599
  • Loading branch information
devoto13 committed Dec 23, 2020
1 parent 1a65bf1 commit fe0e24a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 409 deletions.
2 changes: 2 additions & 0 deletions docs/dev/02-making-changes.md
Expand Up @@ -49,6 +49,8 @@ Here are some tips on how to set up a Karma workspace and how to send a good pul
- Build the client code via:
```bash
$ npm run build
# or use the watch mode
$ npm run build:watch
```

## Changing the Code
Expand Down
19 changes: 1 addition & 18 deletions gruntfile.js
Expand Up @@ -9,24 +9,10 @@ module.exports = function (grunt) {
context: ['context/**/*.js'],
grunt: ['grunt.js', 'tasks/*.js']
},
browserify: {
client: {
files: {
'static/karma.js': ['client/main.js'],
'static/context.js': ['context/main.js']
}
}
},
test: {
unit: 'mochaTest:unit',
client: 'test/client/karma.conf.js'
},
watch: {
client: {
files: '<%= files.client %>',
tasks: 'browserify:client'
}
},
mochaTest: {
options: {
reporter: 'dot',
Expand All @@ -43,7 +29,6 @@ module.exports = function (grunt) {
},
'npm-publish': {
options: {
requires: ['build'],
abortIfDirty: true,
tag: 'latest'
}
Expand Down Expand Up @@ -93,16 +78,14 @@ module.exports = function (grunt) {
grunt.loadTasks('tasks')
require('load-grunt-tasks')(grunt)

grunt.registerTask('build', ['browserify:client'])
grunt.registerTask('default', ['build', 'test'])
grunt.registerTask('default', ['test'])
grunt.registerTask('test-appveyor', ['test:unit', 'test:client'])

grunt.registerTask('release', 'Build, bump and publish to NPM.', function (type) {
grunt.task.run([
'check_clean',
'npm-contributors',
'bump:' + (type || 'patch') + ':bump-only',
'build',
'conventionalChangelog',
'bump-commit',
'conventionalGithubReleaser',
Expand Down

0 comments on commit fe0e24a

Please sign in to comment.