build: updated grunt watch to explain best usage

This commit is contained in:
Torkel Ödegaard 2017-04-18 15:36:38 +02:00
parent 5dad324ab7
commit 473006e8cf
3 changed files with 14 additions and 2 deletions

View File

@ -76,7 +76,7 @@
"systemjs-builder": "^0.15.34", "systemjs-builder": "^0.15.34",
"tether": "^1.4.0", "tether": "^1.4.0",
"tether-drop": "https://github.com/torkelo/drop", "tether-drop": "https://github.com/torkelo/drop",
"tslint": "^4.0.2", "tslint": "^4.5.1",
"typescript": "^2.1.4", "typescript": "^2.1.4",
"virtual-scroll": "^1.1.1" "virtual-scroll": "^1.1.1"
} }

View File

@ -1,7 +1,7 @@
module.exports = function(config) { module.exports = function(config) {
'use strict' 'use strict'
return { return {
tslint : "node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project ./tsconfig.json", tslint : "node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project ./tsconfig.json <%= tslint.source.files.src %>",
tscompile: "node ./node_modules/typescript/lib/tsc.js -p tsconfig.json --diagnostics", tscompile: "node ./node_modules/typescript/lib/tsc.js -p tsconfig.json --diagnostics",
tswatch: "node ./node_modules/typescript/lib/tsc.js -p tsconfig.json --diagnostics --watch", tswatch: "node ./node_modules/typescript/lib/tsc.js -p tsconfig.json --diagnostics --watch",
}; };

View File

@ -8,6 +8,10 @@ module.exports = function(config, grunt) {
var lastTime; var lastTime;
grunt.registerTask('watch', function() { grunt.registerTask('watch', function() {
if (!grunt.option('skip-ts-compile')) {
grunt.log.writeln('We recommoned starting with: grunt watch --force --skip-ts-compile')
grunt.log.writeln('Then do incremental typescript builds with: grunt exec:tswatch')
}
done = this.async(); done = this.async();
lastTime = new Date().getTime(); lastTime = new Date().getTime();
@ -58,6 +62,14 @@ module.exports = function(config, grunt) {
newPath = filepath.replace(/^public/, 'public_gen'); newPath = filepath.replace(/^public/, 'public_gen');
grunt.log.writeln('Copying to ' + newPath); grunt.log.writeln('Copying to ' + newPath);
grunt.file.copy(filepath, newPath); grunt.file.copy(filepath, newPath);
if (grunt.option('skip-ts-compile')) {
grunt.log.writeln('Skipping ts compile, run grunt exec:tswatch to start typescript watcher')
} else {
grunt.task.run('exec:tscompile');
}
grunt.config('tslint.source.files.src', filepath);
grunt.task.run('exec:tslint'); grunt.task.run('exec:tslint');
} }