Skip to content

Commit

Permalink
chore: better dev experience (#3896)
Browse files Browse the repository at this point in the history
npm start now runs `grunt dev` which in turn runs the connect server,
sets up babel watching, browserify watching (for both src and test
files), and css and alternate builds watching.

Additionally, it will copy over the dev build files into the dist folder
so that if you're linking videojs and you have a project that gets
video.js from the dist, you can link and develop with more easy without
rerunning all of `grunt dist` each time.

Additionally, this specifically does not run more time consumming
operations like minification.
  • Loading branch information
gkatsev authored Jan 3, 2017
1 parent 83d453b commit 9ec5587
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
29 changes: 24 additions & 5 deletions build/grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ module.exports = function(grunt) {
},
dist: {},
watch: {
dist: {
files: [
'build/temp/video.js',
'build/temp/alt/video.novtt.js',
'build/temp/video-js.css',
'build/temp/alt/video-js-cdn.css'
],
tasks: ['copy:dist']
},
novtt: {
files: ['build/temp/video.js'],
tasks: ['concat:novtt']
Expand All @@ -142,10 +151,6 @@ module.exports = function(grunt) {
babel: {
files: ['src/js/**/*.js'],
tasks: ['babel:es5']
},
jshint: {
files: ['src/**/*', 'test/unit/**/*.js', 'Gruntfile.js'],
tasks: 'jshint'
}
},
connect: {
Expand Down Expand Up @@ -405,6 +410,14 @@ module.exports = function(grunt) {
'watch:babel',
'browserify:tests'
],
dev: [
'browserify:watch',
'browserify:tests',
'watch:novtt',
'watch:skin',
'watch:dist',
'shell:babel'
],
// Run multiple watch tasks in parallel
// Needed so watchify can cache intelligently
watchAll: [
Expand Down Expand Up @@ -437,6 +450,12 @@ module.exports = function(grunt) {
}
},
shell: {
babel: {
command: 'npm run babel -- --w',
options: {
preferLocal: true
}
},
lint: {
command: 'npm run lint',
options: {
Expand Down Expand Up @@ -540,7 +559,7 @@ module.exports = function(grunt) {
'test-a11y'].concat(process.env.TRAVIS && 'coveralls').filter(Boolean));

// Run while developing
grunt.registerTask('dev', ['build', 'connect:dev', 'concurrent:watchSandbox']);
grunt.registerTask('dev', ['connect:dev', 'concurrent:dev']);

grunt.registerTask('watchAll', ['build', 'connect:dev', 'concurrent:watchAll']);

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
"clean": "grunt clean",
"grunt": "grunt",
"lint": "vjsstandard",
"start": "grunt watchAll",
"start": "grunt dev",
"test": "grunt test",
"docs": "npm run docs:lint && npm run docs:api",
"docs:api": "jsdoc -r src/js -d docs/api -c .jsdoc.json",
"docs:lint": "remark -- './**/*.md'",
"docs:fix": "remark --output -- './**/*.md'"
"docs:fix": "remark --output -- './**/*.md'",
"babel": "babel src/js -d es5"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 9ec5587

Please sign in to comment.