forked from Esri/offline-editor-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
155 lines (149 loc) · 5.84 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
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/base64utils.js',
'lib/tiles/OfflineTilesBasic.js',
'lib/tiles/OfflineTilesAdvanced.js',
'lib/tiles/OfflineTilesNS.js',
'lib/tiles/TilesCore.js',
'lib/tiles/TilesStore.js',
'lib/tiles/base64string.js',
'lib/stiles/lzString.js',
'lib/tiles/tilingScheme.js',
'lib/tpk/autoCenterMap.js',
'lib/tpk/OfflineTpkNS.js',
'lib/tpk/TPKLayer.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 */
editAdvanced: {
src: [
'lib/edit/offlineJSOptions.js',
'lib/edit/OfflineEditAdvanced.js',
'lib/edit/OfflineEditNS.js',
'lib/edit/editsStore.js',
'lib/edit/attachmentsStore.js'
],
dest: 'dist/offline-edit-advanced-src.js'
},
editBasic: {
src: [
'lib/edit/offlineJSOptions.js',
'lib/edit/OfflineEditBasic.js',
'lib/edit/OfflineEditNS.js',
'lib/edit/editStorePOLS.js'
],
dest: 'dist/offline-edit-basic-src.js'
},
/* Tiles basic is for use with WebMaps. Cannot be reloaded or restarted while offline */
tilesBasic: {
src: [
'lib/tiles/OfflineTilesBasic.js',
'lib/tiles/OfflineTilesNS.js',
'lib/tiles/base64utils.js',
'lib/tiles/base64string.js',
'lib/tiles/lzString.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/OfflineTilesAdvanced.js',
'lib/tiles/OfflineTilesNS.js',
'lib/tiles/base64utils.js',
'lib/tiles/base64string.js',
'lib/tiles/lzString.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/tiles/lzString.js',
'lib/tiles/base64String.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 :)
},
beautify: {
semicolons: false //Required: prevents dojo parser errors w/ minified files in this project
},
preserveComments: /^!/,
wrap: false
// mangle: {
// except: ['O']
// }
},
dist: {
files: {
'dist/offline-edit-advanced-min.js': ['dist/offline-edit-advanced-src.js'],
'dist/offline-edit-basic-min.js': ['dist/offline-edit-basic-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']);
};