mirror of
https://github.com/videojs/video.js.git
synced 2024-11-28 08:58:46 +02:00
chore: improve dev and beginner experience (#4555)
Makes the output of dev rollup and babel watch more quiet. Add a task to copy .example files over to non .example files if the non .example files are not present.
This commit is contained in:
parent
db55bbd3ec
commit
19ebc0dda5
@ -466,7 +466,7 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
babel: {
|
||||
command: 'npm run babel -- --watch',
|
||||
command: 'npm run babel -- --watch --quiet',
|
||||
options: {
|
||||
preferLocal: true
|
||||
}
|
||||
@ -575,7 +575,7 @@ module.exports = function(grunt) {
|
||||
});
|
||||
|
||||
// Run while developing
|
||||
grunt.registerTask('dev', ['connect:dev', 'concurrent:dev']);
|
||||
grunt.registerTask('dev', ['sandbox', 'connect:dev', 'concurrent:dev']);
|
||||
grunt.registerTask('watchAll', ['build', 'connect:dev', 'concurrent:watchAll']);
|
||||
grunt.registerTask('test-a11y', ['copy:a11y', 'accessibility']);
|
||||
|
||||
|
@ -26,6 +26,10 @@ const args = minimist(process.argv.slice(2), {
|
||||
}
|
||||
});
|
||||
|
||||
if (args.watch) {
|
||||
args.progress = false;
|
||||
}
|
||||
|
||||
const compiledLicense = _.template(fs.readFileSync('./build/license-header.txt', 'utf8'));
|
||||
const bannerData = _.pick(pkg, ['version', 'copyright']);
|
||||
|
||||
|
33
build/tasks/sandbox.js
Normal file
33
build/tasks/sandbox.js
Normal file
@ -0,0 +1,33 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const klawSync = require('klaw-sync');
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('sandbox', 'copy over sandbox example files if necessary', function() {
|
||||
const files = klawSync('sandbox/').filter((file) => path.extname(file.path) === '.example');
|
||||
|
||||
const changes = files.map(function(file) {
|
||||
const p = path.parse(file.path);
|
||||
const nonExample = path.join(p.dir, p.name);
|
||||
return {
|
||||
file: file.path,
|
||||
copy: nonExample
|
||||
};
|
||||
})
|
||||
.filter(function(change) {
|
||||
return !fs.existsSync(change.copy);
|
||||
});
|
||||
|
||||
changes.forEach(function(change) {
|
||||
grunt.file.copy(change.file, change.copy);
|
||||
});
|
||||
|
||||
if (changes.length) {
|
||||
grunt.log.writeln("Updated Sandbox files for:");
|
||||
grunt.log.writeln('\t' + changes.map((chg) => chg.copy).join('\n\t'));
|
||||
} else {
|
||||
grunt.log.writeln("No sandbox updates necessary");
|
||||
}
|
||||
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue
Block a user