@nstudio/xplat 12.6.0-rc.0 → 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.
Files changed (35) hide show
  1. package/README.md +5 -5
  2. package/migrations/update-10-2-0/update-10-2-0.js +2 -2
  3. package/migrations/update-11-0-0/clean-old-dirs.js +2 -2
  4. package/migrations/update-11-0-0/update-11-0-0.js +48 -46
  5. package/migrations/update-11-0-0/update-to-11-env-base.js +33 -27
  6. package/migrations/update-11-0-0/update-to-11-imports.js +5 -5
  7. package/migrations/update-12-4-3/update-12-4-3.js +20 -20
  8. package/migrations/update-13-0-0/update-13-0-0.d.ts +2 -0
  9. package/migrations/update-13-0-0/update-13-0-0.js +299 -0
  10. package/migrations.json +46 -0
  11. package/package.json +3 -7
  12. package/src/schematics/app-generate/index.js +3 -3
  13. package/src/schematics/application/index.js +1 -1
  14. package/src/schematics/application/index.spec.js +15 -15
  15. package/src/schematics/component/index.js +1 -1
  16. package/src/schematics/component/index.spec.js +22 -22
  17. package/src/schematics/feature/index.js +3 -3
  18. package/src/schematics/feature/index.spec.js +37 -37
  19. package/src/schematics/helpers/index.js +7 -7
  20. package/src/schematics/helpers/index.spec.js +4 -4
  21. package/src/schematics/init/index.js +15 -14
  22. package/src/schematics/init/index.spec.js +8 -9
  23. package/src/schematics/mode/index.js +3 -3
  24. package/src/schematics/ng-add/index.js +3 -3
  25. package/src/utils/ast.js +1 -1
  26. package/src/utils/general.d.ts +0 -1
  27. package/src/utils/general.js +11 -19
  28. package/src/utils/helpers.js +1 -1
  29. package/src/utils/postinstall.js +9 -9
  30. package/src/utils/testing-utils.js +2 -2
  31. package/src/utils/testing.js +2 -2
  32. package/src/utils/versions.d.ts +1 -1
  33. package/src/utils/versions.js +2 -2
  34. package/src/utils/xplat.d.ts +6 -0
  35. package/src/utils/xplat.js +90 -70
@@ -33,20 +33,24 @@ exports.packageInnerDependencies = {
33
33
  };
34
34
  var XplatHelpers;
