@nstudio/angular 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 (33) hide show
  1. package/README.md +5 -5
  2. package/package.json +3 -3
  3. package/src/schematics/application/index.js +33 -23
  4. package/src/schematics/application/index.spec.js +8 -33
  5. package/src/schematics/application/schema.json +1 -28
  6. package/src/schematics/component/index.js +16 -16
  7. package/src/schematics/component/index.spec.js +22 -22
  8. package/src/schematics/directive/index.js +1 -1
  9. package/src/schematics/directive/index.spec.js +23 -23
  10. package/src/schematics/elements/index.js +18 -18
  11. package/src/schematics/elements/index.spec.js +21 -21
  12. package/src/schematics/feature/index.js +10 -10
  13. package/src/schematics/feature/index.spec.js +37 -37
  14. package/src/schematics/feature/schema.json +4 -0
  15. package/src/schematics/helpers/applitools/index.js +8 -8
  16. package/src/schematics/helpers/index.js +4 -4
  17. package/src/schematics/helpers/index.spec.js +15 -15
  18. package/src/schematics/ng-add/index.js +4 -4
  19. package/src/schematics/ngrx/index.js +1 -1
  20. package/src/schematics/ngrx/index.spec.js +16 -16
  21. package/src/schematics/pipe/index.js +1 -1
  22. package/src/schematics/pipe/index.spec.js +20 -20
  23. package/src/schematics/service/index.js +1 -1
  24. package/src/schematics/service/index.spec.js +20 -20
  25. package/src/schematics/xplat/index.js +7 -7
  26. package/src/schematics/xplat/index.spec.js +13 -13
  27. package/src/utils/ast.js +8 -8
  28. package/src/utils/generator.d.ts +0 -1
  29. package/src/utils/generator.js +78 -58
  30. package/src/utils/testing.js +1 -1
  31. package/src/utils/versions.d.ts +9 -11
  32. package/src/utils/versions.js +11 -13
  33. package/src/utils/xplat.js +25 -24
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.adjustSandbox = exports.adjustRouting = exports.adjustFeatureModuleForState = exports.adjustFeatureModule = exports.adjustModule = exports.adjustBarrelIndexForType = exports.adjustBarrelIndex = exports.adjustBarrel = exports.shouldTargetCoreBarrel = exports.isFeatureInGeneralBarrel = exports.addToFeature = exports.getNxFeaturePath = exports.isFeatureNxLib = exports.getFeatureName = exports.generate = void 0;
3
+ exports.adjustSandbox = exports.adjustRouting = exports.adjustFeatureModuleForState = exports.adjustFeatureModule = exports.adjustModule = exports.adjustBarrelIndexForType = exports.adjustBarrelIndex = exports.adjustBarrel = exports.shouldTargetCoreBarrel = exports.isFeatureInGeneralBarrel = exports.addToFeature = exports.getNxFeaturePath = exports.getFeatureName = exports.generate = void 0;
4
4
  const schematics_1 = require("@angular-devkit/schematics");
5
5
  const workspace_1 = require("@nrwl/workspace");
6
6
  const xplat_1 = require("@nstudio/xplat");
@@ -9,14 +9,14 @@ const ast_1 = require("./ast");
9
9
  const ts = require("typescript");
10
10
  function generate(type, options) {
11
11
  if (!options.name) {
12
- throw new Error(xplat_1.generateOptionError(type));
12
+ throw new Error((0, xplat_1.generateOptionError)(type));
13
13
  }
14
14
  let featureName = getFeatureName(options);
15
15
  let platforms = [];
16
16
  const externalChains = [];
17
17
  if (options.projects) {
18
18
  // building in projects
19
- const projects = xplat_utils_1.sanitizeCommaDelimitedArg(options.projects);
19
+ const projects = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.projects);
20
20
  for (const name of projects) {
21
21
  const nameParts = name.split('-');
22
22
  const platPrefix = nameParts[0];
@@ -35,12 +35,12 @@ function generate(type, options) {
35
35
  }
36
36
  else if (options.platforms) {
37
37
  // building in shared code only
38
- platforms = xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms);
38
+ platforms = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms);
39
39
  }
40
40
  const projectChains = [];
41
41
  if (options.projects) {
42
42
  for (const fullProjectPath of options.projects.split(',')) {
43
- const projectName = xplat_utils_1.parseProjectNameFromPath(fullProjectPath);
43
+ const projectName = (0, xplat_utils_1.parseProjectNameFromPath)(fullProjectPath);
44
44
  const projectParts = projectName.split('-');
45
45
  const platform = xplat_utils_1.supportedPlatforms.includes(projectParts[0])
46
46
  ? projectParts[0]
@@ -70,7 +70,7 @@ function generate(type, options) {
70
70
  // console.log('featureModulePath:', featureModulePath);
71
71
  // console.log('projectName:', projectName);
72
72
  if (!tree.exists(featureModulePath)) {
73
- throw new Error(xplat_1.needFeatureModuleError(featureModulePath, featureName, projectName, true));
73
+ throw new Error((0, xplat_1.needFeatureModuleError)(featureModulePath, featureName, projectName, true));
74
74
  }
75
75
  return addToFeature(platform, type, options, prefixPath, tree)(tree, context);
76
76
  });
@@ -86,7 +86,7 @@ function generate(type, options) {
86
86
  return adjustFeatureModuleForState(options, featureModulePath)(tree, context);
87
87
  });
