This repository has been archived by the owner on Dec 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathGruntfile.js
80 lines (77 loc) · 2.2 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
peg: {
parser: {
src: 'src/parser/parser.peg',
dest: 'src/parser/parser.js',
options: {
wrapper: function(src, parser) {
return 'export default ' + parser + ';';
}
}
},
parserExt: {
src: 'src/parser/parserExt.peg',
dest: 'src/parser/parserExt.js',
options: {
wrapper: function(src, parser) {
return 'export default ' + parser + ';';
}
}
}
},
eslint: {
target: ['src/*.js', 'test/*.js'],
options: {
config: '.eslintrc'
}
},
jscs: {
src: ['src/*.js', 'test/*.js'],
options: {
config: '.jscsrc'
}
},
concat: {
jsdoc2md: {
src: ['src/View.js', 'src/SubView.js', 'src/VisualFormat.js', 'src/Attribute.js', 'src/Relation.js', 'src/Priority.js'],
dest: 'tmp/concat.js'
}
},
jsdoc2md: {
output: {
options: {
'global-index-format': 'none',
'module-index-format': 'none'
},
src: 'tmp/concat.js',
dest: 'docs/AutoLayout.md'
}
},
exec: {
'bundle-es6': 'node ./build/bundle-es6',
'dist': 'node ./build/dist',
'dist-fast': 'node ./build/dist --fast',
test: 'mocha',
bench: 'node bench/main.js'
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
grunt.loadNpmTasks('grunt-peg');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-concat');
// Tasks
grunt.registerTask('lint', ['eslint', 'jscs']);
grunt.registerTask('doc', ['concat', 'jsdoc2md']);
grunt.registerTask('parser', ['peg']);
grunt.registerTask('test', ['exec:test']);
grunt.registerTask('bench', ['exec:bench']);
grunt.registerTask('dist', ['parser', 'exec:bundle-es6', 'exec:dist']);
grunt.registerTask('default', ['lint', 'doc', 'dist', 'test']);
grunt.registerTask('fast', ['lint', 'parser', 'exec:bundle-es6', 'exec:dist-fast', 'test']);
};