This repository has been archived by the owner on Sep 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
128 lines (115 loc) · 2.64 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
var grunt = require('grunt');
var path = require('path');
var mkdirp = require('mkdirp');
grunt.initConfig({
app: {
name: 'Note_Taker',
version: '1.0'
},
copy: {
main: {
cwd: 'target/dist/',
src: ['**', '!*.eot', '!*.svg', '!*.ttf', '!*.woff'],
dest: 'target/<%= app.name %>_v<%= app.version %>/ui/',
expand: true
},
installJson: {
src: 'install.json',
dest: 'target/<%= app.name %>_v<%= app.version %>',
expand: true
},
readme: {
src: 'README.md',
dest: 'target/<%= app.name %>_v<%= app.version %>',
expand: true
},
parameters: {
src: 'install.json',
dest: 'target/<%= app.name %>_v<%= app.version %>/ui',
expand: true
}
},
clean: {
bundle: {
src: [
'target/'
],
options: {
expand: true
}
}
},
exec: {
createDirectory: {
cmd: function() {
var dir = 'target/dist';
mkdirp(dir, console.log);
return 'ls';
}
},
buildProd: path.relative('', 'node_modules/.bin/ng build') + ' --aot --prod --output-path target/dist --base-href .',
buildDev: path.relative('', 'node_modules/.bin/ng build') + ' --aot --output-path target/dist --base-href .',
serve: path.relative('', 'node_modules/.bin/ng serve')
},
tslint: {
options: {
configuration: grunt.file.readJSON('tslint.json')
},
files: {
src: ['app/**/*.ts']
}
},
compress: {
main: {
options: {
archive: 'target/<%= app.name %>_v<%= app.version %>.tcx',
pretty: true,
mode: 'zip'
},
expand: true,
cwd: 'target/<%= app.name %>_v<%= app.version %>/',
src: ['**/*'],
dest: '/<%= app.name %>_v<%= app.version %>/'
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask(
'buildProd',
'Compiles all assets and source files into build directory.',
[
'clean',
'exec:createDirectory',
'exec:buildProd',
'copy',
'compress',
]
);
grunt.registerTask(
'buildDev',
'Compiles all assets and source files into build directory.',
[
'clean',
'exec:createDirectory',
'exec:buildDev',
'copy',
'compress'
]
);
grunt.registerTask(
'serve',
'Runs the build, then serves the project locally.',
[
'exec:serve'
]
);
grunt.registerTask(
'default',
'Run default build',
[
'buildProd'
]
);