88
88
  projectChains.push((tree, context) => {
89
- return xplat_1.updatePackageForNgrx(tree, `apps/${fullProjectPath}/package.json`);
89
+ return (0, xplat_1.updatePackageForNgrx)(tree, `apps/${fullProjectPath}/package.json`);
90
90
  });
91
91
  }
92
92
  else {
@@ -103,7 +103,7 @@ function generate(type, options) {
103
103
  }
104
104
  }
105
105
  else {
106
- projectChains.push(schematics_1.noop());
106
+ projectChains.push((0, schematics_1.noop)());
107
107
  for (const platform of platforms) {
108
108
  if (xplat_utils_1.supportedPlatforms.includes(platform)) {
109
109
  // externalChains.push(externalSchematic(`@nstudio/${platform}-angular`, type, options, {
@@ -123,7 +123,7 @@ function generate(type, options) {
123
123
  const xplatFolderName = xplat_1.XplatHelpers.getXplatFoldername(platform, 'angular');
124
124
  return options.needsIndex
125
125
  ? addToFeature(xplatFolderName, type, options, `libs/xplat/${xplatFolderName}`, tree, '_index')(tree, context)
126
- : schematics_1.noop()(tree, context);
126
+ : (0, schematics_1.noop)()(tree, context);
127
127
  });
128
128
  // adjust feature module metadata if needed
129
129
  externalChains.push((tree, context) => {
@@ -132,46 +132,57 @@ function generate(type, options) {
132
132
  });
133
133
  }
134
134
  else {
135
- throw new Error(xplat_1.unsupportedPlatformError(platform));
135
+ throw new Error((0, xplat_1.unsupportedPlatformError)(platform));
136
136
  }
137
137
  }
138
138
  }
