@nstudio/xplat 13.0.1 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/migrations/update-10-2-0/update-10-2-0.js +2 -2
- package/migrations/update-11-0-0/clean-old-dirs.js +2 -2
- package/migrations/update-11-0-0/update-11-0-0.js +45 -45
- package/migrations/update-11-0-0/update-to-11-env-base.js +22 -22
- package/migrations/update-11-0-0/update-to-11-imports.js +5 -5
- package/migrations/update-12-4-3/update-12-4-3.js +19 -19
- package/migrations/update-13-0-0/update-13-0-0.js +18 -18
- package/package.json +3 -3
- package/src/schematics/app-generate/index.js +3 -3
- package/src/schematics/application/index.js +1 -1
- package/src/schematics/application/index.spec.js +13 -13
- package/src/schematics/component/index.js +1 -1
- package/src/schematics/component/index.spec.js +22 -22
- package/src/schematics/feature/index.js +3 -3
- package/src/schematics/feature/index.spec.js +37 -37
- package/src/schematics/helpers/index.js +7 -7
- package/src/schematics/helpers/index.spec.js +4 -4
- package/src/schematics/init/index.js +13 -13
- package/src/schematics/init/index.spec.js +8 -8
- package/src/schematics/mode/index.js +3 -3
- package/src/schematics/ng-add/index.js +3 -3
- package/src/utils/ast.js +1 -1
- package/src/utils/general.js +10 -10
- package/src/utils/helpers.js +1 -1
- package/src/utils/postinstall.js +3 -3
- package/src/utils/testing-utils.js +2 -2
- package/src/utils/testing.js +2 -2
- package/src/utils/versions.js +1 -1
- package/src/utils/xplat.js +65 -65
package/src/utils/xplat.js
CHANGED
@@ -43,14 +43,14 @@ var XplatHelpers;
|
|
43
43
|
*/
|
44
44
|
function addPackageWithNgAdd(packageName, options, callSchematicIfAdded) {
|
45
45
|
return (host) => {
|
46
|
-
const { dependencies, devDependencies } = workspace_1.readJsonInTree(host, 'package.json');
|
46
|
+
const { dependencies, devDependencies } = (0, workspace_1.readJsonInTree)(host, 'package.json');
|
47
47
|
return dependencies[packageName] || devDependencies[packageName]
|
48
48
|
? callSchematicIfAdded
|
49
|
-
? schematics_1.externalSchematic(packageName, callSchematicIfAdded, options, {
|
49
|
+
? (0, schematics_1.externalSchematic)(packageName, callSchematicIfAdded, options, {
|
50
50
|
interactive: false,
|
51
51
|
})
|
52
|
-
: schematics_1.noop()
|
53
|
-
: schematics_1.externalSchematic(packageName, 'ng-add', options, {
|
52
|
+
: (0, schematics_1.noop)()
|
53
|
+
: (0, schematics_1.externalSchematic)(packageName, 'ng-add', options, {
|
54
54
|
interactive: false,
|
55
55
|
});
|
56
56
|
};
|
@@ -65,10 +65,10 @@ var XplatHelpers;
|
|
65
65
|
}
|
66
66
|
}
|
67
67
|
else {
|
68
|
-
const platformArgList = xplat_utils_1.sanitizeCommaDelimitedArg(platformArgument);
|
68
|
+
const platformArgList = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(platformArgument);
|
69
69
|
if (platformArgList.length === 0) {
|
70
70
|
if (required) {
|
71
|
-
throw new Error(errors_1.noPlatformError());
|
71
|
+
throw new Error((0, errors_1.noPlatformError)());
|
72
72
|
}
|
73
73
|
}
|
74
74
|
else {
|
@@ -77,7 +77,7 @@ var XplatHelpers;
|
|
77
77
|
platforms.push(platform);
|
78
78
|
}
|
79
79
|
else {
|
80
|
-
throw new Error(errors_1.unsupportedPlatformError(platform));
|
80
|
+
throw new Error((0, errors_1.unsupportedPlatformError)(platform));
|
81
81
|
}
|
82
82
|
}
|
83
83
|
}
|
@@ -91,7 +91,7 @@ var XplatHelpers;
|
|
91
91
|
// always default framework choice to first in list when multiple
|
92
92
|
return ((frameworkArgument === 'all'
|
93
93
|
? xplat_utils_1.supportedFrameworks
|
94
|
-
: xplat_utils_1.sanitizeCommaDelimitedArg(frameworkArgument)));
|
94
|
+
: (0, xplat_utils_1.sanitizeCommaDelimitedArg)(frameworkArgument)));
|
95
95
|
}
|
96
96
|
XplatHelpers.getFrameworksFromOptions = getFrameworksFromOptions;
|
97
97
|
function getFrameworkChoice(frameworkArgument, frameworks) {
|
@@ -103,7 +103,7 @@ var XplatHelpers;
|
|
103
103
|
const frameworks = getFrameworksFromOptions(options.framework);
|
104
104
|
const frameworkChoice = XplatHelpers.getFrameworkChoice(options.framework, frameworks);
|
105
105
|
const xplatSettings = {
|
106
|
-
prefix: xplat_utils_1.getPrefix(),
|
106
|
+
prefix: (0, xplat_utils_1.getPrefix)(),
|
107
107
|
};
|
108
108
|
if (frameworkChoice && frameworks.length === 1) {
|
109
109
|
// when only 1 framework is specified, auto add as default
|
@@ -123,8 +123,8 @@ var XplatHelpers;
|
|
123
123
|
* @param platform
|
124
124
|
*/
|
125
125
|
function getPlatformName(name, platform) {
|
126
|
-
const nameSanitized =
|
127
|
-
return xplat_utils_1.getGroupByName()
|
126
|
+
const nameSanitized = (0, xplat_utils_1.toFileName)(name);
|
127
|
+
return (0, xplat_utils_1.getGroupByName)()
|
128
128
|
? `${nameSanitized}-${platform}`
|
129
129
|
: `${platform}-${nameSanitized}`;
|
130
130
|
}
|
@@ -137,7 +137,7 @@ var XplatHelpers;
|
|
137
137
|
* @param framework
|
138
138
|
*/
|
139
139
|
function getXplatFoldername(platform, framework) {
|
140
|
-
const frontendFramework = xplat_utils_1.getFrontendFramework();
|
140
|
+
const frontendFramework = (0, xplat_utils_1.getFrontendFramework)();
|
141
141
|
// console.log('getXplatFoldername frontendFramework:', frontendFramework);
|
142
142
|
// console.log('framework:', framework);
|
143
143
|
let frameworkSuffix = '';
|
@@ -163,7 +163,7 @@ var XplatHelpers;
|
|
163
163
|
default:
|
164
164
|
isApp = ['application', 'app'].includes(generator);
|
165
165
|
generatorSettings = {
|
166
|
-
platforms: xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms),
|
166
|
+
platforms: (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms),
|
167
167
|
};
|
168
168
|
break;
|
169
169
|
}
|
@@ -212,7 +212,7 @@ var XplatHelpers;
|
|
212
212
|
}
|
213
213
|
}
|
214
214
|
else {
|
215
|
-
throw new schematics_1.SchematicsException(errors_1.unsupportedFrameworkError(framework));
|
215
|
+
throw new schematics_1.SchematicsException((0, errors_1.unsupportedFrameworkError)(framework));
|
216
216
|
}
|
217
217
|
}
|
218
218
|
}
|
@@ -233,7 +233,7 @@ var XplatHelpers;
|
|
233
233
|
packagesToRunXplat.push(packageName);
|
234
234
|
}
|
235
235
|
else {
|
236
|
-
throw new schematics_1.SchematicsException(errors_1.unsupportedPlatformError(platform));
|
236
|
+
throw new schematics_1.SchematicsException((0, errors_1.unsupportedPlatformError)(platform));
|
237
237
|
}
|
238
238
|
}
|
239
239
|
}
|
@@ -241,7 +241,7 @@ var XplatHelpers;
|
|
241
241
|
externalChains.push((tree, context) => {
|
242
242
|
// check if othet nstudio or nrwl dependencies are needed
|
243
243
|
// check user's package for current version
|
244
|
-
const packageJson = xplat_utils_1.getJsonFromFile(tree, 'package.json');
|
244
|
+
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json');
|
245
245
|
if (packageJson) {
|
246
246
|
for (const packageName in devDependencies) {
|
247
247
|
if (exports.packageInnerDependencies[packageName]) {
|
@@ -280,7 +280,7 @@ var XplatHelpers;
|
|
280
280
|
// console.log('packagesToRunXplat:', packagesToRunXplat)
|
281
281
|
if (packagesToRunXplat.length) {
|
282
282
|
for (const packageName of packagesToRunXplat) {
|
283
|
-
externalChains.push(schematics_1.externalSchematic(packageName, generator, options, {
|
283
|
+
externalChains.push((0, schematics_1.externalSchematic)(packageName, generator, options, {
|
284
284
|
interactive: false,
|
285
285
|
}));
|
286
286
|
}
|
@@ -302,7 +302,7 @@ var XplatHelpers;
|
|
302
302
|
XplatHelpers.getExternalChainsForGenerator = getExternalChainsForGenerator;
|
303
303
|
function getExternalChainsForApplication(options, generator, packagesToRun) {
|
304
304
|
let generatorSettings = {
|
305
|
-
platforms: xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms),
|
305
|
+
platforms: (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms),
|
306
306
|
};
|
307
307
|
const platforms = generatorSettings.platforms;
|
308
308
|
const externalChains = [];
|
@@ -322,7 +322,7 @@ var XplatHelpers;
|
|
322
322
|
packagesToRun.push(packageName);
|
323
323
|
}
|
324
324
|
else {
|
325
|
-
throw new schematics_1.SchematicsException(errors_1.unsupportedPlatformError(platform));
|
325
|
+
throw new schematics_1.SchematicsException((0, errors_1.unsupportedPlatformError)(platform));
|
326
326
|
}
|
327
327
|
}
|
328
328
|
}
|
@@ -330,7 +330,7 @@ var XplatHelpers;
|
|
330
330
|
externalChains.push((tree, context) => {
|
331
331
|
// check if othet nstudio or nrwl dependencies are needed
|
332
332
|
// check user's package for current version
|
333
|
-
const packageJson = xplat_utils_1.getJsonFromFile(tree, 'package.json');
|
333
|
+
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json');
|
334
334
|
if (packageJson) {
|
335
335
|
for (const packageName in devDependencies) {
|
336
336
|
if (exports.packageInnerDependencies[packageName]) {
|
@@ -368,7 +368,7 @@ var XplatHelpers;
|
|
368
368
|
if (options.isTesting) {
|
369
369
|
// necessary to unit test the appropriately
|
370
370
|
if (xplatPlatforms) {
|
371
|
-
externalChains.push(schematics_1.externalSchematic('@nstudio/xplat', 'app-generate', options, {
|
371
|
+
externalChains.push((0, schematics_1.externalSchematic)('@nstudio/xplat', 'app-generate', options, {
|
372
372
|
interactive: false,
|
373
373
|
}));
|
374
374
|
}
|
@@ -378,9 +378,9 @@ var XplatHelpers;
|
|
378
378
|
const { name, directory } = getAppNamingConvention(options, nxPlatform);
|
379
379
|
output_1.output.log({
|
380
380
|
title: 'Note:',
|
381
|
-
bodyLines: [errors_1.noXplatLayerNote(nxPlatform)],
|
381
|
+
bodyLines: [(0, errors_1.noXplatLayerNote)(nxPlatform)],
|
382
382
|
});
|
383
|
-
externalChains.push(schematics_1.externalSchematic(packageName, generator, Object.assign(Object.assign({}, options), { name,
|
383
|
+
externalChains.push((0, schematics_1.externalSchematic)(packageName, generator, Object.assign(Object.assign({}, options), { name,
|
384
384
|
directory }), {
|
385
385
|
interactive: false,
|
386
386
|
}));
|
@@ -389,7 +389,7 @@ var XplatHelpers;
|
|
389
389
|
}
|
390
390
|
else {
|
391
391
|
if (xplatPlatforms) {
|
392
|
-
externalChains.push(schematics_1.externalSchematic('@nstudio/xplat', 'app-generate', options, {
|
392
|
+
externalChains.push((0, schematics_1.externalSchematic)('@nstudio/xplat', 'app-generate', options, {
|
393
393
|
interactive: true,
|
394
394
|
}));
|
395
395
|
}
|
@@ -403,7 +403,7 @@ var XplatHelpers;
|
|
403
403
|
const { name, directory } = getAppNamingConvention(options, nxPlatform);
|
404
404
|
output_1.output.log({
|
405
405
|
title: 'Note:',
|
406
|
-
bodyLines: [errors_1.noXplatLayerNote(nxPlatform)],
|
406
|
+
bodyLines: [(0, errors_1.noXplatLayerNote)(nxPlatform)],
|
407
407
|
});
|
408
408
|
context.addTask(new tasks_1.RunSchematicTask(packageName, generator, Object.assign(Object.assign({}, options), { name,
|
409
409
|
directory })), [installPackageTask]);
|
@@ -421,7 +421,7 @@ var XplatHelpers;
|
|
421
421
|
options.directory = directory;
|
422
422
|
// console.log('applyAppNamingConvention:', options);
|
423
423
|
// adjusted name, nothing else to do
|
424
|
-
return schematics_1.noop()(tree, context);
|
424
|
+
return (0, schematics_1.noop)()(tree, context);
|
425
425
|
};
|
426
426
|
}
|
427
427
|
XplatHelpers.applyAppNamingConvention = applyAppNamingConvention;
|
@@ -429,10 +429,10 @@ var XplatHelpers;
|
|
429
429
|
let name = '';
|
430
430
|
let directory = '';
|
431
431
|
if (options.directory) {
|
432
|
-
directory =
|
432
|
+
directory = (0, xplat_utils_1.toFileName)(options.directory);
|
433
433
|
if (directory === platform &&
|
434
434
|
xplat_utils_1.supportedPlatformsWithNx.includes(directory)) {
|
435
|
-
name =
|
435
|
+
name = (0, xplat_utils_1.toFileName)(options.name);
|
436
436
|
}
|
437
437
|
else {
|
438
438
|
name = getPlatformName(options.name, platform);
|
@@ -449,12 +449,12 @@ var XplatHelpers;
|
|
449
449
|
XplatHelpers.getAppNamingConvention = getAppNamingConvention;
|
450
450
|
function generateLib(options, libName, directory = '', testEnvironment = 'jsdom', framework = 'angular') {
|
451
451
|
return (tree, context) => {
|
452
|
-
if (!xplat_utils_1.getFrontendFramework() && framework) {
|
452
|
+
if (!(0, xplat_utils_1.getFrontendFramework)() && framework) {
|
453
453
|
directory = `${directory}-${framework}`;
|
454
454
|
}
|
455
455
|
if (tree.exists(`libs/${directory ? directory + '/' : ''}${libName}/tsconfig.json`)) {
|
456
456
|
// console.log(`externalSchematic('@nrwl/workspace', 'lib') ALREADY EXISTS for:`, `libs/${directory ? directory + '/' : ''}${libName}`)
|
457
|
-
return schematics_1.noop()(tree, context);
|
457
|
+
return (0, schematics_1.noop)()(tree, context);
|
458
458
|
}
|
459
459
|
const libOptions = {
|
460
460
|
name: libName,
|
@@ -466,13 +466,13 @@ var XplatHelpers;
|
|
466
466
|
libOptions.skipTsConfig = true;
|
467
467
|
}
|
468
468
|
// console.log(`CALLING externalSchematic('@nrwl/workspace', 'lib') for:`, `libs/${directory ? directory + '/' : ''}${libName}`)
|
469
|
-
return schematics_1.chain([schematics_1.externalSchematic('@nrwl/workspace', 'lib', libOptions)]);
|
469
|
+
return (0, schematics_1.chain)([(0, schematics_1.externalSchematic)('@nrwl/workspace', 'lib', libOptions)]);
|
470
470
|
};
|
471
471
|
}
|
472
472
|
XplatHelpers.generateLib = generateLib;
|
473
473
|
function cleanupLib(options, libName, directory = '', framework = 'angular') {
|
474
474
|
return (tree, context) => {
|
475
|
-
if (!xplat_utils_1.getFrontendFramework() && framework) {
|
475
|
+
if (!(0, xplat_utils_1.getFrontendFramework)() && framework) {
|
476
476
|
directory = `${directory}-${framework}`;
|
477
477
|
}
|
478
478
|
// adjust index files
|
@@ -520,7 +520,7 @@ var XplatHelpers;
|
|
520
520
|
}
|
521
521
|
}
|
522
522
|
if (needsTsConfigUpdate && tsConfig) {
|
523
|
-
xplat_utils_1.updateJsonFile(tree, tsConfigPath, tsConfig);
|
523
|
+
(0, xplat_utils_1.updateJsonFile)(tree, tsConfigPath, tsConfig);
|
524
524
|
}
|
525
525
|
return tree;
|
526
526
|
};
|
@@ -528,10 +528,10 @@ var XplatHelpers;
|
|
528
528
|
XplatHelpers.cleanupLib = cleanupLib;
|
529
529
|
function addPlatformFiles(options, platform, libName, checkExistingFile) {
|
530
530
|
return (tree, context) => {
|
531
|
-
let frontendFramework = xplat_utils_1.getFrontendFramework();
|
531
|
+
let frontendFramework = (0, xplat_utils_1.getFrontendFramework)();
|
532
532
|
if (tree.exists(`libs/xplat/${platform}/${libName}/src/lib/index.ts`)) {
|
533
533
|
// check if framework had been set
|
534
|
-
frontendFramework = xplat_utils_1.getFrontendFramework();
|
534
|
+
frontendFramework = (0, xplat_utils_1.getFrontendFramework)();
|
535
535
|
// console.log('addPlatformFiles frontendFramework:', frontendFramework)
|
536
536
|
// console.log('addPlatformFiles options.framework:', options.framework)
|
537
537
|
if (frontendFramework && !options.framework) {
|
@@ -540,22 +540,22 @@ var XplatHelpers;
|
|
540
540
|
// ie: vanilla {N}, vanilla web, vanilla ionic, etc. (without angular, react, vue, etc.)
|
541
541
|
// if user had set a default framework and is now attempting to generate base platform support
|
542
542
|
// TODO: add schematic to reconfigure workspace to rename xplat folders to support full multi-framework setup
|
543
|
-
throw new schematics_1.SchematicsException(errors_1.noteAboutXplatSetupWithFramework(frontendFramework, platform));
|
543
|
+
throw new schematics_1.SchematicsException((0, errors_1.noteAboutXplatSetupWithFramework)(frontendFramework, platform));
|
544
544
|
}
|
545
545
|
// already added
|
546
|
-
return schematics_1.noop();
|
546
|
+
return (0, schematics_1.noop)();
|
547
547
|
}
|
548
548
|
const xplatFolderName = XplatHelpers.getXplatFoldername(platform, options.framework);
|
549
549
|
// src should go into Nx library structure
|
550
550
|
const libFolder = `/${libName}/src${libName === 'scss' ? '' : '/lib'}`;
|
551
551
|
if (checkExistingFile &&
|
552
552
|
tree.exists(`libs/xplat/${xplatFolderName}/${libFolder}/${checkExistingFile}`)) {
|
553
|
-
return schematics_1.noop();
|
553
|
+
return (0, schematics_1.noop)();
|
554
554
|
}
|
555
555
|
else {
|
556
|
-
return schematics_1.branchAndMerge(schematics_1.mergeWith(schematics_1.apply(schematics_1.url(`./_files_${libName}`), [
|
557
|
-
schematics_1.template(Object.assign(Object.assign(Object.assign({}, options), general_1.getDefaultTemplateOptions()), { xplatFolderName })),
|
558
|
-
schematics_1.move(`libs/xplat/${xplatFolderName}${libFolder}`),
|
556
|
+
return (0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./_files_${libName}`), [
|
557
|
+
(0, schematics_1.template)(Object.assign(Object.assign(Object.assign({}, options), (0, general_1.getDefaultTemplateOptions)()), { xplatFolderName })),
|
558
|
+
(0, schematics_1.move)(`libs/xplat/${xplatFolderName}${libFolder}`),
|
559
559
|
])));
|
560
560
|
}
|
561
561
|
};
|
@@ -564,7 +564,7 @@ var XplatHelpers;
|
|
564
564
|
function updatePackageForXplat(options, updates) {
|
565
565
|
return (tree, context) => {
|
566
566
|
const packagePath = 'package.json';
|
567
|
-
let packageJson = xplat_utils_1.getJsonFromFile(tree, packagePath);
|
567
|
+
let packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
|
568
568
|
if (packageJson) {
|
569
569
|
// could introduce xplat.json but trying to avoid too much extra overhead so just store in package.json for now
|
570
570
|
// can migrate this later if decide enough settings for xplat.json
|
@@ -574,13 +574,13 @@ var XplatHelpers;
|
|
574
574
|
// just updating xplat internal settings
|
575
575
|
packageJson.xplat = Object.assign(Object.assign({}, (packageJson.xplat || {})), xplatSettings);
|
576
576
|
// just update xplat workspace settings
|
577
|
-
return xplat_utils_1.updateJsonFile(tree, packagePath, packageJson);
|
577
|
+
return (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
|
578
578
|
}
|
579
579
|
else if (updates) {
|
580
580
|
// update root dependencies for the generated xplat support
|
581
581
|
packageJson = Object.assign(Object.assign({}, packageJson), { dependencies: Object.assign(Object.assign({}, (packageJson.dependencies || {})), (updates.dependencies || {})), devDependencies: Object.assign(Object.assign({}, (packageJson.devDependencies || {})), (updates.devDependencies || {})), xplat: Object.assign(Object.assign({}, (packageJson.xplat || {})), xplatSettings) });
|
582
582
|
// console.log('updatePackageForXplat:', serializeJson(packageJson));
|
583
|
-
return xplat_utils_1.updateJsonFile(tree, packagePath, packageJson);
|
583
|
+
return (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
|
584
584
|
}
|
585
585
|
}
|
586
586
|
return tree;
|
@@ -613,7 +613,7 @@ var XplatComponentHelpers;
|
|
613
613
|
(function (XplatComponentHelpers) {
|
614
614
|
function prepare(options) {
|
615
615
|
if (!options.name) {
|
616
|
-
throw new Error(errors_1.generateOptionError('component'));
|
616
|
+
throw new Error((0, errors_1.generateOptionError)('component'));
|
617
617
|
}
|
618
618
|
// reset module globals
|
619
619
|
options.needsIndex = false;
|
@@ -639,9 +639,9 @@ var XplatComponentHelpers;
|
|
639
639
|
featureName = 'shared';
|
640
640
|
}
|
641
641
|
// building feature in shared code and in projects
|
642
|
-
projectNames = xplat_utils_1.sanitizeCommaDelimitedArg(projects);
|
642
|
+
projectNames = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(projects);
|
643
643
|
for (const fullProjectPath of projectNames) {
|
644
|
-
const projectName = xplat_utils_1.parseProjectNameFromPath(fullProjectPath);
|
644
|
+
const projectName = (0, xplat_utils_1.parseProjectNameFromPath)(fullProjectPath);
|
645
645
|
const projectParts = projectName.split('-');
|
646
646
|
const platPrefix = projectParts[0];
|
647
647
|
const platSuffix = projectParts.pop();
|
@@ -661,13 +661,13 @@ var XplatComponentHelpers;
|
|
661
661
|
featureName = 'ui';
|
662
662
|
}
|
663
663
|
// building feature in shared code only
|
664
|
-
platforms = xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms);
|
664
|
+
platforms = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms);
|
665
665
|
}
|
666
666
|
if (platforms.length === 0) {
|
667
667
|
let error = projects
|
668
|
-
? errors_1.platformAppPrefixError()
|
669
|
-
: errors_1.generatorError('component');
|
670
|
-
throw new Error(errors_1.optionsMissingError(error));
|
668
|
+
? (0, errors_1.platformAppPrefixError)()
|
669
|
+
: (0, errors_1.generatorError)('component');
|
670
|
+
throw new Error((0, errors_1.optionsMissingError)(error));
|
671
671
|
}
|
672
672
|
return { directory, featureName, projectNames, platforms };
|
673
673
|
}
|
@@ -695,7 +695,7 @@ var XplatFeatureHelpers;
|
|
695
695
|
projects = 'nativescript-sandbox';
|
696
696
|
}
|
697
697
|
else {
|
698
|
-
platforms = xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms);
|
698
|
+
platforms = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms);
|
699
699
|
const projectSandboxNames = [];
|
700
700
|
// default to project with sandbox name
|
701
701
|
for (const p of platforms) {
|
@@ -715,9 +715,9 @@ var XplatFeatureHelpers;
|
|
715
715
|
}
|
716
716
|
if (projects) {
|
717
717
|
// building feature in shared code and in projects
|
718
|
-
projectNames = xplat_utils_1.sanitizeCommaDelimitedArg(projects);
|
718
|
+
projectNames = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(projects);
|
719
719
|
for (const name of projectNames) {
|
720
|
-
let projectName = xplat_utils_1.parseProjectNameFromPath(name);
|
720
|
+
let projectName = (0, xplat_utils_1.parseProjectNameFromPath)(name);
|
721
721
|
const projectParts = projectName.split('-');
|
722
722
|
const platPrefix = projectParts[0];
|
723
723
|
const platSuffix = projectParts.pop();
|
@@ -735,13 +735,13 @@ var XplatFeatureHelpers;
|
|
735
735
|
}
|
736
736
|
else if (options.platforms) {
|
737
737
|
// building feature in shared code only
|
738
|
-
platforms = xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms);
|
738
|
+
platforms = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms);
|
739
739
|
}
|
740
740
|
if (platforms.length === 0 && !options.onlyModule) {
|
741
741
|
let error = projects
|
742
|
-
? errors_1.platformAppPrefixError()
|
743
|
-
: errors_1.generatorError('feature');
|
744
|
-
throw new schematics_1.SchematicsException(errors_1.optionsMissingError(error));
|
742
|
+
? (0, errors_1.platformAppPrefixError)()
|
743
|
+
: (0, errors_1.generatorError)('feature');
|
744
|
+
throw new schematics_1.SchematicsException((0, errors_1.optionsMissingError)(error));
|
745
745
|
}
|
746
746
|
return { featureName, projectNames, platforms };
|
747
747
|
}
|
@@ -762,9 +762,9 @@ var XplatFeatureHelpers;
|
|
762
762
|
// console.log('target:', target);
|
763
763
|
// console.log('addFiles moveTo:', moveTo);
|
764
764
|
// console.log('add files from:', `${workingDirectory}/${extra}_files`);
|
765
|
-
return schematics_1.branchAndMerge(schematics_1.mergeWith(schematics_1.apply(schematics_1.url(`./${extra}_files`), [
|
766
|
-
schematics_1.template(getTemplateOptions(options, target, framework)),
|
767
|
-
schematics_1.move(moveTo),
|
765
|
+
return (0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./${extra}_files`), [
|
766
|
+
(0, schematics_1.template)(getTemplateOptions(options, target, framework)),
|
767
|
+
(0, schematics_1.move)(moveTo),
|
768
768
|
])));
|
769
769
|
}
|
770
770
|
XplatFeatureHelpers.addFiles = addFiles;
|
@@ -773,9 +773,9 @@ var XplatFeatureHelpers;
|
|
773
773
|
// console.log('adjustBarrelIndex indexFilePath:', indexFilePath);
|
774
774
|
// console.log('tree.exists(indexFilePath):', tree.exists(indexFilePath));
|
775
775
|
const indexSource = tree.read(indexFilePath).toString('utf-8');
|
776
|
-
const indexSourceFile = typescript_1.createSourceFile(indexFilePath, indexSource, typescript_1.ScriptTarget.Latest, true);
|
777
|
-
ast_1.insert(tree, indexFilePath, [
|
778
|
-
...ast_1.addGlobal(indexSourceFile, indexFilePath, `export * from './${options.directory ? options.directory + '/' : ''}${options.name.toLowerCase()}';`, true),
|
776
|
+
const indexSourceFile = (0, typescript_1.createSourceFile)(indexFilePath, indexSource, typescript_1.ScriptTarget.Latest, true);
|
777
|
+
(0, ast_1.insert)(tree, indexFilePath, [
|
778
|
+
...(0, ast_1.addGlobal)(indexSourceFile, indexFilePath, `export * from './${options.directory ? options.directory + '/' : ''}${options.name.toLowerCase()}';`, true),
|
779
779
|
]);
|
780
780
|
return tree;
|
781
781
|
};
|
@@ -795,7 +795,7 @@ var XplatFeatureHelpers;
|
|
795
795
|
parts.forEach(() => relative.push('..'));
|
796
796
|
relativeDirectory = relative.join('/') + '/';
|
797
797
|
}
|
798
|
-
return Object.assign(Object.assign(Object.assign({}, options), general_1.getDefaultTemplateOptions()), { name: options.name.toLowerCase(), relativeDirectory,
|
798
|
+
return Object.assign(Object.assign(Object.assign({}, options), (0, general_1.getDefaultTemplateOptions)()), { name: options.name.toLowerCase(), relativeDirectory,
|
799
799
|
endingDashName,
|
800
800
|
xplatFolderName });
|
801
801
|
}
|