-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
41 lines (41 loc) · 1.38 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var path = require('path');
var src = path.join(__dirname,'src/main.ts');
var dataPath = path.join(__dirname,'src/text/data/');
var buildPath = path.join(__dirname,'build/text/');
var buildPathAMD = path.join(__dirname,'build/textAMD/');
module.exports = function(grunt) {
// build the data module TS files from human readable src/data/dictionary* :
// build all JS files for node.js (commonJS) and browser (AMD) :
grunt.initConfig({
watch: {
files: ['./src/text/**'],
tasks: ['run:build', 'run:run'],
},
tslint: {
options: {
configuration: grunt.file.readJSON('tslint.json')
},
src: ['./src/text/nlp/*.ts']
},
run: {
makeDataTS: {
exec: ['node ', dataPath, '_make -l'].join('')
},
buildClient: {
exec: ['tsc ', src, ' --module amd --target es5 --outDir ', buildPathAMD].join('')
},
build: {
exec: ['tsc ', src, ' --module commonjs --target es5 --outDir ', buildPath].join('')
},
run: {
exec: ['node ', buildPath].join(''), // TODO - run a test? (we can't run modules) ...
}
}
});
// do :
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-run');
grunt.loadNpmTasks('grunt-tslint');
grunt.registerTask('default', ['run:makeDataTS', 'run:buildClient', 'run:build', 'run:run', 'watch']);
grunt.registerTask('lint', ['tslint:src']);
};