35
35
  (function (XplatHelpers) {
36
+ function isFeatureNxLib(featureName) {
37
+ return featureName && featureName.indexOf('@') === 0;
38
+ }
39
+ XplatHelpers.isFeatureNxLib = isFeatureNxLib;
36
40
  /**
37
41
  * Calls ng-add _if_ the package does not already exist
38
42
  * Otherwise calls that schematic if desired, otherwise noop
39
43
  */
40
44
  function addPackageWithNgAdd(packageName, options, callSchematicIfAdded) {
41
45
  return (host) => {
42
- const { dependencies, devDependencies } = workspace_1.readJsonInTree(host, 'package.json');
46
+ const { dependencies, devDependencies } = (0, workspace_1.readJsonInTree)(host, 'package.json');
43
47
  return dependencies[packageName] || devDependencies[packageName]
44
48
  ? callSchematicIfAdded
45
- ? schematics_1.externalSchematic(packageName, callSchematicIfAdded, options, {
49
+ ? (0, schematics_1.externalSchematic)(packageName, callSchematicIfAdded, options, {
46
50
  interactive: false,
47
51
  })
48
- : schematics_1.noop()
49
- : schematics_1.externalSchematic(packageName, 'ng-add', options, {
52
+ : (0, schematics_1.noop)()
53
+ : (0, schematics_1.externalSchematic)(packageName, 'ng-add', options, {
50
54
  interactive: false,
51
55
  });
52
56
  };
@@ -61,10 +65,10 @@ var XplatHelpers;
61
65
  }
62
66
  }
63
67
  else {
64
- const platformArgList = xplat_utils_1.sanitizeCommaDelimitedArg(platformArgument);
68
+ const platformArgList = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(platformArgument);
65
69
  if (platformArgList.length === 0) {
66
70
  if (required) {
67
- throw new Error(errors_1.noPlatformError());
71
+ throw new Error((0, errors_1.noPlatformError)());
68
72
  }
69
73
  }
70
74
  else {
@@ -73,7 +77,7 @@ var XplatHelpers;
73
77
  platforms.push(platform);
74
78
  }
75
79
  else {
76
- throw new Error(errors_1.unsupportedPlatformError(platform));
80
+ throw new Error((0, errors_1.unsupportedPlatformError)(platform));
77
81
  }
78
82
  }
79
83
  }
@@ -87,7 +91,7 @@ var XplatHelpers;
87
91
  // always default framework choice to first in list when multiple
88
92
  return ((frameworkArgument === 'all'
89
93
  ? xplat_utils_1.supportedFrameworks
90
- : xplat_utils_1.sanitizeCommaDelimitedArg(frameworkArgument)));
94
+ : (0, xplat_utils_1.sanitizeCommaDelimitedArg)(frameworkArgument)));
91
95
  }
92
96
  XplatHelpers.getFrameworksFromOptions = getFrameworksFromOptions;
93
97
  function getFrameworkChoice(frameworkArgument, frameworks) {
@@ -99,7 +103,7 @@ var XplatHelpers;
99
103
  const frameworks = getFrameworksFromOptions(options.framework);
100
104
  const frameworkChoice = XplatHelpers.getFrameworkChoice(options.framework, frameworks);
101
105
  const xplatSettings = {
102
- prefix: xplat_utils_1.getPrefix(),
106
+ prefix: (0, xplat_utils_1.getPrefix)(),
103
107
  };
104
108
  if (frameworkChoice && frameworks.length === 1) {
105
109
  // when only 1 framework is specified, auto add as default
@@ -119,8 +123,8 @@ var XplatHelpers;
119
123
  * @param platform
120
124
  */
121
125
  function getPlatformName(name, platform) {
122
- const nameSanitized = workspace_1.toFileName(name);
123
- return xplat_utils_1.getGroupByName()
126
+ const nameSanitized = (0, xplat_utils_1.toFileName)(name);
127
+ return (0, xplat_utils_1.getGroupByName)()
124
128
  ? `${nameSanitized}-${platform}`
125
129
  : `${platform}-${nameSanitized}`;
126
130
  }
@@ -133,7 +137,7 @@ var XplatHelpers;
133
137
  * @param framework
134
138
  */
135
139
  function getXplatFoldername(platform, framework) {
136
- const frontendFramework = xplat_utils_1.getFrontendFramework();
140
+ const frontendFramework = (0, xplat_utils_1.getFrontendFramework)();
137
141
  // console.log('getXplatFoldername frontendFramework:', frontendFramework);
138
142
  // console.log('framework:', framework);
139
143
  let frameworkSuffix = '';
@@ -159,7 +163,7 @@ var XplatHelpers;
159
163
  default:
160
164
  isApp = ['application', 'app'].includes(generator);
161
165
  generatorSettings = {
162
- platforms: xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms),
166
+ platforms: (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms),
163
167
  };
164
168
  break;
165
169
  }
@@ -208,7 +212,7 @@ var XplatHelpers;
208
212
  }
209
213
  }
210
214
  else {
211
- throw new schematics_1.SchematicsException(errors_1.unsupportedFrameworkError(framework));
215
+ throw new schematics_1.SchematicsException((0, errors_1.unsupportedFrameworkError)(framework));
212
216
  }
213
217
  }
214
218
  }
@@ -229,7 +233,7 @@ var XplatHelpers;
229
233
  packagesToRunXplat.push(packageName);
230
234
  }
231
235
  else {
232
- throw new schematics_1.SchematicsException(errors_1.unsupportedPlatformError(platform));
236
+ throw new schematics_1.SchematicsException((0, errors_1.unsupportedPlatformError)(platform));
233
237
  }
