-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathconfig.js
721 lines (715 loc) · 24.9 KB
/
config.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
#! /usr/bin/env node
/**
Copyright (c) 2015, 2024, Oracle and/or its affiliates.
Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
*/
'use strict';
/**
* # Config
*
* @public
* @global
*/
const helpTitlePartLength = 42;
const helpSpace = ' ';
const helpDescNewLineIndent = helpSpace.repeat(helpTitlePartLength + 1);
const newLine = `\n${helpDescNewLineIndent}`;
const config = {
tasks: {
add: {
description: 'Adds platforms, plugins and more to a JET app',
// 'hideFromHelp' not used += v7.2.0, implementation hasn't been removed
// can be used on task and scope level, example below:
// hideFromHelp: true,
scopes: {
component: {
// hideFromHelp: true,
aliases: ['components', 'comp'],
description: 'Adds the specified component(s) to the app',
parameters: '<component1> [<component2>]',
options: {
'pack-version': {
description: 'Specify the pack version',
parameters: '<pack_version>'
},
secure: {
description: 'Whether to enforce secure HTTPS protocol',
parameters: '[true|false]',
default: 'true'
},
username: {
aliases: ['u'],
description: 'The user\'s registered username'
},
password: {
aliases: ['p'],
description: 'The user\'s registered password'
}
},
examples: ['ojet add component flipcard']
},
pack: {
aliases: ['packs'],
description: 'Adds the specified pack(s) to the app',
parameters: '<pack1> [<pack2>]',
options: {
secure: {
description: 'Whether to enforce secure HTTPS protocol',
parameters: '[true|false]',
default: 'true'
},
username: {
aliases: ['u'],
description: 'The user\'s registered username'
},
password: {
aliases: ['p'],
description: 'The user\'s registered password'
}
},
examples: ['ojet add pack oj-dvt']
},
sass: {
description: 'Adds SASS compilation and watch to the app',
examples: ['ojet add sass']
},
theming: {
description: 'Adds CSS Custom Property supported SASS compilation to the app,' + // eslint-disable-line
newLine + 'which also resolves postcss calc and autoprefixer',
examples: ['ojet add theming']
},
typescript: {
description: 'Adds Typescript compilation to the app',
examples: ['ojet add typescript']
},
docgen: {
description: 'Adds JSDOC compilation to the app to generate API documentation. Works only for VComponents.',
examples: ['ojet add docgen']
},
testing: {
description: 'Adds test environment and templates (Mocha for MVVM and Jest for VDOM) to the app.' + // eslint-disable-line
newLine + 'Run \'npm run test\' for test results.',
examples: ['ojet add testing']
},
pwa: {
description: 'Adds pwa support to the app',
examples: ['ojet add pwa']
},
webpack: {
description: 'Adds webpack support to the app',
examples: ['ojet add webpack']
},
web: {
description: 'Adds a web app target to the web app',
examples: ['ojet add web']
},
},
},
build: {
aliases: ['b'],
description: 'Builds a JET app',
scopes: {
app: {
description: 'Builds a JET app for the specified platform,' + // eslint-disable-line
newLine + 'where [app] is the directory context of the JET app.' + newLine, // eslint-disable-line
parameters: '[android|ios|windows|web] - specifies the build platform' + // eslint-disable-line
newLine + 'The default platform is \'web\'',
isParameterOptional: true,
options: {
release: {
aliases: ['r'],
description: 'Build in release mode',
parameters: '[true|false]',
},
optimize: {
description: 'Specify rjs optimize value',
parameters: '<string>'
},
sass: {
description: 'Enable SASS compilation',
parameters: '[true|false](--no-sass)',
default: 'true'
},
svg: {
description: 'Enable SVG re-compilation for JET Alta Theme',
parameters: '[true|false]',
default: 'false'
},
theme: {
description: 'Specify the theme to be used by the app,' + // eslint-disable-line
newLine + '-> alta themes are platform specific' +
newLine + '-> redwood theme is for all platforms',
parameters: '<theme_name>[:<platform>]' + // eslint-disable-line
newLine + 'where <theme_name> is: alta or <custom_theme_name>' + // eslint-disable-line
newLine + 'and <platform> is one of: android, ios, web, windows',
default: 'redwood for web platform'
},
themes: {
description: 'Specify multiple themes separated by comma(s)' + // eslint-disable-line
newLine + 'When the --theme flag is missing,' +
newLine + 'the first element in the --themes flag is identified as the default theme.'
},
cssvars: {
description: 'Specify to inject css file which supports css custom properties' + // eslint-disable-line
newLine + 'When the --cssvars flag is missing,' +
newLine + 'the default css preprocessor has been used to process away the custom properties.',
parameters: '[enabled|disabled]',
default: 'disabled'
},
'user-options': {
description: 'Specify user-defined options - these are accessible in hooks config object',
parameters: '<string>'
},
},
examples: [
'ojet build',
'ojet build --cssvars=enabled',
'ojet build web --theme=alta:android',
'ojet build --user-options="arbitrary string" // provide user-defined options',
'ojet build --release --optimize=none // Build a release with readable output. Useful for debugging'
]
},
component: {
description: 'Builds an optimized component for the specified component name' + // eslint-disable-line
newLine + 'Use ojet build component component_name to build an optimized component',
parameters: 'component name',
examples: [
'ojet build component demo-card // component build'
]
},
pack: {
description: 'Builds an optimized pack for the specified pack name' + // eslint-disable-line
newLine + 'Use ojet build pack pack_name to build an optimized pack',
parameters: 'pack name',
examples: [
'ojet build pack demo-card-pack // pack build'
]
}
}
},
clean: {
description: 'Cleans build output from a JET app',
scopes: {
app: {
description: 'Cleans build output from a JET app for the specified platform',
parameters: 'android|ios|windows|web',
examples: ['ojet clean android', 'ojet clean ios']
},
},
},
configure: {
description: 'Configures tooling parameters for a JET app',
scopes: {
app: {
description: 'Configures the specified parameter for a JET app',
options: {
'exchange-url': {
description: 'Specify the URL for the Exchange used by the app',
parameters: '<exchange_url>'
},
global: {
description: 'Define a global value to use as a default when an application does not explicitly override it'
}
},
examples: ['ojet configure --exchange-url=myExchange.org', 'ojet configure app --exchange-url=10.1.1.32:8010/v1/basepath/']
},
},
},
create: {
description: 'Creates a new JET app, custom theme, or component',
scopes: {
app: {
description: 'Creates an app with the specified name',
parameters: '<app-name>',
isParameterOptional: true,
default: 'The name of the current directory',
options: {
web: {
description: 'Create a web app (default)'
},
template: {
description: 'Use a pre-defined app template',
parameters: 'blank[-ts]|basic[-ts|-vdom][:web]|navbar[-ts][:web]|' + // eslint-disable-line
newLine + ' navdrawer[-ts][:web]|<URL_to_zip_file>'
},
typescript: {
description: 'Create a typescript-based app',
},
pwa: {
description: 'Create a pwa-supported app',
},
webpack: {
description: 'Create a webpack-supported app',
},
'use-global-tooling': {
description: 'Use the globally-installed tooling library installed with ojet-cli'
}
},
examples: [
'ojet create myWebApp --template=navbar',
'ojet create myWebApp --template=navbar --typescript',
'ojet create myWebApp --template=navbar --pwa',
'ojet create FixItFast --template=http://www.oracle.com/webfolder/technetwork/jet/public_samples/FixItFast.zip'
]
},
component: {
options: {
/*
type: {
description: 'Specifies the type of component to create',
parameters: 'vcomponent'
},
vcomponent: {
description: 'Creates a vcomponent.'
},*/
pack: {
description: 'Specifies the pack to create the component into',
parameters: '<pack_name>'
}
},
description: 'Creates a component with the specified name within an existing app',
parameters: '<component-name>',
examples: [
'ojet create component demo-card',
// 'ojet create component demo-card --type=vcomponent',
// 'ojet create component demo-card --vcomponent',
'ojet create component demo-card --pack=demo-pack'
]
},
pack: {
aliases: ['packs'],
description: 'Creates a pack with the specified name in an existing app',
parameters: '<pack-name>',
examples: ['ojet create pack demo-pack']
},
theme: {
aliases: ['themes'],
description: 'Creates a custom theme with the specified name',
parameters: '<theme-name>',
examples: ['ojet create theme xyz --basetheme=stable | redwood']
}
},
},
help: {
description: 'Displays command line help',
commands: '[add|build|clean|configure|create|list|remove|restore|serve|strip|label]'
},
list: {
aliases: ['ls'],
description: 'Lists platforms, plugins and more within a JET app',
scopes: {
component: {
aliases: ['components', 'comp'],
description: 'Lists all installed components',
examples: ['ojet list component']
},
pack: {
aliases: ['packs'],
description: 'Lists all installed packs',
examples: ['ojet list packs']
},
platform: {
aliases: ['platforms'],
description: 'Lists all installed platforms',
examples: ['ojet list platform']
},
plugin: {
aliases: ['plugins'],
description: 'Lists all installed plugins',
examples: ['ojet list plugins']
}
}
},
label: {
aliases: ['lb'],
description: 'Adds a label to an existing component or pack in Exchange',
scopes: {
component: {
aliases: ['components', 'comp'],
description: 'Labels a component in exchange.',
examples: ['ojet label component my-component@1.2.0 rel2304'],
options: {
secure: {
description: 'Whether to enforce secure HTTPS protocol',
parameters: '[true|false]',
default: 'true'
},
username: {
aliases: ['u'],
description: 'The user\'s registered username'
},
password: {
aliases: ['p'],
description: 'The user\'s registered password'
}
},
},
pack: {
aliases: ['packs'],
description: 'Labels a pack and its components in component Exchange.',
examples: ['ojet label pack foo-bar@2304.0.0-rc.1 snapshot'],
options: {
secure: {
description: 'Whether to enforce secure HTTPS protocol',
parameters: '[true|false]',
default: 'true'
},
username: {
aliases: ['u'],
description: 'The user\'s registered username'
},
password: {
aliases: ['p'],
description: 'The user\'s registered password'
}
},
}
}
},
package: {
description: 'Prepares archive of a component or a pack',
scopes: {
component: {
description: 'Prepares archive of a component',
parameters: '<component>',
options: {
pack: {
description: 'Specify the pack name',
parameters: '<pack_name>'
}
},
examples: [
'ojet package component demo-card',
'ojet package component flip-card --pack=demo-pack',
]
},
pack: {
description: 'Prepares archives of a pack and its components',
parameters: '<pack>',
examples: ['ojet package pack demo-pack']
}
}
},
publish: {
description: 'Publishes components to the Exchange',
scopes: {
component: {
description: 'Publishes the specified component to the Exchange' + // eslint-disable-line
newLine + 'This is the default scope',
parameters: '<component>',
options: {
username: {
aliases: ['u'],
description: 'The user\'s registered username'
},
password: {
aliases: ['p'],
description: 'The user\'s registered password'
},
pack: {
description: 'Specify the pack name',
parameters: '<pack_name>'
},
path: {
description: 'Specify the path to component archive',
parameters: '<path>'
},
release: {
aliases: ['r'],
description: 'Whether to publish the specified component with a release build'
},
secure: {
description: 'Whether to enforce secure HTTPS protocol',
parameters: '[true|false]',
default: 'true'
}
},
examples: [
'ojet publish component flipcard',
'ojet publish component --path="./dist/demo-card.zip"',
'ojet publish --path="./dist/flip-card.zip"',
'ojet publish --path="/Users/john/my-project/built/demo-card.zip"'
]
},
pack: {
description: 'Publishes the specified pack to the Exchange',
aliases: ['packs'],
parameters: '<pack>',
options: {
username: {
aliases: ['u'],
description: 'The user\'s registered username'
},
password: {
aliases: ['p'],
description: 'The user\'s registered password'
},
secure: {
description: 'Whether to enforce secure HTTPS protocol',
parameters: '[true|false]',
default: 'true'
}
},
examples: [
'ojet publish pack oj-dvt'
]
}
}
},
remove: {
description: 'Removes platforms, plugins and more from a JET app',
aliases: ['rm'],
scopes: {
component: {
description: 'Removes the specified component(s) from the app',
aliases: ['components', 'comp'],
parameters: '<component1> [<component2>]',
examples: ['ojet remove components flipcard dv-gantt']
},
pack: {
aliases: ['packs'],
description: 'Removes the specified pack(s) from the app',
parameters: '<pack1> [<pack2>]',
examples: ['ojet remove pack oj-core']
},
platform: {
description: 'Removes the specified platform(s) from the app',
aliases: ['platforms'],
parameters: '<platform1> [<platform2>]',
examples: ['ojet remove platforms ios android']
},
plugin: {
description: 'Removes the specified plugin(s) from the app',
aliases: ['plugins'],
parameters: '<plugin1> [<plugin2>]',
examples: ['ojet remove plugin cordova-plugin-camera']
}
},
},
restore: {
description: 'Restores missing dependencies, plugins, and libraries to a JET app',
scopes: {
app: {
description: 'Restores missing dependencies, plugins, and libraries to a JET app',
options: {
secure: {
description: 'Whether to enforce secure HTTPS protocol',
parameters: '[true|false]',
default: 'true'
},
username: {
aliases: ['u'],
description: 'The user\'s registered username'
},
password: {
aliases: ['p'],
description: 'The user\'s registered password'
},
ci: {
description: 'Use npm ci instead of npm install',
default: 'false'
},
'exchange-only': {
description: 'Restore the exchange components without running npm install',
parameters: '[true|false]',
default: 'true'
}
},
examples: [
'ojet restore',
'ojet restore app'
]
}
}
},
search: {
description: 'Searches for a component in the Exchange based on the specified keyword',
scopes: {
exchange: {
description: 'Searches for a component in the Exchange based on the specified keyword',
parameters: '<keyword>',
options: {
secure: {
description: 'Whether to enforce secure HTTPS protocol',
parameters: '[true|false]',
default: 'true'
},
username: {
aliases: ['u'],
description: 'The user\'s registered username'
},
password: {
aliases: ['p'],
description: 'The user\'s registered password'
},
versions: {
description: 'Lists all available versions'
}
},
examples: [
'ojet search exchange flip-card',
'ojet search exchange flip-card dv-gantt'
]
}
},
},
serve: {
aliases: ['s'],
description: 'Serves a JET app to the browser',
scopes: {
app: {
description: 'Serves a JET app for the specified platform',
parameters: '[android|ios|windows|web]',
isParameterOptional: true,
options: {
release: {
aliases: ['r'],
description: 'Serve in release mode',
parameters: '[true|false]',
},
optimize: {
description: 'Specify rjs optimize value',
parameters: '<string>'
},
build: {
description: 'Build the app before serving it',
parameters: '[true|false](--no-build)',
default: 'true'
},
sass: {
description: 'Enable SASS compilation and SASS watch ',
parameters: '[true|false](--no-sass)',
default: 'true'
},
'server-port': {
description: 'Specify the server port',
parameters: '<integer>',
default: '8000'
},
svg: {
description: 'Enable SVG re-compilation for JET Alta Theme',
parameters: '[true|false]',
default: 'false'
},
theme: {
description: 'Specify the theme to be used by the app,' + // eslint-disable-line
newLine + '-> alta themes are platform specific' +
newLine + '-> redwood theme is for all platforms',
parameters: '<theme_name>[:<platform>]' + // eslint-disable-line
newLine + 'where <theme_name> is: alta or <custom_theme_name>' + // eslint-disable-line
newLine + 'and <platform> is one of: android, ios, web, windows',
default: 'redwood for web platform'
},
themes: {
description: 'Specify multiple themes separated by comma.' + // eslint-disable-line
newLine + 'When the --theme flag is missing,' +
newLine + 'the first element in the --themes flag is identified as the default theme'
},
cssvars: {
description: 'Specify to inject css file which supports css custom properties' + // eslint-disable-line
newLine + 'When the --cssvars flag is missing,' +
newLine + 'the default will be a css without css custom properties',
parameters: '[enabled|disabled]',
default: 'disabled'
},
livereload: {
description: 'Enable live reload',
parameters: '[true|false](--no-livereload)',
default: 'true'
},
'watch-files': {
description: 'Enable watch file',
parameters: '[true|false](--no-watch-files)',
default: 'true'
},
'livereload-port': {
description: 'Specify the live reload port',
parameters: '<integer>',
default: '35729'
},
'server-only': {
description: 'Start server without opening browser'
},
'server-url': {
description: 'Specify the server to serve from',
parameters: '<string>'
},
'user-options': {
description: 'Specify user-defined options - these are accessible in hooks config object',
parameters: '<string>'
}
},
examples: [
'ojet serve',
'ojet serve --cssvars=enabled',
'ojet serve --browser=edge',
'ojet serve web --theme alta:android',
'ojet serve --user-options="arbitrary string" // provide user-defined options.'
]
}
}
},
strip: {
description: 'Strips all non source files from a JET app',
scopes: {
app: {
description: 'Strips all non source files from a JET app',
examples: ['ojet strip', 'ojet strip app']
},
},
}
},
globalOptions: {
global: {
aliases: ['g'],
description: 'Global setting'
},
help: {
aliases: ['h'],
description: 'Print help for the command'
},
installer: {
description: 'Specify an alternate package installer such as yarn'
},
verbose: {
description: 'Print details'
},
version: {
aliases: ['v'],
description: 'Print CLI version'
}
},
// Disabling line, can not use arrow function because it changes 'this' scope
addNamesToTaskAndScopes: function() { // eslint-disable-line
const tasks = this.tasks;
Object.keys(tasks).forEach((task) => {
tasks[task].name = task;
const scopes = tasks[task].scopes;
if (scopes) {
Object.keys(scopes).forEach((scope) => {
scopes[scope].name = scope;
});
}
});
},
env: {
test: 'test'
},
exchangeUrlParam: 'exchange-url',
components: {
dir: './src/js/jet-composites/'
},
configFile: './oraclejetconfig.json',
output: {
helpTitlePartLength,
helpDescNewLineIndent,
indent: 4,
dot: '.',
space: helpSpace
},
localStoreDir: '.ojet'
};
// Add 'name' property to all the tasks
config.addNamesToTaskAndScopes();
module.exports = config;