This repository has been archived by the owner on Dec 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Gruntfile.js
executable file
·195 lines (177 loc) · 6.14 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
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file.
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Project configuration.
grunt.initConfig({
/**
* This will load in our package.json file so we can have access
* to the project name and version number.
*/
pkg: grunt.file.readJSON('package.json'),
/**
* Constants for the Gruntfile so we can easily change the path for our environments.
*/
BASE_PATH: '',
DEVELOPMENT_PATH: 'js/',
EXAMPLES_PATH: 'examples/',
PRODUCTION_PATH: 'web/',
/**
* A code block that will be added to our minified code files.
* Gets the name and version and other info from the above loaded 'package.json' file.
* @example <%= banner.join("\\n") %>
*/
banner: [
'/*',
'* Project: <%= pkg.name %>',
'* Version: <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>)',
'* Development By: <%= pkg.developedBy %>',
'* Copyright(c): <%= grunt.template.today("yyyy") %>',
'*/'
],
/**
* Cleans or deletes our production folder before we create a new production build.
*/
clean: {
ts: ['ts/**/*.js'],
//js: ['js/**/*']
interface: ['js/interface']
},
concat: {
all: {
src: [
'js/plugin/jquery.eventListener.js',
'js/util/ComponentFactory.js',
'js/util/DateUtil.js',
'js/util/MathUtil.js',
'js/util/MerchantUtil.js',
'js/util/NumberUtil.js',
'js/util/StringUtil.js',
'js/util/TemplateFactory.js',
'js/util/Util.js',
'js/util/ValidationUtil.js',
'js/util/Extend.js',
'js/BaseObject.js',
'js/ObjectManager.js',
'js/event/BaseEvent.js',
'js/event/native/NavigatorEvents.js',
'js/event/ApplicationCacheEvent.js',
'js/event/EventDispatcher.js',
'js/event/EventBroker.js',
'js/event/LocalStorageEvent.js',
'js/event/NetworkMonitorEvent.js',
'js/event/RouterEvent.js',
'js/event/TimerEvent.js',
'js/util/Timer.js',
'js/util/BrowserUtil.js',
'js/service/ApplicationCacheService.js',
'js/service/LocalStorageService.js',
'js/service/Router.js',
'js/geom/Point.js',
'js/model/BaseModel.js',
'js/model/Collection.js',
'js/model/Route.js',
'js/net/NetworkMonitor.js',
'js/display/DisplayObject.js',
'js/display/DisplayObjectContainer.js',
'js/display/DOMElement.js',
'js/display/Bitmap.js',
'js/display/CanvasElement.js',
'js/display/Sprite.js',
'js/display/TextField.js'
],
dest: './structurejs.js'
},
view: {
src: [
'js/display/DOMElement.js',
'js/display/DisplayObjectContainer.js',
'js/display/DisplayObject.js',
'js/event/BaseEvent.js',
'js/event/EventDispatcher.js',
'js/util/ComponentFactory.js',
'js/util/TemplateFactory.js',
'js/util/Extend.js',
'js/ObjectManager.js',
'js/BaseObject.js'
],
dest: './structurejs.view.js'
}
},
uglify: {
all: {
files: {
'./structurejs.min.js': ['./structurejs.js']
}
},
view: {
files: {
'./structurejs.view.min.js': ['./structurejs.view.js']
}
}
},
/**
* YUIDoc plugin that will generate documentation from our YUI comments.
*/
yuidoc: {
compile: {
name: 'StructureJS',
description: '<%= pkg.description %>',
version: '<%= pkg.version %>',
url: '<%= pkg.homepage %>',
options: {
linkNatives: 'true',
paths: 'ts/',
outdir: '<%= BASE_PATH %>docs',
themedir: 'friendly-theme',
extension: '.ts', // Default '.js' <comma-separated list of file extensions>
exclude: 'interface'
}
}
},
ts: {
default: {
src: ['<%= BASE_PATH %>' + 'ts/**/*.ts'],
outDir: '<%= DEVELOPMENT_PATH %>',
options: {
target: 'es5',
module: 'umd',
basePath: '',
sourceMap: false,
declaration: true,
nolib: false,
comments: true
}
}
},
jest: {
options: {
coverage: true,
testPathPattern: /.\/__tests__\/.*-test.js/
}
}
});
/**
* Grunt tasks:
*/
grunt.registerTask('default', [
'clean',
'ts'
]);
grunt.registerTask('docs', [
'yuidoc'
]);
grunt.registerTask('all', [
'concat',
'uglify'
]);
grunt.registerTask('test', [
'jest'
]);
grunt.registerTask('release', [
'default',
'clean:interface',
// TODO: update version number in bower.json and package.json
'yuidoc',
'jest'
]);
};