-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathartifacts.js
More file actions
263 lines (245 loc) · 7.87 KB
/
artifacts.js
File metadata and controls
263 lines (245 loc) · 7.87 KB
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
export const buildXML = function(compress, options, output) {
const logv = require('./pluginUtil').logv
logv(options,'FUNCTION buildXML')
let compression = ''
if (compress) {
compression = `
then
fs
minify
-yui
-from=ext.js
-to=ext.js
`;
}
return `<project name="simple-build" basedir=".">
<!-- internally, watch calls the init target, so need to have one here -->
<target name="init"/>
<target name="init-cmd">
<taskdef resource="com/sencha/ant/antlib.xml"
classpath="\${cmd.dir}/sencha.jar"
loaderref="senchaloader"/>
<x-extend-classpath>
<jar path="\${cmd.dir}/sencha.jar"/>
</x-extend-classpath>
<x-sencha-init prefix=""/>
<x-compile refid="theCompiler"
dir="\${basedir}"
initOnly="true"
inheritAll="true">
<![CDATA[
-classpath=\${basedir}/manifest.js
load-app
-temp=\${basedir}/temp
-tag=App
]]>
</x-compile>
</target>
<target name="rebuild">
<x-compile refid="theCompiler"
dir="\${basedir}"
inheritAll="true">
<![CDATA[
--debug
exclude
-all
and
include
-f=Boot.js
and
concatenate
ext.js
and
exclude
-all
and
# include theme overrides
include
-r
-tag=overrides
and
# include all js files needed for manifest.js
include
-r
-f=manifest.js
and
# exclude the generated manifest file itself,
# since we don't want the generated bundle file to create any components
exclude
-f=manifest.js
and
concatenate
+append
ext.js
and
scss
-appName=App
-imageSearchPath=resources
-themeName=triton
-resourceMapBase=.
-output=ext.scss
and
resources
-excludes=-all*.css
-out=resources
and
resources
-model=true
-out=resources
]]>
</x-compile>
</target>
<target name="build" depends="init-cmd,rebuild">
<x-sencha-command dir="\${basedir}">
<![CDATA[
fashion
-pwd=.
-split=4095
${compress ? '-compress' : ''}
ext.scss
ext.css
${compression}
]]>
</x-sencha-command>
</target>
<target name="watch" depends="init-cmd,build">
<x-fashion-watch
refName="fashion-watch"
inputFile="ext.scss"
outputFile="ext.css"
split="4095"
compress="${compress ? 'true' : 'false'}"
configFile="app.json"
fork="true"/>
<x-watch compilerRef="theCompiler" targets="rebuild"/>
</target>
</project>
`.trim()
}
export function createAppJson( theme, packages, toolkit, options, output ) {
const logv = require('./pluginUtil').logv
logv(options,'FUNCTION createAppJson')
const fs = require('fs')
var isWindows = typeof process != 'undefined' && typeof process.platform != 'undefined' && !!process.platform.match(/^win/);
var pathDifference = output.substring(process.cwd().length)
var numberOfPaths = pathDifference.split(isWindows ? "\\" : "/").length - 1;
var nodeModulePath = ''
for (var i = 0; i < numberOfPaths; i++) {
nodeModulePath += "../"
}
const config = {
framework: "ext",
toolkit,
requires: packages,
"overrides": [
"overrides",
"jsdom-environment.js"
],
// "language": {
// "js": {
// "output": "ES5"
// }
// },
"packages": {
"dir": [
nodeModulePath + "node_modules/@sencha",
nodeModulePath + toolkit + "/packages"
]
},
output: {
base: '.',
resources: {
path: './resources',
shared: "./resources"
}
}
}
// if theme is local add it as an additional package dir
if (fs.existsSync(theme)) {
const path = require('path')
const cjson = require('cjson')
const packageInfo = cjson.load(path.join(theme, 'package.json'));
config.theme = packageInfo.name;
config.packages.dir.push(path.resolve(theme));
} else {
config.theme = theme;
}
return JSON.stringify(config, null, 2)
}
export function createJSDOMEnvironment(options, output) {
const logv = require('./pluginUtil').logv
logv(options,'FUNCTION createJSDOMEnvironment')
return 'window.Ext = Ext;'
}
export function createWorkspaceJson(options, output) {
const logv = require('./pluginUtil').logv
logv(options,'FUNCTION createWorkspaceJson')
var isWindows = typeof process != 'undefined' && typeof process.platform != 'undefined' && !!process.platform.match(/^win/);
var pathDifference = output.substring(process.cwd().length)
var numberOfPaths = pathDifference.split(isWindows ? "\\" : "/").length - 1;
var nodeModulePath = ''
for (var i = 0; i < numberOfPaths; i++) {
nodeModulePath += "../"
}
const cjson = require('cjson');
// or add ExtWebpackPlugin({..., useWorkspaces: true})
const lernaInfo = cjson.load(process.cwd() + '/../../lerna.json');
if (lernaInfo && lernaInfo.useWorkspaces) {
nodeModulePath += "../";
nodeModulePath += "../";
}
logv(options,'isWindows: ' + isWindows)
logv(options,'output: ' + output)
logv(options,'pathDifference: ' + pathDifference)
logv(options,'numberOfPaths: ' + numberOfPaths)
logv(options,'nodeModulePath: ' + nodeModulePath)
const config = {
"frameworks": {
"ext": nodeModulePath + "node_modules/@sencha/ext"
},
"build": {
"dir": "${workspace.dir}/" + nodeModulePath + "build"
},
"packages": {
"dir": [
"${workspace.dir}/" + nodeModulePath + "ext-" + options.framework + "/packages/local",
"${workspace.dir}/" + nodeModulePath + "ext-" + options.framework + "/packages",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-base",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-ios",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-material",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-aria",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-neutral",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-classic",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-gray",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-crisp",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-crisp-touch",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-neptune",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-neptune-touch",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-triton",
"${workspace.dir}/" + nodeModulePath + "node_modules/@sencha/ext-${toolkit.name}-theme-graphite"
],
"extract": "${workspace.dir}/" + nodeModulePath + "packages/remote"
}
}
if (options.packageDirs) {
config.packages.dir = config.packages.dir.concat(options.packageDirs);
}
return JSON.stringify(config, null, 2)
}
export const extAngularModule = function(imports, exports, declarations) {
return `
import { NgModule } from '@angular/core';
${imports}
@NgModule({
imports: [
],
declarations: [
${declarations} ],
exports: [
${exports} ]
})
export class ExtAngularModule { }
`
}