-
Notifications
You must be signed in to change notification settings - Fork 5
/
globals.js
289 lines (250 loc) · 10.4 KB
/
globals.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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
exports.setGlobals =() => {
console.log('These are set in globals.js...\n')
global["createFolders"] = true;
global["launch"] = true;
global["postLaunch"] = true;
global["copy"] = false;
global["doWebComponents"] = false;
global["doAngular"] = false;
global["doReact"] = false;
global["doDoc"] = false;
global["products"] = process.argv[4]
var products = global["products"].split("-");
//console.log(products)
if (products.includes("extwebcomponents")) {
global["doWebComponents"] = true;
}
if (products.includes("extangular")) {
global["doAngular"] = true;
}
if (products.includes("extreact")) {
global["doReact"] = true;
}
//console.log(global["doWebComponents"])
//console.log(global["doAngular"])
//console.log(global["doReact"])
global["npmInstall"] = true;
global["npmPublishRightAfter"] = false;
console.log('PRODUCTS:')
console.log(`doWebComponents:\t${doWebComponents}`)
console.log(`doAngular:\t\t${doAngular}`)
console.log(`doReact:\t\t${doReact}`)
console.log(`doDoc:\t\t\t${doDoc}`)
console.log(`\n`)
console.log('STEPS:')
//console.log(`createFolders:\t\t${createFolders}`)
//console.log(`launch:\t\t\t${launch}`)
//console.log(`postLaunch:\t\t${postLaunch}`)
console.log(`npmInstall:\t\t${npmInstall}`)
console.log(`npmPublishRightAfter:\t${npmPublishRightAfter}`)
//console.log(`copy:\t\t\t${copy}`)
console.log(`\n`)
global['ExtVersion'] = '7.4.0'
global['AllClassesFolder'] = './'
global["generatedFolders"] = "./GeneratedFolders/";
global["suffixArgv"] = process.argv[2]
global["toolkitArgv"] = process.argv[3]
global["ext-tree"] = []
global["xtype-tree"] = []
global["xtypes"] = []
global["reactnames"] = []
global["toolkit"] = `${toolkitArgv}`;
var toolkits = ['modern', 'classic'];
if (toolkits.includes(toolkit) == false) {
log('toolkit not valid')
return
}
global["suffix"] = `${suffixArgv}`;
var suffixes = ['blank', 'grid'];
if (suffixes.includes(suffix) == false) {
log('suffix not valid')
return
}
const genItUtils = require("./genItUtils");
global["run"] = genItUtils.run;
global["writeTemplateFile"] = genItUtils.writeTemplateFile;
global["doProperties"] = genItUtils.doProperties;
global["doMethods"] = genItUtils.doMethods;
global["doEvents"] = genItUtils.doEvents;
global["copyFileSync"] = require('fs-copy-file-sync');
global["fs"] = require("fs-extra");
global["rimraf"] = require("rimraf");
global["mkdirp"] = require("mkdirp");
require("./XTemplate");
global["all"] = [];
global["info"] = {};
info.now = new Date().toString();
info.toolkit = toolkit;
info.Toolkit = info.toolkit.charAt(0).toUpperCase() + info.toolkit.slice(1);
info.suffixParm = suffix;
global["typeFolder"] = generatedFolders + info.suffixParm + '/';
if (info.suffixParm == 'material-ui') {
info.toolkitshown = ``;
}
else {
info.toolkitshown = `-${info.toolkit}`;
}
info.version = ExtVersion;
info.framework = 'elements';
if (info.suffixParm == 'blank' ||
info.suffixParm == 'test'
) {
info.bundle = ''
info.Bundle = ''
info.name = ''
}
else {
info.bundle = '-' + info.suffixParm
info.Bundle = info.suffixParm.charAt(0).toUpperCase() + info.suffixParm.slice(1);
info.name = info.bundle.substring(1)
}
info.data = require(`${AllClassesFolder}/AllClassesFiles/docs/${info.toolkit}/${info.toolkit}-all-classes-flatten.json`);
info.wantedxtypes = require(`./npmpackage/${toolkit}/${info.suffixParm}`).getXtypes();
global["moduleVars"] = { imports: "", declarations: "", exports: "" };
info.webComponentsImports = []
info.webComponentsImportsPlain = []
info.reactImportsArray = []
info.reactImportsArrayPlain = []
info.angularImports = []
info.allExtended = '';
info.imports = ''
info.declarations = ''
info.elements = ''
info.manifest = ''
for (var i = 0; i < info.wantedxtypes.length; i++) {
var w = info.wantedxtypes[i]
var W = w.charAt(0).toUpperCase() + w.slice(1);
info.manifest = info.manifest + `{"xtype":"${w}"},\n`
info.elements = info.elements + `<ext-${w}></\ext-${w}>\n\n`
info.declarations = info.declarations + ` Ext${W}Component,\n`
//info.importsxng = info.imports + `import {Ext${W}Component} from\n '@sencha/ext-angular-${info.xztype}/esm5/src/ext-${w}.component';\n`
//info.importsewc = info.imports + `import '@sencha/ext-web-components-${info.xztype}/lib/ext-${w}.component';\n`
}
if(doAngular == true) {
info.angular = {}
info.angular.module = ''
info.angular.component = ''
}
if(doReact == true) {
info.reactImports = ''
info.reactExports = ''
info.reactExports70 = ''
info.reactExportsCase = ''
}
var docs = []
if (info.toolkit == 'modern' && info.suffixParm != 'material-ui') {
info.reactExportsCase = `
export const ActionSheet = ExtActionsheet_;
export const BreadcrumbBar = ExtBreadcrumbbar_;
export const Calendar_Event = ExtCalendar_event_;
export const Calendar_Form_Add = ExtCalendar_form_add_;
export const Calendar_Calendar_Picker = ExtCalendar_calendar_picker_;
export const Calendar_Form_Edit = ExtCalendar_form_edit_;
export const Calendar_Timefield = ExtCalendar_timefield_;
export const Calendar_Daysheader = ExtCalendar_daysheader_;
export const Calendar_Weeksheader = ExtCalendar_weeksheader_;
export const Calendar_List = ExtCalendar_list_;
export const Calendar_Day = ExtCalendar_day_;
export const Calendar_Days = ExtCalendar_days_;
export const Calendar_Month = ExtCalendar_month_;
export const Calendar_Week = ExtCalendar_week_;
export const Calendar_Weeks = ExtCalendar_weeks_;
export const Calendar_Dayview = ExtCalendar_dayview_;
export const Calendar_Daysview = ExtCalendar_daysview_;
export const Calendar_Monthview = ExtCalendar_monthview_;
export const Calendar_Multiview = ExtCalendar_multiview_;
export const Calendar_Weekview = ExtCalendar_weekview_;
export const Calendar_Weeksview = ExtCalendar_weeksview_;
export const CheckBoxField = ExtCheckboxfield_;
export const CheckboxGroup = ExtCheckboxgroup_;
export const CheckColumn = ExtCheckcolumn_;
export const ComboBoxField = ExtComboboxfield_;
export const ContainerField = ExtContainerfield_;
export const DataView = ExtDataview_;
export const DateColumn = ExtDatecolumn_;
export const DatePanel = ExtDatepanel_;
export const DatePickerField = ExtDatepickerfield_;
export const EmailField = ExtEmailfield_;
export const FieldSet = ExtFieldset_;
export const FileField = ExtFilefield_;
export const FormPanel = ExtFormpanel_;
export const FroalaEditorField = ExtFroalaeditorfield_;
export const LockedGrid = ExtLockedgrid_;
export const MenuCheckItem = ExtMenucheckitem_;
export const MenuItem = ExtMenuitem_;
export const NestedList = ExtNestedlist_;
export const NumberColumn = ExtNumbercolumn_;
export const NumberField = ExtNumberfield_;
export const PasswordField = ExtPasswordfield_;
export const PivotGrid = ExtPivotgrid_;
export const RadioField = ExtRadiofield_;
export const SearchField = ExtSearchfield_;
export const SegmentedButton = ExtSegmentedbutton_;
export const SelectField = ExtSelectfield_;
export const SliderField = ExtSliderfield_;
export const SparkLineLine = ExtSparklineline_;
export const SpinnerField = ExtSpinnerfield_;
export const SplitButton = ExtSplitbutton_;
export const TabBar = ExtTabbar_;
export const TabPanel = ExtTabpanel_;
export const TextAreaField = ExtTextareafield_;
export const TextColumn = ExtTextcolumn_;
export const TreeColumn = ExtTreecolumn_;
export const TextField = ExtTextfield_;
export const TimeField = ExtTimefield_;
export const TimePanel = ExtTimepanel_;
export const TitleBar = ExtTitlebar_;
export const ToggleField = ExtTogglefield_;
export const ToolBar = ExtToolbar_;
export const ToolTip = ExtTooltip_;
export const TreeList = ExtTreelist_;
export const UrlField = ExtUrlfield_;
export const WidgetCell = ExtWidgetcell_;
export const URLField = ExtUrlfield_;
export var ExtD3Canvas = ExtD3_canvas_;
export var ExtD3HeatMap = ExtD3_heatmap_;
export var ExtD3Pack = ExtD3_pack_;
export var ExtD3Partition = ExtD3_partition_;
export var ExtD3Sunburst = ExtD3_sunburst_;
export var ExtD3Tree = ExtD3_tree_;
export var ExtD3HorizontalTree = ExtD3_horizontal_tree_;
export var ExtD3TreeMap = ExtD3_treemap_;
export var ExtD3Svg = ExtD3_svg_;
export var ExtPivotD3Container = ExtPivotd3container_;
export var ExtPivotHeatMap = ExtPivotheatmap_;
export const ExtCalendarEvent = ExtCalendar_event_;
export const ExtCalendarFormAdd = ExtCalendar_form_add_;
export const ExtCalendarCalendarPicker = ExtCalendar_calendar_picker_;
export const ExtCalendarFormEdit = ExtCalendar_form_edit_;
export const ExtCalendarTimeField = ExtCalendar_timefield_;
export const ExtCalendarDaysHeader = ExtCalendar_daysheader_;
export const ExtCalendarWeeksHeader = ExtCalendar_weeksheader_;
export const ExtCalendarList = ExtCalendar_list_;
export const ExtCalendarDay = ExtCalendar_day_;
export const ExtCalendarDays = ExtCalendar_days_;
export const ExtCalendarMonth = ExtCalendar_month_;
export const ExtCalendarWeek = ExtCalendar_week_;
export const ExtCalendarWeeks = ExtCalendar_weeks_;
export const ExtCalendarDayView = ExtCalendar_dayview_;
export const ExtCalendarDaysView = ExtCalendar_daysview_;
export const ExtCalendarMonthView = ExtCalendar_monthview_;
export const ExtCalendarMultiView = ExtCalendar_multiview_;
export const ExtCalendarWeekView = ExtCalendar_weekview_;
export const ExtCalendarWeeksView = ExtCalendar_weeksview_;
//export { launch } from "./dist/launch";
`
}
global["webComponentsTemplateFolder"] = `./filetemplates/web-components/`;
global["angularTemplateFolder"] = `./filetemplates/angular/`;
global["reactTemplateFolder"] = `./filetemplates/react/`;
global["webComponentsPackageFolder"];
webComponentsPackageFolder = `${typeFolder}ext-web-components${info.toolkitshown}${info.bundle}/`;
global["angularPackageFolder"];
angularPackageFolder = `${typeFolder}ext-angular${info.toolkitshown}${info.bundle}/`;
global["reactPackageFolder"];
reactPackageFolder = `${typeFolder}ext-react${info.toolkitshown}${info.bundle}/`;
global["docPackageFolder"];
docPackageFolder = `${typeFolder}doc${info.toolkitshown}${info.bundle}/`;
global["docFolder"];
global["docStagingFolder"];
}