234
238
  }
235
239
  }
@@ -237,7 +241,7 @@ var XplatHelpers;
237
241
  externalChains.push((tree, context) => {
238
242
  // check if othet nstudio or nrwl dependencies are needed
239
243
  // check user's package for current version
240
- const packageJson = xplat_utils_1.getJsonFromFile(tree, 'package.json');
244
+ const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json');
241
245
  if (packageJson) {
242
246
  for (const packageName in devDependencies) {
243
247
  if (exports.packageInnerDependencies[packageName]) {
@@ -276,7 +280,7 @@ var XplatHelpers;
276
280
  // console.log('packagesToRunXplat:', packagesToRunXplat)
277
281
  if (packagesToRunXplat.length) {
278
282
  for (const packageName of packagesToRunXplat) {
279
- externalChains.push(schematics_1.externalSchematic(packageName, generator, options, {
283
+ externalChains.push((0, schematics_1.externalSchematic)(packageName, generator, options, {
280
284
  interactive: false,
281
285
  }));
282
286
  }
@@ -298,7 +302,7 @@ var XplatHelpers;
298
302
  XplatHelpers.getExternalChainsForGenerator = getExternalChainsForGenerator;
299
303
  function getExternalChainsForApplication(options, generator, packagesToRun) {
300
304
  let generatorSettings = {
301
- platforms: xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms),
305
+ platforms: (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms),
302
306
  };
303
307
  const platforms = generatorSettings.platforms;
304
308
  const externalChains = [];
@@ -318,7 +322,7 @@ var XplatHelpers;
318
322
  packagesToRun.push(packageName);
319
323
  }
320
324
  else {
321
- throw new schematics_1.SchematicsException(errors_1.unsupportedPlatformError(platform));
325
+ throw new schematics_1.SchematicsException((0, errors_1.unsupportedPlatformError)(platform));
322
326
  }
323
327
  }
324
328
  }
@@ -326,7 +330,7 @@ var XplatHelpers;
326
330
  externalChains.push((tree, context) => {
327
331
  // check if othet nstudio or nrwl dependencies are needed
328
332
  // check user's package for current version
329
- const packageJson = xplat_utils_1.getJsonFromFile(tree, 'package.json');
333
+ const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json');
330
334
  if (packageJson) {
331
335
  for (const packageName in devDependencies) {
332
336
  if (exports.packageInnerDependencies[packageName]) {
@@ -364,7 +368,7 @@ var XplatHelpers;
364
368
  if (options.isTesting) {
365
369
  // necessary to unit test the appropriately
366
370
  if (xplatPlatforms) {
367
- externalChains.push(schematics_1.externalSchematic('@nstudio/xplat', 'app-generate', options, {
371
+ externalChains.push((0, schematics_1.externalSchematic)('@nstudio/xplat', 'app-generate', options, {
368
372
  interactive: false,
369
373
  }));
370
374
  }
@@ -374,9 +378,9 @@ var XplatHelpers;
374
378
  const { name, directory } = getAppNamingConvention(options, nxPlatform);
375
379
  output_1.output.log({
376
380
  title: 'Note:',
377
- bodyLines: [errors_1.noXplatLayerNote(nxPlatform)],
381
+ bodyLines: [(0, errors_1.noXplatLayerNote)(nxPlatform)],
378
382
  });
379
- 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,
380
384
  directory }), {
381
385
  interactive: false,
382
386
  }));
@@ -385,7 +389,7 @@ var XplatHelpers;
385
389
  }
386
390
  else {
387
391
  if (xplatPlatforms) {
388
- externalChains.push(schematics_1.externalSchematic('@nstudio/xplat', 'app-generate', options, {
392
+ externalChains.push((0, schematics_1.externalSchematic)('@nstudio/xplat', 'app-generate', options, {
389
393
  interactive: true,
390
394
  }));
391
395
  }
@@ -399,7 +403,7 @@ var XplatHelpers;
399
403
  const { name, directory } = getAppNamingConvention(options, nxPlatform);
400
404
  output_1.output.log({
401
405
  title: 'Note:',
402
- bodyLines: [errors_1.noXplatLayerNote(nxPlatform)],
406
+ bodyLines: [(0, errors_1.noXplatLayerNote)(nxPlatform)],
403
407
  });
404
408
  context.addTask(new tasks_1.RunSchematicTask(packageName, generator, Object.assign(Object.assign({}, options), { name,
405
409
  directory })), [installPackageTask]);
@@ -417,7 +421,7 @@ var XplatHelpers;
417
421
  options.directory = directory;
418
422
  // console.log('applyAppNamingConvention:', options);
419
423
  // adjusted name, nothing else to do
420
- return schematics_1.noop()(tree, context);
424
+ return (0, schematics_1.noop)()(tree, context);
421
425
  };
422
426
  }
423
427
  XplatHelpers.applyAppNamingConvention = applyAppNamingConvention;
@@ -425,10 +429,10 @@ var XplatHelpers;
425
429
  let name = '';
426
430
  let directory = '';
427
431
  if (options.directory) {
428
- directory = workspace_1.toFileName(options.directory);
432
+ directory = (0, xplat_utils_1.toFileName)(options.directory);
429
433
  if (directory === platform &&
430
434
  xplat_utils_1.supportedPlatformsWithNx.includes(directory)) {
431
- name = workspace_1.toFileName(options.name);
435
+ name = (0, xplat_utils_1.toFileName)(options.name);
432
436
  }
433
437
  else {
434
438
  name = getPlatformName(options.name, platform);
@@ -445,12 +449,12 @@ var XplatHelpers;
445
449
  XplatHelpers.getAppNamingConvention = getAppNamingConvention;
446
450
  function generateLib(options, libName, directory = '', testEnvironment = 'jsdom', framework = 'angular') {
447
451
  return (tree, context) => {
448
- if (!xplat_utils_1.getFrontendFramework() && framework) {
452
+ if (!(0, xplat_utils_1.getFrontendFramework)() && framework) {
449
453
  directory = `${directory}-${framework}`;
450
454
  }
451
455
  if (tree.exists(`libs/${directory ? directory + '/' : ''}${libName}/tsconfig.json`)) {
452
456
  // console.log(`externalSchematic('@nrwl/workspace', 'lib') ALREADY EXISTS for:`, `libs/${directory ? directory + '/' : ''}${libName}`)
453
- return schematics_1.noop()(tree, context);
457
+ return (0, schematics_1.noop)()(tree, context);
454
458
  }
455
459
  const libOptions = {
456
460
  name: libName,
@@ -462,13 +466,13 @@ var XplatHelpers;
462
466
  libOptions.skipTsConfig = true;
463
467
  }
464
468
  // console.log(`CALLING externalSchematic('@nrwl/workspace', 'lib') for:`, `libs/${directory ? directory + '/' : ''}${libName}`)
465
- 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)]);
466
470
  };
467
471
  }
468
472
  XplatHelpers.generateLib = generateLib;
469
473
  function cleanupLib(options, libName, directory = '', framework = 'angular') {
470
474
  return (tree, context) => {
471
- if (!xplat_utils_1.getFrontendFramework() && framework) {
475
+ if (!(0, xplat_utils_1.getFrontendFramework)() && framework) {
472
476
  directory = `${directory}-${framework}`;
473
477
  }
474
478
  // adjust index files
@@ -516,7 +520,7 @@ var XplatHelpers;
516
520
  }
517
521
  }
518
522
  if (needsTsConfigUpdate && tsConfig) {
519
- xplat_utils_1.updateJsonFile(tree, tsConfigPath, tsConfig);
523
+ (0, xplat_utils_1.updateJsonFile)(tree, tsConfigPath, tsConfig);
520
524
  }
521
525
  return tree;
522
526
  };
@@ -524,10 +528,10 @@ var XplatHelpers;
524
528
  XplatHelpers.cleanupLib = cleanupLib;
525
529
  function addPlatformFiles(options, platform, libName, checkExistingFile) {
526
530
  return (tree, context) => {
527
- let frontendFramework = xplat_utils_1.getFrontendFramework();
531
+ let frontendFramework = (0, xplat_utils_1.getFrontendFramework)();
528
532
  if (tree.exists(`libs/xplat/${platform}/${libName}/src/lib/index.ts`)) {
529
533
  // check if framework had been set
530
- frontendFramework = xplat_utils_1.getFrontendFramework();
534
+ frontendFramework = (0, xplat_utils_1.getFrontendFramework)();
531
535
  // console.log('addPlatformFiles frontendFramework:', frontendFramework)
532
536
  // console.log('addPlatformFiles options.framework:', options.framework)
533
537
  if (frontendFramework && !options.framework) {
@@ -536,22 +540,22 @@ var XplatHelpers;
536
540
  // ie: vanilla {N}, vanilla web, vanilla ionic, etc. (without angular, react, vue, etc.)
537
541
  // if user had set a default framework and is now attempting to generate base platform support
538
542
  // TODO: add schematic to reconfigure workspace to rename xplat folders to support full multi-framework setup
539
- throw new schematics_1.SchematicsException(errors_1.noteAboutXplatSetupWithFramework(frontendFramework, platform));
543
+ throw new schematics_1.SchematicsException((0, errors_1.noteAboutXplatSetupWithFramework)(frontendFramework, platform));
540
544
  }
541
545
  // already added
542
- return schematics_1.noop();
546
+ return (0, schematics_1.noop)();
543
547
  }
544
548
  const xplatFolderName = XplatHelpers.getXplatFoldername(platform, options.framework);
545
549
  // src should go into Nx library structure
546
550
  const libFolder = `/${libName}/src${libName === 'scss' ? '' : '/lib'}`;
547
551
  if (checkExistingFile &&
548
552
  tree.exists(`libs/xplat/${xplatFolderName}/${libFolder}/${checkExistingFile}`)) {
549
- return schematics_1.noop();
553
+ return (0, schematics_1.noop)();
550
554
  }
551
555
  else {
552
- return schematics_1.branchAndMerge(schematics_1.mergeWith(schematics_1.apply(schematics_1.url(`./_files_${libName}`), [
553
- schematics_1.template(Object.assign(Object.assign(Object.assign({}, options), general_1.getDefaultTemplateOptions()), { xplatFolderName })),
554
- 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}`),
555
559
  ])));
556
560
  }
557
561
  };
@@ -560,7 +564,7 @@ var XplatHelpers;
560
564
  function updatePackageForXplat(options, updates) {
561
565
  return (tree, context) => {
562
566
  const packagePath = 'package.json';
563
- let packageJson = xplat_utils_1.getJsonFromFile(tree, packagePath);
567
+ let packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
564
568
  if (packageJson) {
565
569
  // could introduce xplat.json but trying to avoid too much extra overhead so just store in package.json for now
566
570
  // can migrate this later if decide enough settings for xplat.json
@@ -570,13 +574,13 @@ var XplatHelpers;
570
574
  // just updating xplat internal settings
571
575
  packageJson.xplat = Object.assign(Object.assign({}, (packageJson.xplat || {})), xplatSettings);
572
576
  // just update xplat workspace settings
573
- return xplat_utils_1.updateJsonFile(tree, packagePath, packageJson);
577
+ return (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
574
578
  }
575
579
  else if (updates) {
576
580
  // update root dependencies for the generated xplat support
577
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) });
578
582
  // console.log('updatePackageForXplat:', serializeJson(packageJson));
579
- return xplat_utils_1.updateJsonFile(tree, packagePath, packageJson);
583
+ return (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
580
584
  }
581
585
  }
582
586
  return tree;
@@ -609,15 +613,23 @@ var XplatComponentHelpers;
609
613
  (function (XplatComponentHelpers) {
610
614
  function prepare(options) {
611
615
  if (!options.name) {
612
- throw new Error(errors_1.generateOptionError('component'));
616
+ throw new Error((0, errors_1.generateOptionError)('component'));
613
617
  }
614
618
  // reset module globals
615
619
  options.needsIndex = false;
616
620
  let featureName;
621
+ let directory = '';
617
622
  let projectNames = null;
618
623
  let platforms = [];
624
+ const isNxLib = XplatHelpers.isFeatureNxLib(featureName);
619
625
  if (options.feature) {
620
- featureName = options.feature.toLowerCase();
626
+ const dirParts = options.feature.split('/');
627
+ if (dirParts.length) {
628
+ featureName = dirParts.pop().toLowerCase();
629
+ if (!isNxLib) {
630
+ directory = dirParts.join('/');
631
+ }
632
+ }
621
633
  }
622
634
  const projects = options.projects;
623
635
  if (projects) {
@@ -627,9 +639,9 @@ var XplatComponentHelpers;
627
639
  featureName = 'shared';
628
640
  }
629
641
  // building feature in shared code and in projects
630
- projectNames = xplat_utils_1.sanitizeCommaDelimitedArg(projects);
642
+ projectNames = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(projects);
631
643
  for (const fullProjectPath of projectNames) {
632
- const projectName = xplat_utils_1.parseProjectNameFromPath(fullProjectPath);
644
+ const projectName = (0, xplat_utils_1.parseProjectNameFromPath)(fullProjectPath);
633
645
  const projectParts = projectName.split('-');
634
646
  const platPrefix = projectParts[0];
635
647
  const platSuffix = projectParts.pop();
@@ -649,15 +661,15 @@ var XplatComponentHelpers;
649
661
  featureName = 'ui';
650
662
  }
651
663
  // building feature in shared code only
652
- platforms = xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms);
664
+ platforms = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms);
653
665
  }
654
666
  if (platforms.length === 0) {
655
667
  let error = projects
656
- ? errors_1.platformAppPrefixError()
657
- : errors_1.generatorError('component');
658
- 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));
659
671
  }
660
- return { featureName, projectNames, platforms };
672
+ return { directory, featureName, projectNames, platforms };
661
673
  }
662
674
  XplatComponentHelpers.prepare = prepare;
663
675
  })(XplatComponentHelpers = exports.XplatComponentHelpers || (exports.XplatComponentHelpers = {}));
@@ -683,7 +695,7 @@ var XplatFeatureHelpers;
683
695
  projects = 'nativescript-sandbox';
684
696
  }
685
697
  else {
686
- platforms = xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms);
698
+ platforms = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms);
687
699
  const projectSandboxNames = [];
688
700
  // default to project with sandbox name
689
701
  for (const p of platforms) {
@@ -703,9 +715,9 @@ var XplatFeatureHelpers;
703
715
  }
704
716
  if (projects) {
705
717
  // building feature in shared code and in projects
706
- projectNames = xplat_utils_1.sanitizeCommaDelimitedArg(projects);
718
+ projectNames = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(projects);
707
719
  for (const name of projectNames) {
708
- let projectName = xplat_utils_1.parseProjectNameFromPath(name);
720
+ let projectName = (0, xplat_utils_1.parseProjectNameFromPath)(name);
709
721
  const projectParts = projectName.split('-');
710
722
  const platPrefix = projectParts[0];
711
723
  const platSuffix = projectParts.pop();
@@ -723,13 +735,13 @@ var XplatFeatureHelpers;
723
735
  }
724
736
  else if (options.platforms) {
725
737
  // building feature in shared code only
726
- platforms = xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms);
738
+ platforms = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms);
727
739
  }
728
740
  if (platforms.length === 0 && !options.onlyModule) {
729
741
  let error = projects
730
- ? errors_1.platformAppPrefixError()
731
- : errors_1.generatorError('feature');
732
- 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));
733
745
  }
734
746
  return { featureName, projectNames, platforms };
735
747
  }
@@ -741,7 +753,7 @@ var XplatFeatureHelpers;
741
753
  }
742
754
  else {
743
755
  target = 'lib';
744
- moveTo = `libs/xplat/features/src/lib/${options.name.toLowerCase()}`;
756
+ moveTo = `libs/xplat/features/src/lib/${options.directory ? options.directory + '/' : ''}${options.name.toLowerCase()}`;
745
757
  }
746
758
  if (!extra) {
747
759
  // make sure no `null` or `undefined` values get in the string path
@@ -750,9 +762,9 @@ var XplatFeatureHelpers;
750
762
  // console.log('target:', target);
751
763
  // console.log('addFiles moveTo:', moveTo);
752
764
  // console.log('add files from:', `${workingDirectory}/${extra}_files`);
753
- return schematics_1.branchAndMerge(schematics_1.mergeWith(schematics_1.apply(schematics_1.url(`./${extra}_files`), [
754
- schematics_1.template(getTemplateOptions(options, target, framework)),
755
- 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),
756
768
  ])));
757
769
  }
758
770
  XplatFeatureHelpers.addFiles = addFiles;
@@ -761,9 +773,9 @@ var XplatFeatureHelpers;
761
773
  // console.log('adjustBarrelIndex indexFilePath:', indexFilePath);
762
774
  // console.log('tree.exists(indexFilePath):', tree.exists(indexFilePath));
763
775
  const indexSource = tree.read(indexFilePath).toString('utf-8');
764
- const indexSourceFile = typescript_1.createSourceFile(indexFilePath, indexSource, typescript_1.ScriptTarget.Latest, true);
765
- ast_1.insert(tree, indexFilePath, [
766
- ...ast_1.addGlobal(indexSourceFile, indexFilePath, `export * from './${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),
767
779
  ]);
768
780
  return tree;
769
781
  };
@@ -776,7 +788,15 @@ var XplatFeatureHelpers;
776
788
  endingDashName = general_1.stringUtils.capitalize(nameParts[nameParts.length - 1]);
777
789
  }
778
790
  const xplatFolderName = XplatHelpers.getXplatFoldername(platform, framework);
779
- return Object.assign(Object.assign(Object.assign({}, options), general_1.getDefaultTemplateOptions()), { name: options.name.toLowerCase(), endingDashName,
791
+ let relativeDirectory = '';
792
+ if (options.directory) {
793
+ const parts = options.directory.split('/');
794
+ const relative = [];
795
+ parts.forEach(() => relative.push('..'));
796
+ relativeDirectory = relative.join('/') + '/';
797
+ }
798
+ return Object.assign(Object.assign(Object.assign({}, options), (0, general_1.getDefaultTemplateOptions)()), { name: options.name.toLowerCase(), relativeDirectory,
799
+ endingDashName,
780
800
  xplatFolderName });
781
801
  }
782
802
  XplatFeatureHelpers.getTemplateOptions = getTemplateOptions;
@@ -785,12 +805,12 @@ var XplatFeatureHelpers;
785
805
  const xplatFolderName = XplatHelpers.getXplatFoldername(platform, framework);
786
806
  // console.log('getMoveTo xplatFolderName:', xplatFolderName);
787
807
  const featureName = options.name.toLowerCase();
788
- let moveTo = `libs/xplat/${xplatFolderName}/features/src/lib/${featureName}`;
808
+ let moveTo = `libs/xplat/${xplatFolderName}/features/src/lib/${options.directory ? options.directory + '/' : ''}${featureName}`;
789
809
  if (projectName) {
790
810
  let appDir = ['web', 'web-angular'].includes(xplatFolderName)
791
811
  ? '/app'
792
812
  : '';
793
- moveTo = `apps/${projectName}/src${appDir}/features/${featureName}`;
813
+ moveTo = `apps/${projectName}/src${appDir}/features/${options.directory ? options.directory + '/' : ''}${featureName}`;
794
814
  // console.log('moveTo:', moveTo);
795
815
  }
796
816
  return moveTo;