139
- return schematics_1.chain([
140
- xplat_utils_1.prerun(),
139
+ return (0, schematics_1.chain)([
140
+ (0, xplat_utils_1.prerun)(),
141
141
  (tree, context) =>
142
142
  // for entire workspace usage
143
143
  // no projects and no specific platforms specified
144
144
  !options.projects && platforms.length === 0
145
145
  ? addToFeature('', type, options, 'libs/xplat', tree)(tree, context)
146
- : schematics_1.noop()(tree, context),
146
+ : (0, schematics_1.noop)()(tree, context),
147
147
  // adjust libs barrel
148
148
  (tree, context) => !options.projects && platforms.length === 0
149
149
  ? adjustBarrel(type, options, 'libs/xplat')(tree, context)
150
- : schematics_1.noop()(tree, context),
150
+ : (0, schematics_1.noop)()(tree, context),
151
151
  // add index barrel if needed
152
152
  (tree, context) => options.needsIndex
153
153
  ? addToFeature('', type, options, 'libs/xplat', tree, '_index')(tree, context)
154
- : schematics_1.noop()(tree, context),
154
+ : (0, schematics_1.noop)()(tree, context),
155
155
  // adjust feature module metadata if needed
156
156
  (tree, context) => !options.projects && platforms.length === 0
157
157
  ? adjustModule(tree, type, options, 'libs/xplat')(tree, context)
158
- : schematics_1.noop()(tree, context),
158
+ : (0, schematics_1.noop)()(tree, context),
159
159
  // project handling
160
- (tree, context) => schematics_1.chain(projectChains),
161
- (tree, context) => schematics_1.chain(externalChains),
160
+ (tree, context) => (0, schematics_1.chain)(projectChains),
161
+ (tree, context) => (0, schematics_1.chain)(externalChains),
162
162
  // dependency updates
163
163
  (tree, context) => !options.projects && type === 'state'
164
164
  ? // ensure ngrx dependencies are added to root package
165
- xplat_1.updatePackageForNgrx(tree)
166
- : schematics_1.noop()(tree, context),
167
- workspace_1.formatFiles({ skipFormat: options.skipFormat }),
165
+ (0, xplat_1.updatePackageForNgrx)(tree)
166
+ : (0, schematics_1.noop)()(tree, context),
167
+ (0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
168
168
  ]);
169
169
  }
170
170
  exports.generate = generate;
171
171
  function getFeatureName(options) {
172
172
  let featureName;
173
+ const isNxLib = xplat_1.XplatHelpers.isFeatureNxLib(options.feature);
173
174
  if (options.feature) {
174
- featureName = options.feature.toLowerCase();
175
+ if (isNxLib) {
176
+ // use lib name "as-is"
177
+ featureName = options.feature.toLowerCase();
178
+ }
179
+ else {
180
+ // otherwise, user is wanting to target a feature nested in a folder (within features)
181
+ const dirParts = options.feature.split('/');
182
+ if (dirParts.length) {
183
+ featureName = dirParts.pop().toLowerCase();
184
+ }
185
+ }
175
186
  }
176
187
  if (!featureName) {
177
188
  if (options.projects) {
@@ -186,12 +197,8 @@ function getFeatureName(options) {
186
197
  return featureName;
187
198
  }
188
199
  exports.getFeatureName = getFeatureName;
189
- function isFeatureNxLib(featureName) {
190
- return featureName && featureName.indexOf('@') === 0;
191
- }
192
- exports.isFeatureNxLib = isFeatureNxLib;
193
200
  function getNxFeaturePath(tree, featureName) {
194
- const tsConfig = workspace_1.readJsonInTree(tree, 'tsconfig.base.json');
201
+ const tsConfig = (0, workspace_1.readJsonInTree)(tree, 'tsconfig.base.json');
195
202
  if (tsConfig) {
196
203
  if (tsConfig.compilerOptions &&
197
204
  tsConfig.compilerOptions.paths &&
@@ -211,7 +218,19 @@ function getNxFeaturePath(tree, featureName) {
211
218
  exports.getNxFeaturePath = getNxFeaturePath;
212
219
  function addToFeature(xplatFolderName, type, options, prefixPath, tree, extra = '', forSubFolder) {
213
220
  let featureName = getFeatureName(options);
214
- const isNxLib = isFeatureNxLib(featureName);
221
+ const isNxLib = xplat_1.XplatHelpers.isFeatureNxLib(featureName);
222
+ let directory = '';
223
+ let relativeDirectory = '';
224
+ if (!isNxLib && options.feature) {
225
+ const dirParts = options.feature.split('/');
226
+ if (dirParts.length) {
227
+ dirParts.pop();
228
+ directory = dirParts.join('/');
229
+ const relative = [];
230
+ dirParts.forEach(() => relative.push('..'));
231
+ relativeDirectory = relative.join('/') + '/';
232
+ }
233
+ }
215
234
  options.needsIndex = false; // reset
216
235
  const srcSubFolderPath = options.projects ? '' : '/src/lib';
217
236
  let featurePath;
@@ -226,7 +245,7 @@ function addToFeature(xplatFolderName, type, options, prefixPath, tree, extra =
226
245
  featurePath = `${prefixPath}/${featureName}${srcSubFolderPath}`;
227
246
  }
228
247
  else {
229
- featurePath = `${prefixPath}/features${srcSubFolderPath}/${featureName}`;
248
+ featurePath = `${prefixPath}/features${srcSubFolderPath}/${directory ? directory + '/' : ''}${featureName}`;
230
249
  }
231
250
  const featureModulePath = `${featurePath}/${featureName}.module.ts`;
232
251
  let moveTo;
@@ -245,7 +264,7 @@ function addToFeature(xplatFolderName, type, options, prefixPath, tree, extra =
245
264
  optionName = parts[2];
246
265
  }
247
266
  }
248
- throw new Error(xplat_1.needFeatureModuleError(featureModulePath, featureName, optionName));
267
+ throw new Error((0, xplat_1.needFeatureModuleError)(featureModulePath, featureName, optionName));
249
268
  }
250
269
  }
251
270
  if (forSubFolder && options.subFolder) {
@@ -256,14 +275,15 @@ function addToFeature(xplatFolderName, type, options, prefixPath, tree, extra =
256
275
  if ((extra === '_index' || extra === '_base_index') &&
257
276
  tree.exists(indexPath)) {
258
277
  // already has an index barrel
259
- return schematics_1.noop();
278
+ return (0, schematics_1.noop)();
260
279
  }
261
280
  else {
262
- return schematics_1.branchAndMerge(schematics_1.mergeWith(schematics_1.apply(schematics_1.url(`./${extra}_files`), [
263
- schematics_1.template(Object.assign(Object.assign(Object.assign({}, options), xplat_1.getDefaultTemplateOptions()), { name: options.name.toLowerCase(), xplatFolderName,
281
+ return (0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./${extra}_files`), [
282
+ (0, schematics_1.template)(Object.assign(Object.assign(Object.assign({}, options), (0, xplat_1.getDefaultTemplateOptions)()), { name: options.name.toLowerCase(), relativeDirectory,
283
+ xplatFolderName,
264
284
  // feature: featureName,
265
285
  forSubFolder })),
266
- schematics_1.move(moveTo),
286
+ (0, schematics_1.move)(moveTo),
267
287
  ])));
268
288
  }
269
289
  }
@@ -326,24 +346,24 @@ function adjustBarrelIndex(type, options, indexFilePath, inSubFolder, isBase, im
326
346
  const symbolName = `${xplat_1.stringUtils
327
347
  .sanitize(options.subFolder)
328
348
  .toUpperCase()}_${type.toUpperCase()}S`;
329
- changes.push(...xplat_1.addGlobal(indexSourceFile, indexFilePath, `import { ${symbolName} } from './${options.subFolder}';`), ...ast_1.addToCollection(indexSourceFile, indexFilePath, `...${symbolName}`, ' '));
349
+ changes.push(...(0, xplat_1.addGlobal)(indexSourceFile, indexFilePath, `import { ${symbolName} } from './${options.subFolder}';`), ...(0, ast_1.addToCollection)(indexSourceFile, indexFilePath, `...${symbolName}`, ' '));
330
350
  }
331
351
  else {
332
352
  const symbolName = `${xplat_1.stringUtils.classify(name)}${xplat_1.stringUtils.capitalize(type)}`;
333
- changes.push(...xplat_1.addGlobal(indexSourceFile, indexFilePath, `import { ${symbolName} } from './${inSubFolder ? `${name}/` : ''}${name}.${type}';`), ...ast_1.addToCollection(indexSourceFile, indexFilePath, symbolName, ' '));
353
+ changes.push(...(0, xplat_1.addGlobal)(indexSourceFile, indexFilePath, `import { ${symbolName} } from './${inSubFolder ? `${name}/` : ''}${name}.${type}';`), ...(0, ast_1.addToCollection)(indexSourceFile, indexFilePath, symbolName, ' '));
334
354
  }
335
355
  }
336
356
  if (type === 'component' || type === 'service' || type === 'pipe') {
337
357
  // export symbol from barrel
338
358
  if ((isBase || importIfSubFolder) && options.subFolder) {
339
- changes.push(...xplat_1.addGlobal(indexSourceFile, indexFilePath, `export * from './${options.subFolder}';`, true));
359
+ changes.push(...(0, xplat_1.addGlobal)(indexSourceFile, indexFilePath, `export * from './${options.subFolder}';`, true));
340
360
  }
341
361
  else {
342
362
  const subFolder = inSubFolder ? `${name}/` : '';
343
- changes.push(...xplat_1.addGlobal(indexSourceFile, indexFilePath, `export * from './${subFolder}${name}.${isBase ? 'base-' : ''}${type}';`, true));
363
+ changes.push(...(0, xplat_1.addGlobal)(indexSourceFile, indexFilePath, `export * from './${subFolder}${name}.${isBase ? 'base-' : ''}${type}';`, true));
344
364
  }
345
365
  }
346
- xplat_1.insert(host, indexFilePath, changes);
366
+ (0, xplat_1.insert)(host, indexFilePath, changes);
347
367
  }
348
368
  else {
349
369
  options.needsIndex = true;
@@ -358,8 +378,8 @@ function adjustBarrelIndexForType(type, options, indexFilePath) {
358
378
  const indexSource = host.read(indexFilePath).toString('utf-8');
359
379
  const indexSourceFile = ts.createSourceFile(indexFilePath, indexSource, ts.ScriptTarget.Latest, true);
360
380
  const changes = [];
361
- changes.push(...xplat_1.addGlobal(indexSourceFile, indexFilePath, `export * from './${type}';`, true));
362
- xplat_1.insert(host, indexFilePath, changes);
381
+ changes.push(...(0, xplat_1.addGlobal)(indexSourceFile, indexFilePath, `export * from './${type}';`, true));
382
+ (0, xplat_1.insert)(host, indexFilePath, changes);
363
383
  }
364
384
  else {
365
385
  options.needsIndex = true;
@@ -370,7 +390,7 @@ function adjustBarrelIndexForType(type, options, indexFilePath) {
370
390
  exports.adjustBarrelIndexForType = adjustBarrelIndexForType;
371
391
  function adjustModule(tree, type, options, prefixPath) {
372
392
  let featureName = getFeatureName(options);
373
- const isNxLib = isFeatureNxLib(featureName);
393
+ const isNxLib = xplat_1.XplatHelpers.isFeatureNxLib(featureName);
374
394
  let featurePath;
375
395
  if (isNxLib) {
376
396
  featurePath = getNxFeaturePath(tree, featureName);
@@ -443,10 +463,10 @@ function adjustFeatureModule(type, options, modulePath) {
443
463
  else {
444
464
  if (type !== 'service') {
445
465
  // add to module
446
- changes.push(...xplat_1.addGlobal(moduleSourceFile, modulePath, `import { ${collectionName} } from './${type}s';`));
447
- changes.push(...ast_1.addDeclarationToModule(moduleSourceFile, modulePath, `...${collectionName}`), ...ast_1.addSymbolToNgModuleMetadata(moduleSourceFile, modulePath, 'exports', `...${collectionName}`));
466
+ changes.push(...(0, xplat_1.addGlobal)(moduleSourceFile, modulePath, `import { ${collectionName} } from './${type}s';`));
467
+ changes.push(...(0, ast_1.addDeclarationToModule)(moduleSourceFile, modulePath, `...${collectionName}`), ...(0, ast_1.addSymbolToNgModuleMetadata)(moduleSourceFile, modulePath, 'exports', `...${collectionName}`));
448
468
  }
449
- xplat_1.insert(host, modulePath, changes);
469
+ (0, xplat_1.insert)(host, modulePath, changes);
450
470
  }
451
471
  }
452
472
  return host;
@@ -464,31 +484,31 @@ function adjustFeatureModuleForState(options, modulePath) {
464
484
  const name = options.name.toLowerCase();
465
485
  const changes = [];
466
486
  if (moduleSource.indexOf('StoreModule') === -1) {
467
- changes.push(...xplat_1.addGlobal(moduleSourceFile, modulePath, `import { StoreModule } from '@ngrx/store';`));
487
+ changes.push(...(0, xplat_1.addGlobal)(moduleSourceFile, modulePath, `import { StoreModule } from '@ngrx/store';`));
468
488
  }
469
489
  if (moduleSource.indexOf('EffectsModule') === -1) {
470
- changes.push(...xplat_1.addGlobal(moduleSourceFile, modulePath, `import { EffectsModule } from '@ngrx/effects';`));
490
+ changes.push(...(0, xplat_1.addGlobal)(moduleSourceFile, modulePath, `import { EffectsModule } from '@ngrx/effects';`));
471
491
  }
472
- changes.push(...xplat_1.addGlobal(moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.classify(name)}Effects } from './state/${name}.effects';`), ...xplat_1.addGlobal(moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.camelize(name)}Reducer } from './state/${name}.reducer';`), ...xplat_1.addGlobal(moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.classify(name)}State } from './state/${name}.state';`));
492
+ changes.push(...(0, xplat_1.addGlobal)(moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.classify(name)}Effects } from './state/${name}.effects';`), ...(0, xplat_1.addGlobal)(moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.camelize(name)}Reducer } from './state/${name}.reducer';`), ...(0, xplat_1.addGlobal)(moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.classify(name)}State } from './state/${name}.state';`));
473
493
  if (options.root) {
474
494
  if (moduleSource.indexOf('environments/environment') === -1) {
475
495
  const envFrom = isInLibs
476
496
  ? './environments/environment'
477
- : `@${xplat_utils_1.getNpmScope()}/xplat/core`;
478
- changes.push(...xplat_1.addGlobal(moduleSourceFile, modulePath, `import { environment } from '${envFrom}';`));
497
+ : `@${(0, xplat_utils_1.getNpmScope)()}/xplat/core`;
498
+ changes.push(...(0, xplat_1.addGlobal)(moduleSourceFile, modulePath, `import { environment } from '${envFrom}';`));
479
499
  }
480
- changes.push(...ast_1.addImportToModule(moduleSourceFile, modulePath, `StoreModule.forRoot(
500
+ changes.push(...(0, ast_1.addImportToModule)(moduleSourceFile, modulePath, `StoreModule.forRoot(
481
501
  { ${xplat_1.stringUtils.camelize(name)}: ${xplat_1.stringUtils.camelize(name)}Reducer },
482
502
  {
483
503
  initialState: { ${xplat_1.stringUtils.camelize(name)}: ${xplat_1.stringUtils.classify(name)}State.initialState }
484
504
  }
485
- ), EffectsModule.forRoot([${xplat_1.stringUtils.classify(name)}Effects])`), ...ast_1.addProviderToModule(moduleSourceFile, modulePath, `${xplat_1.stringUtils.classify(name)}Effects`));
505
+ ), EffectsModule.forRoot([${xplat_1.stringUtils.classify(name)}Effects])`), ...(0, ast_1.addProviderToModule)(moduleSourceFile, modulePath, `${xplat_1.stringUtils.classify(name)}Effects`));
486
506
  }
487
507
  else {
488
508
  // feature state
489
- changes.push(...ast_1.addImportToModule(moduleSourceFile, modulePath, `StoreModule.forFeature('${xplat_1.stringUtils.camelize(name)}', ${xplat_1.stringUtils.camelize(name)}Reducer, { initialState: ${xplat_1.stringUtils.classify(name)}State.initialState }), EffectsModule.forFeature([${xplat_1.stringUtils.classify(name)}Effects])`), ...ast_1.addProviderToModule(moduleSourceFile, modulePath, `${xplat_1.stringUtils.classify(name)}Effects`));
509
+ changes.push(...(0, ast_1.addImportToModule)(moduleSourceFile, modulePath, `StoreModule.forFeature('${xplat_1.stringUtils.camelize(name)}', ${xplat_1.stringUtils.camelize(name)}Reducer, { initialState: ${xplat_1.stringUtils.classify(name)}State.initialState }), EffectsModule.forFeature([${xplat_1.stringUtils.classify(name)}Effects])`), ...(0, ast_1.addProviderToModule)(moduleSourceFile, modulePath, `${xplat_1.stringUtils.classify(name)}Effects`));
490
510
  }
491
- xplat_1.insert(host, modulePath, changes);
511
+ (0, xplat_1.insert)(host, modulePath, changes);
492
512
  }
493
513
  return host;
494
514
  };
@@ -513,11 +533,11 @@ function adjustRouting(options, routingModulePaths, platform) {
513
533
  const routingSourceFile = ts.createSourceFile(routingModulePath, routingSource, ts.ScriptTarget.Latest, true);
514
534
  const changes = [];
515
535
  // add component to route config
516
- changes.push(...ast_1.addToCollection(routingSourceFile, routingModulePath, `{
536
+ changes.push(...(0, ast_1.addToCollection)(routingSourceFile, routingModulePath, `{
517
537
  path: '${featureName}',
518
- loadChildren: () => import('./features/${featureName}/${featureName}.module').then(m => m.${xplat_1.stringUtils.classify(featureName)}Module)
538
+ loadChildren: () => import('./features/${options.directory ? options.directory + '/' : ''}${featureName}/${featureName}.module').then(m => m.${xplat_1.stringUtils.classify(featureName)}Module)
519
539
  }`));
520
- xplat_1.insert(host, routingModulePath, changes);
540
+ (0, xplat_1.insert)(host, routingModulePath, changes);
521
541
  }
522
542
  return host;
523
543
  };
@@ -569,7 +589,7 @@ function adjustSandbox(options, platform, appDirectory) {
569
589
  homeTemplate.slice(buttonEndIndex + 9);
570
590
  break;
571
591
  }
572
- workspace_1.createOrUpdate(tree, homeCmpPath, homeTemplate);
592
+ (0, workspace_1.createOrUpdate)(tree, homeCmpPath, homeTemplate);
573
593
  }
574
594
  else {
575
595
  throw new schematics_1.SchematicsException(`The --adjustSandbox option is only supported on the following at the moment: ${xplat_1.supportedSandboxPlatforms}`);
@@ -5,7 +5,7 @@ const path_1 = require("path");
5
5
  const testing_1 = require("@angular-devkit/schematics/testing");
6
6
  // import { createApp, createLib } from '@nrwl/angular/testing';
7
7
  // import { names, toFileName } from '@nrwl/workspace';
8
- const testRunner = new testing_1.SchematicTestRunner('@nstudio/angular', path_1.join(__dirname, '../../collection.json'));
8
+ const testRunner = new testing_1.SchematicTestRunner('@nstudio/angular', (0, path_1.join)(__dirname, '../../collection.json'));
9
9
  function runSchematic(schematicName, options, tree) {
10
10
  return testRunner.runSchematicAsync(schematicName, options, tree).toPromise();
11
11
  }
@@ -1,13 +1,11 @@
1
1
  export declare const xplatVersion = "*";
2
- export declare const nxVersion = "12.6.6";
3
- export declare const angularVersion = "^12.0.0";
4
- export declare const angularDevkitVersion = "^12.0.0";
5
- export declare const ngxTranslateVersion = "~13.0.0";
6
- export declare const ngxTranslateHttpVersion = "~6.0.0";
2
+ export declare const nxVersion = "^13.0.0";
3
+ export declare const angularVersion = "^13.0.0";
4
+ export declare const angularDevkitVersion = "~13.0.0";
5
+ export declare const ngxTranslateVersion = "~14.0.0";
6
+ export declare const ngxTranslateHttpVersion = "~7.0.0";
7
7
  export declare const coreJsVersion = "^3.6.5";
8
- export declare const rxjsVersion = "^6.6.0";
9
- export declare const zonejsVersion = "~0.11.1";
10
- export declare const codelyzerVersion = "~6.0.0";
11
- export declare const jestJasmine2 = "~25.2.0";
12
- export declare const jestPresetAngular = "8.4.0";
13
- export declare const typesJest = "26.0.8";
8
+ export declare const rxjsVersion = "^7.4.0";
9
+ export declare const zonejsVersion = "~0.11.4";
10
+ export declare const jestPresetAngular = "11.0.0";
11
+ export declare const typesJest = "27.0.2";
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typesJest = exports.jestPresetAngular = exports.jestJasmine2 = exports.codelyzerVersion = exports.zonejsVersion = exports.rxjsVersion = exports.coreJsVersion = exports.ngxTranslateHttpVersion = exports.ngxTranslateVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = exports.xplatVersion = void 0;
4
- exports.xplatVersion = '12.6.0-rc.0';
5
- exports.nxVersion = '12.6.6';
6
- exports.angularVersion = '^12.0.0';
7
- exports.angularDevkitVersion = '^12.0.0';
8
- exports.ngxTranslateVersion = '~13.0.0';
9
- exports.ngxTranslateHttpVersion = '~6.0.0';
3
+ exports.typesJest = exports.jestPresetAngular = exports.zonejsVersion = exports.rxjsVersion = exports.coreJsVersion = exports.ngxTranslateHttpVersion = exports.ngxTranslateVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = exports.xplatVersion = void 0;
4
+ exports.xplatVersion = '13.4.0';
5
+ exports.nxVersion = '^13.0.0';
6
+ exports.angularVersion = '^13.0.0';
7
+ exports.angularDevkitVersion = '~13.0.0';
8
+ exports.ngxTranslateVersion = '~14.0.0';
9
+ exports.ngxTranslateHttpVersion = '~7.0.0';
10
10
  exports.coreJsVersion = '^3.6.5';
11
- exports.rxjsVersion = '^6.6.0';
12
- exports.zonejsVersion = '~0.11.1';
13
- exports.codelyzerVersion = '~6.0.0';
14
- exports.jestJasmine2 = '~25.2.0';
15
- exports.jestPresetAngular = '8.4.0';
16
- exports.typesJest = '26.0.8';
11
+ exports.rxjsVersion = '^7.4.0';
12
+ exports.zonejsVersion = '~0.11.4';
13
+ exports.jestPresetAngular = '11.0.0';
14
+ exports.typesJest = '27.0.2';
@@ -9,32 +9,32 @@ const versions_1 = require("./versions");
9
9
  var ComponentHelpers;
10
10
  (function (ComponentHelpers) {
11
11
  function platformGenerator(options, platform) {
12
- const chains = [xplat_utils_1.prerun()];
12
+ const chains = [(0, xplat_utils_1.prerun)()];
13
13
  const componentSettings = xplat_1.XplatComponentHelpers.prepare(options);
14
14
  if (options.onlyProject) {
15
15
  for (const fullProjectPath of componentSettings.projectNames) {
16
- const projectName = xplat_utils_1.parseProjectNameFromPath(fullProjectPath);
16
+ const projectName = (0, xplat_utils_1.parseProjectNameFromPath)(fullProjectPath);
17
17
  const projectParts = projectName.split('-');
18
18
  const platPrefix = projectParts[0];
19
19
  const platSuffix = projectParts.pop();
20
20
  if (platPrefix === platform || platSuffix === platform) {
21
21
  const appDir = platform === 'web' ? '/app' : '';
22
22
  const prefixPath = `apps/${fullProjectPath}/src${appDir}`;
23
- const featurePath = `${prefixPath}/features/${componentSettings.featureName}`;
23
+ const featurePath = `${prefixPath}/features/${componentSettings.directory ? componentSettings.directory + '/' : ''}${componentSettings.featureName}`;
24
24
  const featureModulePath = `${featurePath}/${componentSettings.featureName}.module.ts`;
25
25
  const barrelIndex = `${featurePath}/components/index.ts`;
26
26
  // console.log('will adjustProject:', projectName);
27
27
  chains.push((tree, context) => {
28
28
  if (!tree.exists(featureModulePath)) {
29
- throw new Error(xplat_1.needFeatureModuleError(featureModulePath, componentSettings.featureName, fullProjectPath, true));
29
+ throw new Error((0, xplat_1.needFeatureModuleError)(featureModulePath, componentSettings.featureName, fullProjectPath, true));
30
30
  }
31
- return generator_1.addToFeature('', 'component', options, prefixPath, tree)(tree, context);
31
+ return (0, generator_1.addToFeature)('', 'component', options, prefixPath, tree)(tree, context);
32
32
  });
33
33
  chains.push((tree, context) => {
34
- return generator_1.adjustBarrelIndex('component', options, barrelIndex, true)(tree, context);
34
+ return (0, generator_1.adjustBarrelIndex)('component', options, barrelIndex, true)(tree, context);
35
35
  });
36
36
  chains.push((tree, context) => {
37
- return generator_1.addToFeature('', 'component', options, prefixPath, tree, '_index')(tree, context);
37
+ return (0, generator_1.addToFeature)('', 'component', options, prefixPath, tree, '_index')(tree, context);
38
38
  });
39
39
  }
40
40
  }
@@ -43,31 +43,33 @@ var ComponentHelpers;
43
43
  // add component
44
44
  chains.push((tree, context) => {
45
45
  const xplatFolderName = xplat_1.XplatHelpers.getXplatFoldername(platform, 'angular');
46
- return generator_1.addToFeature(xplatFolderName, 'component', options, `libs/xplat/${xplatFolderName}`, tree, ``, true)(tree, context);
46
+ return (0, generator_1.addToFeature)(xplatFolderName, 'component', options, `libs/xplat/${xplatFolderName}`, tree, ``, true)(tree, context);
47
47
  });
48
48
  if (options.subFolder) {
49
49
  // adjust components barrel for subFolder
50
50
  chains.push((tree, context) => {
51
51
  const xplatFolderName = xplat_1.XplatHelpers.getXplatFoldername(platform, 'angular');
52
- return generator_1.adjustBarrelIndex('component', options, `libs/xplat/${xplatFolderName}/features/src/lib/${componentSettings.featureName}/components/${options.subFolder}/index.ts`, true)(tree, context);
52
+ return (0, generator_1.adjustBarrelIndex)('component', options, `libs/xplat/${xplatFolderName}/features/src/lib/${componentSettings.directory
53
+ ? componentSettings.directory + '/'
54
+ : ''}${componentSettings.featureName}/components/${options.subFolder}/index.ts`, true)(tree, context);
53
55
  });
54
56
  chains.push((tree, context) => {
55
57
  const xplatFolderName = xplat_1.XplatHelpers.getXplatFoldername(platform, 'angular');
56
58
  return options.needsIndex
57
- ? generator_1.addToFeature(xplatFolderName, 'component', options, `libs/xplat/${xplatFolderName}`, tree, '_index', true)(tree, context)
58
- : schematics_1.noop()(tree, context);
59
+ ? (0, generator_1.addToFeature)(xplatFolderName, 'component', options, `libs/xplat/${xplatFolderName}`, tree, '_index', true)(tree, context)
60
+ : (0, schematics_1.noop)()(tree, context);
59
61
  });
60
62
  }
61
63
  // adjust overall components barrel
62
64
  chains.push((tree, context) => {
63
65
  const xplatFolderName = xplat_1.XplatHelpers.getXplatFoldername(platform, 'angular');
64
- return generator_1.adjustBarrelIndex('component', options, `libs/xplat/${xplatFolderName}/features/src/lib/${componentSettings.featureName}/components/index.ts`, true, false, true)(tree, context);
66
+ return (0, generator_1.adjustBarrelIndex)('component', options, `libs/xplat/${xplatFolderName}/features/src/lib/${componentSettings.directory ? componentSettings.directory + '/' : ''}${componentSettings.featureName}/components/index.ts`, true, false, true)(tree, context);
65
67
  });
66
68
  chains.push((tree, context) => {
67
69
  const xplatFolderName = xplat_1.XplatHelpers.getXplatFoldername(platform, 'angular');
68
70
  return options.needsIndex
69
- ? generator_1.addToFeature(xplatFolderName, 'component', options, `libs/xplat/${xplatFolderName}`, tree, '_index')(tree, context)
70
- : schematics_1.noop()(tree, context);
71
+ ? (0, generator_1.addToFeature)(xplatFolderName, 'component', options, `libs/xplat/${xplatFolderName}`, tree, '_index')(tree, context)
72
+ : (0, schematics_1.noop)()(tree, context);
71
73
  });
72
74
  }
73
75
  return chains;
@@ -80,7 +82,7 @@ var XplatAngularHelpers;
80
82
  return (tree, context) => {
81
83
  const dependencies = {};
82
84
  const devDependencies = {};
83
- const packageJson = xplat_utils_1.getJsonFromFile(tree, 'package.json');
85
+ const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json');
84
86
  const hasAngularDeps = packageJson.dependencies['@angular/core'];
85
87
  if (!hasAngularDeps) {
86
88
  dependencies[`@angular/animations`] = versions_1.angularVersion;
@@ -97,7 +99,6 @@ var XplatAngularHelpers;
97
99
  devDependencies[`@angular/compiler-cli`] = versions_1.angularVersion;
98
100
  devDependencies[`@angular/language-service`] = versions_1.angularVersion;
99
101
  devDependencies[`@angular-devkit/build-angular`] = versions_1.angularDevkitVersion;
100
- devDependencies[`codelyzer`] = versions_1.codelyzerVersion;
101
102
  }
102
103
  if (!packageJson.devDependencies['@nrwl/angular']) {
103
104
  packageJson.devDependencies['@nrwl/angular'] = versions_1.nxVersion;
@@ -108,10 +109,10 @@ var XplatAngularHelpers;
108
109
  if (!packageJson.devDependencies['@nstudio/web']) {
109
110
  packageJson.devDependencies['@nstudio/web'] = versions_1.xplatVersion;
110
111
  }
111
- dependencies[`@${xplat_utils_1.getNpmScope()}/xplat-scss`] = 'file:libs/xplat/scss/src';
112
+ dependencies[`@${(0, xplat_utils_1.getNpmScope)()}/xplat-scss`] = 'file:libs/xplat/scss/src';
112
113
  return xplat_1.XplatHelpers.updatePackageForXplat(options, {
113
114
  dependencies: Object.assign(Object.assign({}, dependencies), { '@ngx-translate/core': versions_1.ngxTranslateVersion, '@ngx-translate/http-loader': versions_1.ngxTranslateHttpVersion }),
114
- devDependencies: Object.assign(Object.assign({}, devDependencies), { '@types/jest': versions_1.typesJest, 'jest-jasmine2': versions_1.jestJasmine2, 'jest-preset-angular': versions_1.jestPresetAngular }),
115
+ devDependencies: Object.assign(Object.assign({}, devDependencies), { '@types/jest': versions_1.typesJest, 'jest-preset-angular': versions_1.jestPresetAngular }),
115
116
  })(tree, context);
116
117
  };
117
118
  }
@@ -121,7 +122,7 @@ var XplatAngularHelpers;
121
122
  const chains = [];
122
123
  for (const platform of platforms) {
123
124
  // console.log('angular externalChains:', `@nstudio/${platform}-angular`)
124
- chains.push(schematics_1.externalSchematic(`@nstudio/${platform}-angular`, 'xplat', options, {
125
+ chains.push((0, schematics_1.externalSchematic)(`@nstudio/${platform}-angular`, 'xplat', options, {
125
126
  interactive: false,
126
127
  }));
127
128
  }
@@ -132,15 +133,15 @@ var XplatAngularHelpers;
132
133
  return (tree, context) => {
133
134
  if (libName === 'scss' &&
134
135
  tree.exists(`libs/xplat/${libName}/src/package.json`)) {
135
- return schematics_1.noop()(tree, context);
136
+ return (0, schematics_1.noop)()(tree, context);
136
137
  }
137
138
  else if (tree.exists(`libs/xplat/${libName}/src/lib/index.ts`)) {
138
- return schematics_1.noop()(tree, context);
139
+ return (0, schematics_1.noop)()(tree, context);
139
140
  }
140
141
  const libSrcFolder = `/${libName}/src${libName === 'scss' ? '' : '/lib'}`;
141
- return schematics_1.branchAndMerge(schematics_1.mergeWith(schematics_1.apply(schematics_1.url(`${relativeTo}_files_${libName}`), [
142
- schematics_1.template(Object.assign(Object.assign({}, options), xplat_1.getDefaultTemplateOptions())),
143
- schematics_1.move(`libs/xplat/${libSrcFolder}`),
142
+ return (0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`${relativeTo}_files_${libName}`), [
143
+ (0, schematics_1.template)(Object.assign(Object.assign({}, options), (0, xplat_1.getDefaultTemplateOptions)())),
144
+ (0, schematics_1.move)(`libs/xplat/${libSrcFolder}`),
144
145
  ])))(tree, context);
145
146
  };
146
147
  }