-
Notifications
You must be signed in to change notification settings - Fork 0
/
GruntfileBuild.js
90 lines (86 loc) · 2.67 KB
/
GruntfileBuild.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
/**
* @desc Gruntfile to build dist when running npm install
*/
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */ \n \n (function () { \n',
footer: '\n })();\n',
stripHeaders: true
},
dist: {
src: ['lib/static/dev/core.js', 'lib/static/dev/browser.js'],
dest: 'lib/static/dev/temp.js'
},
angular: {
src: ['lib/static/dev/core.js', 'lib/static/dev/ng-upper.js'],
dest: 'lib/static/dev/ng-temp.js'
},
},
browserify: {
dist: {
files: {
'lib/static/dist/upper.js': ['lib/static/dev/temp.js'],
'lib/static/dist/ng-upper.js': ['lib/static/dev/ng-temp.js']
},
options: {
}
}
},
uglify: {
dist: {
files: {
'lib/static/dist/upper.min.js': ['lib/static/dist/upper.js'],
'lib/static/dist/ng-upper.min.js': ['lib/static/dist/ng-upper.js']
}
}
},
clean: {
build: {
src: ["lib/static/dev/temp.js", "lib/static/dev/ng-temp.js"]
}
},
express: {
options: {
},
test: {
options: {
script: 'test/resources/server.js',
spawn: false
}
}
},
// Distribution
mkdir: {
dist: {
options: {
create: ['dist', './dist']
},
},
},
copy: {
dist: {
files: [
{
expand: true,
src: ['index.js', 'package.json', 'README.md', 'lib/**/**/**/**/*.js'],
dest: 'dist'
}
]
}
}
});
// npm modules
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-mkdir');
grunt.loadNpmTasks('grunt-contrib-copy');
// tasks
grunt.registerTask('build', ['concat:dist', 'concat:angular', 'browserify', 'uglify', 'clean']);
grunt.registerTask('default', ['build']);
};