JS tooling: run TS grunt tasks only when files changed

- using grunt-newer to prefix precommit tasks
- only got it to work for tslint and tsc

Not applied to:

- sasslint does not take the file arguments in a way that grunt-newer
  recognizes
- no-only-tests throws an error when used with `newer`, but it's
  sub-second runtime
This commit is contained in:
David Kaltschmidt
2018-10-30 10:25:53 +01:00
parent a0aaf70060
commit e8a895d58b
4 changed files with 19 additions and 4 deletions

View File

@@ -17,8 +17,8 @@ module.exports = function (grunt) {
grunt.registerTask('precommit', [
'sasslint',
'exec:tslint',
'exec:tsc',
'newer:exec:tslint',
'newer:exec:tsc',
'no-only-tests'
]);

View File

@@ -2,8 +2,14 @@ module.exports = function (config, grunt) {
'use strict';
return {
tslint: 'node ./node_modules/tslint/lib/tslintCli.js -c tslint.json --project ./tsconfig.json',
tsc: 'yarn tsc --noEmit',
tslint: {
command: 'node ./node_modules/tslint/lib/tslintCli.js -c tslint.json --project ./tsconfig.json',
src: ['public/app/**/*.ts*'],
},
tsc: {
command: 'yarn tsc --noEmit',
src: ['public/app/**/*.ts*'],
},
jest: 'node ./node_modules/jest-cli/bin/jest.js --maxWorkers 2',
webpack: 'node ./node_modules/webpack/bin/webpack.js --config scripts/webpack/webpack.prod.js',
};