-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
111 lines (105 loc) · 3.69 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/**
* Gruntfile.js
*/
'use strict';
/* globals module */
/* eslint quote-props: ["error", "consistent"] */
/* eslint camelcase: ["error", {properties: "never"}] */
/* eslint func-style: ["error", "declaration", { "allowArrowFunctions": true }] */
/* eslint-env es6 */
module.exports = (grunt) => {
// configure project
grunt.initConfig({
// make node configurations available
pkg: grunt.file.readJSON('package.json'),
watch: {
gruntfile: {
files: [ 'Gruntfile.js' ],
tasks: [ 'eslint:gruntfile' ],
options: {
reload: true,
}
},
loader: {
files: [ 'scripts/loader-src.js' ],
tasks: [
'eslint:loader',
'closurecompiler:loaderDebug',
'jsdoc'
],
options: {
spawn: false,
}
}
},
eslint: {
options: {
configFile: 'eslintrc.js'
},
gruntfile: [ 'Gruntfile.js' ],
loader: [ 'scripts/loader-src.js' ]
},
closurecompiler: {
loaderDebug: {
files: {
'debug/loader-min.js': [ 'scripts/loader-src.js' ],
},
options: {
// 'compilation_level': 'WHITESPACE_ONLY',
// 'compilation_level': 'SIMPLE_OPTIMIZATIONS',
'compilation_level': 'ADVANCED_OPTIMIZATIONS',
'language_in': 'ECMASCRIPT6',
'language_out': 'ECMASCRIPT5',
'externs': 'scripts/externs.js',
'define': 'info=true',
'formatting': 'PRETTY_PRINT'
}
},
loaderRelease: {
files: {
'release/loader-min.js': [ 'scripts/loader-src.js' ],
},
options: {
// 'compilation_level': 'WHITESPACE_ONLY',
// 'compilation_level': 'SIMPLE_OPTIMIZATIONS',
'compilation_level': 'ADVANCED_OPTIMIZATIONS',
'language_in': 'ECMASCRIPT6',
'language_out': 'ECMASCRIPT3',
'externs': 'scripts/externs.js',
'define': 'info=false',
'formatting': 'SINGLE_QUOTES'
// 'formatting': 'PRETTY_PRINT'
}
}
},
jsdoc : {
dist : {
src: [
'README.md',
'scripts/loader-src.js',
],
jsdoc: 'node_modules/.bin/jsdoc',
options: {
destination: 'doc',
configure: 'jsdocrc.json',
template: 'node_modules/jsdoc-oblivion/template'
}
}
},
copy: {
jsdocCss: {
src: 'styles/site.oblivion.css',
dest: 'doc/styles/site.oblivion.css',
}
}
});
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-closurecompiler');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', [ 'eslint', 'closurecompiler:loaderRelease', 'jsdoccss' ]);
grunt.registerTask('debug', [ 'eslint', 'closurecompiler:loaderDebug', 'jsdoccss' ]);
grunt.registerTask('release', [ 'eslint', 'closurecompiler:loaderRelease', 'jsdoccss' ]);
grunt.registerTask('jsdoccss', [ 'jsdoc', 'copy:jsdocCss' ]);
};