This repository has been archived by the owner on Jun 21, 2024. It is now read-only.
forked from handsontable/ngHandsontable
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
132 lines (123 loc) · 3.31 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/**
* This file is used to build ngHandsontable from `src/*`
*
* Installation:
* 1. Install Grunt CLI (`npm install -g grunt-cli`)
* 1. Install Grunt 0.4.0 and other dependencies (`npm install`)
*
* Build:
* Execute `grunt` from root directory of this directory (where Gruntfile.js is)
* To execute automatically after each change, execute `grunt --force default watch`
*
* Result:
* building ngHandsontable will create files:
* - dist/ngHandsontable.js
* - dist/ngHandsontable.min.js
*
* See http://gruntjs.com/getting-started for more information about Grunt
*/
module.exports = function (grunt) {
var myBanner = '/**\n' +
' * <%= pkg.name %> <%= pkg.version %>\n' +
' * \n' +
' * Copyright 2012-2015 Marcin Warpechowski\n' +
' * Copyright 2015 Handsoncode sp. z o.o. <hello@handsontable.com>\n' +
' * Licensed under the MIT license.\n' +
' * https://github.com/handsontable/ngHandsontable\n' +
' * Date: <%= (new Date()).toString() %>\n' +
'*/\n\n';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
banner: myBanner
},
new: {
src: [
'src/ie-shim.js',
'src/ngHandsontable.js',
'src/services/*.js',
'src/directives/*.js'
],
dest: 'dist/ngHandsontable.js'
}
},
uglify: {
options: {
banner: myBanner
},
"dist/ngHandsontable.min.js": ["dist/ngHandsontable.js"]
},
jshint: {
options: {
jshintrc: true
},
files:['src/**/*.js', 'src/*.js']
},
jscs: {
main: {
files: {
src: ['src/**/*.js', 'src/*.js']
}
},
options: {
config: '.jscsrc',
esnext: true,
verbose: true
}
},
watch: {
files: ['src/**/*.js'],
tasks: ['concat', 'uglify']
},
browserify: {
demoApp: {
src: [
'./demo/js/**/*.js'
],
dest: './demo/build/app.js',
options: {
alias: [
'./demo/js/demos.js:demos',
'./demo/js/modules.js:modules',
'./demo/js/routing.js:routing'
],
transform: [
['browserify-replace', {
replace: [
{ from: /@@version/, to: '<%= pkg.version %>' }
]
}
]
]
}
},
demoAppWatch: {
src: [
'./demo/js/**/*.js'
],
dest: './demo/build/app.js',
options: {
alias: [
'./demo/js/demos.js:demos',
'./demo/js/modules.js:modules',
'./demo/js/routing.js:routing'
],
watch: true,
keepAlive: true
}
}
}
});
grunt.registerTask('build', ['jscs', 'jshint', 'concat', 'uglify']);
grunt.registerTask('default', ['build']);
grunt.registerTask('watch-demo-app', ['browserify:demoAppWatch']);
grunt.registerTask('build-demo-app', ['browserify:demoApp']);
grunt.registerTask('build-release', ['build', 'build-demo-app']);
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jscs');
};