/
Gruntfile.js
241 lines (238 loc) · 8.09 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
module.exports = function(grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
exec: {
version: {
command: 'node ./util/version.js'
},
clear: {
command: 'rm -Rf node_modules yarn.lock'
}
},
watch: {
options: {
dateFormat: function(time) {
grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString());
grunt.log.writeln('Waiting for more changes...');
},
},
css: {
files: ['src/css/*.css'],
tasks: ['concat:css']
},
main: {
files: [
'src/js/polyfills.js',
'src/js/init.js',
'src/js/app.js',
'src/js/directives/*.js',
'src/js/filters/*.js',
'src/js/routes.js',
'src/js/services/*.js',
'src/js/models/*.js',
'src/js/controllers/*.js'
],
tasks: ['concat:js']
}
},
concat: {
options: {
sourceMap: false,
sourceMapStyle: 'link' // embed, link, inline
},
angular: {
src: [
'node_modules/@bower_components/fastclick/lib/fastclick.js',
'node_modules/@bower_components/qrcode-generator/js/qrcode.js',
'node_modules/@bower_components/qrcode-decoder-js/lib/qrcode-decoder.js',
'node_modules/@bower_components/moment/min/moment-with-locales.js',
'node_modules/@bower_components/angular/angular.js',
'node_modules/@bower_components/angular-ui-router/release/angular-ui-router.js',
'node_modules/@bower_components/angular-foundation/mm-foundation-tpls.js',
'node_modules/@bower_components/angular-moment/angular-moment.js',
'node_modules/@bower_components/ng-lodash/build/ng-lodash.js',
'node_modules/@bower_components/angular-qrcode/angular-qrcode.js',
'node_modules/@bower_components/angular-gettext/dist/angular-gettext.js',
'node_modules/@bower_components/angular-touch/angular-touch.js',
'node_modules/@bower_components/angular-carousel/dist/angular-carousel.js',
'node_modules/@bower_components/angular-ui-switch/angular-ui-switch.js',
'node_modules/@bower_components/angular-elastic/elastic.js',
'node_modules/@bower_components/ui-router-extras/release/ct-ui-router-extras.js',
'node_modules/@bower_components/markdown-it/dist/markdown-it.min.js',
'node_modules/@bower_components/chart.js/dist/Chart.min.js',
'node_modules/@bower_components/chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.min.js'
],
dest: 'public/angular.js'
},
js: {
src: [
'src/js/polyfills.js',
'angular-bitcore-wallet-client/index.js',
'src/js/app.js',
'src/js/routes.js',
'src/js/directives/*.js',
'src/js/filters/*.js',
'src/js/models/*.js',
'src/js/services/*.js',
'src/js/controllers/*.js',
'src/js/version.js',
'src/js/init.js'
],
dest: 'public/obyte.js'
},
css: {
src: ['src/css/*.css'],
dest: 'public/css/obyte.css'
},
foundation: {
src: [
'node_modules/@bower_components/angular/angular-csp.css',
'node_modules/@bower_components/foundation/css/foundation.css',
'node_modules/@bower_components/animate.css/animate.css',
'node_modules/@bower_components/angular-ui-switch/angular-ui-switch.css',
'node_modules/@bower_components/angular-carousel/dist/angular-carousel.css'
],
dest: 'public/css/foundation.css',
}
},
uglify: {
options: {
mangle: false
},
prod: {
files: {
'public/obyte.js': ['public/obyte.js'],
'public/angular.js': ['public/angular.js']
}
},
partialClient: {
files: {
'public/partialClient.js': ['public/partialClient.js']
}
}
},
babel: {
options: {
sourceMaps: false,
presets: ['@babel/preset-env']
},
prod: {
files: {
'public/obyte.js': 'public/obyte.js',
// 'public/angular.js': 'public/angular.js',
'public/partialClient.js': 'public/partialClient.js'
}
},
},
nggettext_extract: {
pot: {
files: {
'i18n/po/template.pot': [
'public/index.html',
'public/views/*.html',
'public/views/**/*.html',
'src/js/routes.js',
'src/js/services/*.js',
'src/js/controllers/*.js'
]
}
},
},
nggettext_compile: {
all: {
options: {
format: "json",
module: 'copayApp'
},
files: [
{
expand: true,
dot: true,
cwd: "i18n/po",
dest: "public/languages",
src: ["*.po"],
ext: ".json"
}
]
},
},
copy: {
icons: {
expand: true,
flatten: true,
src: 'node_modules/@bower_components/foundation-icon-fonts/foundation-icons.*',
dest: 'public/icons/'
},
modules: {
expand: true,
flatten: true,
options: {timestamp: true, mode: true},
src: ['src/js/fileStorage.js'],
dest: 'public/'
}
},
browserify: {
dist:{
options:{
exclude: ['sqlite3', 'electron', 'mysql', 'ws', 'regedit', 'fs', 'path', 'socks'],
ignore: ['../ocore/kvstore.js', './node_modules/ocore/kvstore.js', '../ocore/desktop_app.js', './node_modules/ocore/desktop_app.js', '../ocore/mail.js', './node_modules/ocore/mail.js']
},
src: 'public/obyte.js',
dest: 'public/obyte.js'
},
partialClient:{
options:{
exclude: ['sqlite3', 'electron', 'mysql', 'ws', 'regedit', 'fs', 'path', 'socks'],
ignore: ['../ocore/kvstore.js', './node_modules/ocore/kvstore.js', '../ocore/desktop_app.js', './node_modules/ocore/desktop_app.js', '../ocore/mail.js', './node_modules/ocore/mail.js']
},
src: 'src/js/partialClient.js',
dest: 'public/partialClient.js'
}
},
clean: {
options: {
force: true
},
mac: {
src: [
"../obytebuilds/mac*/Obyte*.app/Contents/Resources/app/node_modules/rocksdb/prebuilds/!(darwin)-*/**",
"../obytebuilds/mac*/Obyte*.app/Contents/Resources/app/node_modules/rocksdb/build/**",
"../obytebuilds/mac*/Obyte*.app/Contents/Frameworks/Electron Framework.framework/Resources/!(en)*.lproj/**",
"../obytebuilds/mac*/Obyte*.app/Contents/Resources/!(en)*.lproj/**"
]
},
win: {
src: [
"../obytebuilds/*win-*/resources/app/node_modules/rocksdb/prebuilds/!(win*)-*/**",
"../obytebuilds/*win-*/resources/app/node_modules/rocksdb/build/deps/**",
"../obytebuilds/*win-*/locales/!(en)*.pak*"
]
},
linux: {
src: [
"../obytebuilds/*linux-*/resources/app/node_modules/rocksdb/prebuilds/!(linux)-*/**",
"../obytebuilds/*linux-*/resources/app/node_modules/rocksdb/build/deps/**",
"../obytebuilds/*linux-*/locales/!(en)*.pak*"
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-angular-gettext');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('default', ['nggettext_compile', 'exec:version', 'concat', 'copy:icons', 'copy:modules']);
grunt.registerTask('watch-dev', ['default', 'watch']);
grunt.registerTask('cordova', ['default', 'browserify', 'babel']);
grunt.registerTask('cordova-prod', ['cordova', 'uglify']);
grunt.registerTask('translate', ['nggettext_extract']);
grunt.registerTask('prepare-dist', ['default']);
grunt.registerTask('partial', ['browserify:partialClient', 'uglify:partialClient']);
grunt.registerTask('partial-fast', ['browserify:partialClient']);
};