This repository has been archived by the owner on Aug 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
94 lines (84 loc) · 2.7 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
/*global module:false*/
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON("package.json"),
/**
* copy the main script into temp and give it package name and version
*/
copy: {
script: {
src: "src/tmp/<%= pkg.name %>.concat.wrap.<%= pkg.version %>.jsx",
dest: "dist/<%= pkg.name %>.<%= pkg.version %>.jsx",
},
'geo-json': {
src: "src/lib/world.geo.json/countries.geo.json",
dest: "src/tmp/countries.geo.min.json",
}
},
/**
* wrap into anonymous function
*/
wrap: {
'geo-json': {
src: ['src/tmp/countries.geo.min.json'],
dest: 'src/tmp/countries.geo.min.wrap.js',
options: {
wrapper: ['var idmap_countries = ', ';\n']
},
},
'anonymous': {
src: ['src/tmp/<%= pkg.name %>.concat.<%= pkg.version %>.jsx'],
dest: 'src/tmp/<%= pkg.name %>.concat.wrap.<%= pkg.version %>.jsx',
options: {
wrapper: ['(function(thisObj) {', '})(this);\n']
},
}
// script: {
// }
},
/**
* concat all the pieces into whan file ready for wrapping
* @type {Object}
*/
concat: {
dist: {
options: {
stripBanners: false,
banner: '\n/*! <%= pkg.name %>.jsx - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */\n',
nonull: true,
separator: '\n',
},
src: [
"src/idmap/license.jsx",
"src/idmap/globals.jsx",
"src/lib/extendscript.prototypes/dist/extendscript.prototypes.0.0.1.jsx",
"src/lib/extendscript.geo/dist/extendscript.geo.id.jsx",
"src/lib/extendscript.csv/dist/extendscript.csv.jsx",
"src/tmp/countries.geo.min.wrap.js",
"src/idmap/document.jsx",
"src/idmap/polygon.jsx",
"src/idmap/styling.jsx",
"src/idmap/geo.jsx",
"src/idmap/main.jsx"
],
dest: "src/tmp/<%= pkg.name %>.concat.<%= pkg.version %>.jsx",
}
},
watch: {
files: ['src/idmap/*.jsx', 'src/idmap/*.js', "src/lib/extendscript.geo/src/*", "src/lib/extendscript.csv/src/*"],
tasks: ['copy:geo-json', 'wrap:geo-json', 'concat:dist', 'wrap:anonymous', 'copy:script']
}
});
// These plugins provide necessary tasks.
// Default task.
//
// // This is required if you use any options.
grunt.task.run('notify_hooks');
grunt.registerTask('build-dist', ['copy:geo-json', 'wrap:geo-json', 'concat:dist', 'wrap:anonymous', 'copy:script']);
// Default task.
grunt.registerTask('default', ['watch']);
};