-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile OLD.js
116 lines (107 loc) · 3.77 KB
/
Gruntfile OLD.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
112
113
114
115
116
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks("grunt-git-describe");
grunt.loadNpmTasks('grunt-jsdoc');
var packageJson = grunt.file.readJSON("package.json"),
docsGlobals = '../OpenSeadragonImaging/docs/docs-globals.js',
distributionName = 'openseadragon-consolehook.js',
minifiedName = 'openseadragon-consolehook.min.js',
srcDir = 'src/',
buildDir = 'build/',
builtDir = buildDir + 'openseadragonconsolehook/',
docsDir = buildDir + 'docs/',
publishDir = '../msalsbery.github.io/builds/',
distribution = builtDir + distributionName,
minified = builtDir + minifiedName,
sources = [
srcDir + 'consolehook.js'
];
grunt.initConfig({
pkg: packageJson,
consolehookVersion: {
versionStr: packageJson.version,
major: parseInt(packageJson.version.split('.')[0], 10),
minor: parseInt(packageJson.version.split('.')[1], 10),
revision: parseInt(packageJson.version.split('.')[2], 10)
},
"git-describe": {
build: {
options: {
prop: "gitInfo"
}
}
},
clean: {
build: {
src: [builtDir]
},
doc: {
src: [docsDir]
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
beforeconcat: sources,
afterconcat: [distribution]
},
concat: {
options: {
banner: '//! <%= pkg.name %> <%= pkg.version %>\n'
+ '//! Build date: <%= grunt.template.today("yyyy-mm-dd") %>\n'
+ '//! Git commit: <%= gitInfo %>\n'
+ '//! https://github.com/msalsbery/OpenSeadragonConsoleHook\n',
//+ '//! License: http://msalsbery.github.io/openseadragonannohost/index.html\n\n',
process: true
},
dist: {
src: ['<banner>'].concat(sources),
dest: distribution
}
},
uglify: {
options: {
preserveComments: 'some'
},
build: {
src: distribution,
dest: minified
}
},
watch: {
files: ['Gruntfile.js', srcDir + '*.js'],
tasks: ['build']
//options: {
// event: ['added', 'deleted'], //'all', 'changed', 'added', 'deleted'
//}
},
jsdoc : {
dist : {
src: [docsGlobals, distribution],//, 'README.md'
options: {
destination: docsDir,
//template: "node_modules/docstrap/template",
configure: 'doc-conf.json'
}
}
}
});
// Copies built source to demo site folder
grunt.registerTask('publish', function() {
grunt.file.copy(distribution, publishDir + distributionName);
grunt.file.copy(minified, publishDir + minifiedName);
});
// Clean task(s).
grunt.registerTask('clean-build', ['clean:build']);
// Build task(s).
grunt.registerTask('build', ['clean:build', 'jshint:beforeconcat', 'git-describe', 'concat', 'jshint:afterconcat', 'uglify']);
// Documentation task(s).
grunt.registerTask('doc', ['clean:doc', 'jsdoc']);
// Default task(s).
grunt.registerTask('default', ['build']);
};