forked from Esri/offline-editor-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
127 lines (120 loc) · 4.48 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
js: {
files: [
'Gruntfile.js',
'lib/*.js',
'lib/edit/*.js',
'lib/tiles/*.js',
'lib/tpk/*.js'
],
tasks: ['jshint','concat', 'uglify'],
options: {
spawn: false
}
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
files: {
src: [
'Gruntfile.js',
'lib/edit/*.js'
//'lib/tiles/*.js',
//'lib/tpk/*.js'
]
}
},
concat: {
options: {
separator: '\n',
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> Environmental Systems Research Institute, Inc.\n' +
'* Apache License' +
'*/\n'
},
/* All feature editing capabilities: adds, updates and deletes */
edit: {
src: [
'lib/edit/offlineFeaturesManager.js',
'lib/edit/OfflineEditNS.js',
'lib/edit/editsStore.js',
'lib/edit/attachmentsStore.js'
],
dest: 'dist/offline-edit-src.js'
},
/* Tiles basic is for use with WebMaps. Cannot be reloaded or restarted while offline */
tilesBasic: {
src: [
'lib/tiles/offlineTilesEnabler.js',
'lib/tiles/OfflineTilesNS.js',
'lib/tiles/base64utils.js',
'lib/tiles/FileSaver.js',
'lib/tiles/TilesCore.js',
'lib/tiles/TilesStore.js',
'lib/tiles/tilingScheme.js'
],
dest: 'dist/offline-tiles-basic-src.js'
},
/* Tiles advanced is for use with tiled map services. Works with reload or restart while offline */
tilesAdvanced: {
src: [
'lib/tiles/offlineTilesEnablerLayer.js',
'lib/tiles/OfflineTilesNS.js',
'lib/tiles/base64utils.js',
'lib/tiles/FileSaver.js',
'lib/tiles/TilesCore.js',
'lib/tiles/TilesStore.js',
'lib/tiles/tilingScheme.js'
],
dest: 'dist/offline-tiles-advanced-src.js'
},
/* TPKLayer - for working directly with tile packages (.tpk files) */
tpk: {
src: [
'lib/tpk/TPKLayer.js',
'lib/tpk/OfflineTpkNS.js',
'lib/tiles/TilesStore.js',
'lib/tpk/zip.js',
'lib/tpk/autoCenterMap.js',
'lib/tpk/inflate.js',
'lib/tpk/xml2json.js'
],
dest: 'dist/offline-tpk-src.js'
}
},
uglify: {
options: {
compress: {
drop_console: true //remove console.log statements :)
},
preserveComments: 'some',
wrap: false
// mangle: {
// except: ['O']
// }
},
dist: {
files: {
'dist/offline-edit-min.js': ['dist/offline-edit-src.js'],
'dist/offline-tiles-basic-min.js': ['dist/offline-tiles-basic-src.js'],
'dist/offline-tiles-advanced-min.js': ['dist/offline-tiles-advanced-src.js'],
'dist/offline-tpk-min.js': ['dist/offline-tpk-src.js']
}
}
}
});
// Load required modules
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('build',['jshint','concat','uglify']);
grunt.registerTask('test',['jshint']);
//grunt.registerTask('buildAll',['jshint','concat','uglify']);
};