-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathGruntfile.js
53 lines (45 loc) · 1.26 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
module.exports = function (grunt) {
require("time-grunt")(grunt);
require("load-grunt-tasks")(grunt);
grunt.initConfig({
"pkg": grunt.file.readJSON("package.json"),
"clean": {
"all": ["dist/**"]
},
"copy": {
"h5o": {
"src": ["node_modules/h5o/dist/outliner.min.js"],
"dest": "dist/extension/outliner.min.js"
},
"license": {
"expand": true,
"src": ["MIT-LICENSE.TXT", "README.md"],
"dest": "dist/extension/"
},
"extension": {
"expand": true,
"cwd": 'src/',
"src": ["**"],
"dest": "dist/extension/"
}
},
"compress": {
"extension": {
"expand": true,
"cwd": "dist",
"src": ["extension/**"],
"options": {
"archive": "dist/outliner-v<%= pkg.version %>.zip"
}
}
}
});
grunt.registerTask("default", "Clean build", ["clean:all", "build", "compress"]);
grunt.registerTask("build", "Build unpacked extension", ["gen-manifest", "copy:h5o", "copy:extension", "copy:license"]);
grunt.registerTask("gen-manifest", function () {
var manifest = grunt.file.readJSON("manifest.json");
manifest.version = grunt.config.get("pkg.version");
manifest.author = grunt.config.get("pkg.author");
grunt.file.write("dist/extension/manifest.json", JSON.stringify(manifest, null, " "));
});
};