-
Notifications
You must be signed in to change notification settings - Fork 31
/
Gruntfile.js
executable file
·70 lines (54 loc) · 2.06 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
/**
* to debug gruntfile:
* node-debug $(which grunt) task
*/
module.exports = function(grunt) {
// modules for browserify to ignore
const _ignore = `--ignore=path --ignore=request --ignore=http --ignore=fs --ignore=vm --ignore=lodash --ignore=yargs`
// project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
shell: {
browserify_prod_umd: {
command: () => `npx browserify --standalone=TTY_Table ${_ignore} -r ./adapters/default-adapter.js:<%= pkg.name %> > ./dist/<%= pkg.name %>.umd.js -t [ babelify --presets [ es2015 babili] ]`
},
browserify_devel_umd: {
command: () => `npx browserify --debug --standalone=TTY_Table ${_ignore} -r ./adapters/default-adapter.js > ./dist/<%= pkg.name %>.umd.js -t [ babelify --presets [ es2015 babili] ]`
},
browserify_prod_cjs: {
command: () => `npx browserify ${_ignore} -r ./adapters/default-adapter.js:<%= pkg.name %> > ./dist/<%= pkg.name %>.cjs.js -t [ babelify --presets [ es2015 babili] ]`
},
browserify_devel_cjs: {
command: () => `npx browserify --debug ${_ignore} -r ./adapters/default-adapter.js:<%= pkg.name %> > ./dist/<%= pkg.name %>.cjs.devel.js -t [ babelify --presets [ es2015 babili] ]`
},
generate_vim_tags_file: {
command: () => `find . -name \"*.js\" -path \"./src/*\" | xargs jsctags {} -f | sed \"/^$/d\" | sort > tags`
}
},
// regenerate tags file on file save
watch: {
scripts: {
files: ["**/*.js"],
tasks: [
"shell:generate_vim_tags_file",
"mochaTest:test"
],
options: {
spawn: true,
livereload: true // defaults to port 35729
}
}
}
})
grunt.loadNpmTasks("grunt-contrib-watch")
grunt.loadNpmTasks("grunt-shell")
grunt.registerTask("tags", [
"shell:generate_vim_tags_file",
])
grunt.registerTask("browserify", [
"shell:browserify_prod_umd",
//"shell:browserify_devel_umd",
"shell:browserify_prod_cjs",
//"shell:browserify_devel_cjs",
])
}