@nstudio/angular 15.0.4-rc.0 → 15.0.4-rc.1

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.
@@ -331,8 +331,7 @@ function adjustBarrel(type, options, prefix) {
331
331
  }
332
332
  exports.adjustBarrel = adjustBarrel;
333
333
  function adjustBarrelIndex(type, options, indexFilePath, inSubFolder, isBase, importIfSubFolder) {
334
- return (host, context) => {
335
- const devKitTree = (0, xplat_1.convertNgTreeToDevKit)(host, context);
334
+ return (host) => {
336
335
  // console.log('adjustBarrelIndex:', indexFilePath);
337
336
  // console.log('host.exists(indexFilePath):', host.exists(indexFilePath));
338
337
  if (host.exists(indexFilePath)) {
@@ -347,46 +346,45 @@ function adjustBarrelIndex(type, options, indexFilePath, inSubFolder, isBase, im
347
346
  const symbolName = `${xplat_1.stringUtils
348
347
  .sanitize(options.subFolder)
349
348
  .toUpperCase()}_${type.toUpperCase()}S`;
350
- changes.push(...(0, xplat_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `import { ${symbolName} } from './${options.subFolder}';`, false), ...(0, ast_1.addToCollection)(devKitTree, indexSourceFile, indexFilePath, `...${symbolName}`, ' '));
349
+ changes.push(...(0, xplat_1.addGlobal)(indexSourceFile, indexFilePath, `import { ${symbolName} } from './${options.subFolder}';`), ...(0, ast_1.addToCollection)(indexSourceFile, indexFilePath, `...${symbolName}`, ' '));
351
350
  }
352
351
  else {
353
352
  const symbolName = `${xplat_1.stringUtils.classify(name)}${xplat_1.stringUtils.capitalize(type)}`;
354
- changes.push(...(0, xplat_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `import { ${symbolName} } from './${inSubFolder ? `${name}/` : ''}${name}.${type}';`), ...(0, ast_1.addToCollection)(devKitTree, 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, ' '));
355
354
  }
356
355
  }
357
356
  if (type === 'component' || type === 'service' || type === 'pipe') {
358
357
  // export symbol from barrel
359
358
  if ((isBase || importIfSubFolder) && options.subFolder) {
360
- changes.push(...(0, xplat_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `export * from './${options.subFolder}';`, true));
359
+ changes.push(...(0, xplat_1.addGlobal)(indexSourceFile, indexFilePath, `export * from './${options.subFolder}';`, true));
361
360
  }
362
361
  else {
363
362
  const subFolder = inSubFolder ? `${name}/` : '';
364
- changes.push(...(0, xplat_1.addGlobal)(devKitTree, 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));
365
364
  }
366
365
  }
367
- // insert(devKitTree.tree, indexFilePath, changes);
366
+ (0, xplat_1.insert)(host, indexFilePath, changes);
368
367
  }
369
368
  else {
370
369
  options.needsIndex = true;
371
370
  }
372
- return devKitTree.tree;
371
+ return host;
373
372
  };
374
373
  }
375
374
  exports.adjustBarrelIndex = adjustBarrelIndex;
376
375
  function adjustBarrelIndexForType(type, options, indexFilePath) {
377
- return (host, context) => {
378
- const devKitTree = (0, xplat_1.convertNgTreeToDevKit)(host, context);
376
+ return (host) => {
379
377
  if (host.exists(indexFilePath)) {
380
378
  const indexSource = host.read(indexFilePath).toString('utf-8');
381
379
  const indexSourceFile = ts.createSourceFile(indexFilePath, indexSource, ts.ScriptTarget.Latest, true);
382
380
  const changes = [];
383
- changes.push(...(0, xplat_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `export * from './${type}';`, true));
384
- // insert(devKitTree.tree, indexFilePath, changes);
381
+ changes.push(...(0, xplat_1.addGlobal)(indexSourceFile, indexFilePath, `export * from './${type}';`, true));
382
+ (0, xplat_1.insert)(host, indexFilePath, changes);
385
383
  }
386
384
  else {
387
385
  options.needsIndex = true;
388
386
  }
389
- return devKitTree.tree;
387
+ return host;
390
388
  };
391
389
  }
392
390
  exports.adjustBarrelIndexForType = adjustBarrelIndexForType;
@@ -415,12 +413,11 @@ function adjustModule(tree, type, options, prefixPath) {
415
413
  }
416
414
  exports.adjustModule = adjustModule;
417
415
  function adjustFeatureModule(type, options, modulePath) {
418
- return (host, context) => {
419
- const devKitTree = (0, xplat_1.convertNgTreeToDevKit)(host, context);
416
+ return (host) => {
420
417
  // console.log('adjustFeatureModule:', modulePath);
421
418
  if (host.exists(modulePath)) {
422
419
  const moduleSource = host.read(modulePath).toString('utf-8');
423
- const moduleSourceFile = (0, ast_1.getTsSourceFile)(devKitTree, modulePath);
420
+ const moduleSourceFile = ts.createSourceFile(modulePath, moduleSource, ts.ScriptTarget.Latest, true);
424
421
  const changes = [];
425
422
  let featureName;
426
423
  if (options.feature) {
@@ -466,19 +463,18 @@ function adjustFeatureModule(type, options, modulePath) {
466
463
  else {
467
464
  if (type !== 'service') {
468
465
  // add to module
469
- changes.push(...(0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { ${collectionName} } from './${type}s';`));
470
- changes.push((0, ast_1.addDeclarationToModule)(devKitTree, moduleSourceFile, modulePath, `...${collectionName}`), (0, ast_1._addSymbolToNgModuleMetadata)(devKitTree, 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}`));
471
468
  }
472
- // insert(devKitTree.tree, modulePath, changes);
469
+ (0, xplat_1.insert)(host, modulePath, changes);
473
470
  }
474
471
  }
475
- return devKitTree.tree;
472
+ return host;
476
473
  };
477
474
  }
478
475
  exports.adjustFeatureModule = adjustFeatureModule;
479
476
  function adjustFeatureModuleForState(options, modulePath) {
480
- return (host, context) => {
481
- const devKitTree = (0, xplat_1.convertNgTreeToDevKit)(host, context);
477
+ return (host) => {
482
478
  // console.log('adjustFeatureModuleForState:', modulePath);
483
479
  if (host.exists(modulePath)) {
484
480
  const moduleSource = host.read(modulePath).toString('utf-8');
@@ -488,39 +484,38 @@ function adjustFeatureModuleForState(options, modulePath) {
488
484
  const name = options.name.toLowerCase();
489
485
  const changes = [];
490
486
  if (moduleSource.indexOf('StoreModule') === -1) {
491
- changes.push(...(0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { StoreModule } from '@ngrx/store';`));
487
+ changes.push(...(0, xplat_1.addGlobal)(moduleSourceFile, modulePath, `import { StoreModule } from '@ngrx/store';`));
492
488
  }
493
489
  if (moduleSource.indexOf('EffectsModule') === -1) {
494
- changes.push(...(0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { EffectsModule } from '@ngrx/effects';`));
490
+ changes.push(...(0, xplat_1.addGlobal)(moduleSourceFile, modulePath, `import { EffectsModule } from '@ngrx/effects';`));
495
491
  }
496
- changes.push(...(0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.classify(name)}Effects } from './state/${name}.effects';`), ...(0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.camelize(name)}Reducer } from './state/${name}.reducer';`), ...(0, xplat_1.addGlobal)(devKitTree, 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';`));
497
493
  if (options.root) {
498
494
  if (moduleSource.indexOf('environments/environment') === -1) {
499
495
  const envFrom = isInLibs
500
496
  ? './environments/environment'
501
497
  : `@${(0, xplat_utils_1.getNpmScope)()}/xplat/core`;
502
- changes.push(...(0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { environment } from '${envFrom}';`));
498
+ changes.push(...(0, xplat_1.addGlobal)(moduleSourceFile, modulePath, `import { environment } from '${envFrom}';`));
503
499
  }
504
- changes.push((0, ast_1.addImportToModule)(devKitTree, moduleSourceFile, modulePath, `StoreModule.forRoot(
500
+ changes.push(...(0, ast_1.addImportToModule)(moduleSourceFile, modulePath, `StoreModule.forRoot(
505
501
  { ${xplat_1.stringUtils.camelize(name)}: ${xplat_1.stringUtils.camelize(name)}Reducer },
506
502
  {
507
503
  initialState: { ${xplat_1.stringUtils.camelize(name)}: ${xplat_1.stringUtils.classify(name)}State.initialState }
508
504
  }
509
- ), EffectsModule.forRoot([${xplat_1.stringUtils.classify(name)}Effects])`), (0, ast_1.addProviderToModule)(devKitTree, 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`));
510
506
  }
511
507
  else {
512
508
  // feature state
513
- changes.push((0, ast_1.addImportToModule)(devKitTree, 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)(devKitTree, 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`));
514
510
  }
515
- // insert(devKitTree.tree, modulePath, changes);
511
+ (0, xplat_1.insert)(host, modulePath, changes);
516
512
  }
517
- return devKitTree.tree;
513
+ return host;
518
514
  };
519
515
  }
520
516
  exports.adjustFeatureModuleForState = adjustFeatureModuleForState;
521
517
  function adjustRouting(options, routingModulePaths, platform) {
522
- return (host, context) => {
523
- const devKitTree = (0, xplat_1.convertNgTreeToDevKit)(host, context);
518
+ return (host) => {
524
519
  const featureName = options.name.toLowerCase();
525
520
  let routingModulePath;
526
521
  // check which routing naming convention might be in use
@@ -538,13 +533,13 @@ function adjustRouting(options, routingModulePaths, platform) {
538
533
  const routingSourceFile = ts.createSourceFile(routingModulePath, routingSource, ts.ScriptTarget.Latest, true);
539
534
  const changes = [];
540
535
  // add component to route config
541
- changes.push(...(0, ast_1.addToCollection)(devKitTree, routingSourceFile, routingModulePath, `{
536
+ changes.push(...(0, ast_1.addToCollection)(routingSourceFile, routingModulePath, `{
542
537
  path: '${featureName}',
543
538
  loadChildren: () => import('./features/${options.directory ? options.directory + '/' : ''}${featureName}/${featureName}.module').then(m => m.${xplat_1.stringUtils.classify(featureName)}Module)
544
539
  }`));
545
- // insert(devKitTree.tree, routingModulePath, changes);
540
+ (0, xplat_1.insert)(host, routingModulePath, changes);
546
541
  }
547
- return devKitTree.tree;
542
+ return host;
548
543
  };
549
544
  }
550
545
  exports.adjustRouting = adjustRouting;
@@ -4,7 +4,8 @@ export declare const angularVersion = "^15.0.0";
4
4
  export declare const angularDevkitVersion = "^15.0.0";
5
5
  export declare const ngxTranslateVersion = "~14.0.0";
6
6
  export declare const ngxTranslateHttpVersion = "~7.0.0";
7
- export declare const rxjsVersion = "^7.5.0";
7
+ export declare const coreJsVersion = "^3.6.5";
8
+ export declare const rxjsVersion = "^7.8.0";
8
9
  export declare const zonejsVersion = "~0.13.0";
9
- export declare const jestPresetAngular = "~13.0.0";
10
+ export declare const jestPresetAngular = "11.0.0";
10
11
  export declare const typesJest = "29.4.0";
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typesJest = exports.jestPresetAngular = exports.zonejsVersion = exports.rxjsVersion = exports.ngxTranslateHttpVersion = exports.ngxTranslateVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = exports.xplatVersion = void 0;
4
- exports.xplatVersion = '15.0.4-rc.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 = '15.0.4-rc.1';
5
5
  exports.nxVersion = '^15.0.0';
6
6
  exports.angularVersion = '^15.0.0';
7
7
  exports.angularDevkitVersion = '^15.0.0';
8
8
  exports.ngxTranslateVersion = '~14.0.0';
9
9
  exports.ngxTranslateHttpVersion = '~7.0.0';
10
- exports.rxjsVersion = '^7.5.0';
10
+ exports.coreJsVersion = '^3.6.5';
11
+ exports.rxjsVersion = '^7.8.0';
11
12
  exports.zonejsVersion = '~0.13.0';
12
- exports.jestPresetAngular = '~13.0.0';
13
+ exports.jestPresetAngular = '11.0.0';
13
14
  exports.typesJest = '29.4.0';
@@ -100,9 +100,8 @@ var XplatAngularHelpers;
100
100
  dependencies[`@angular/platform-browser`] = ngVersion;
101
101
  dependencies[`@angular/platform-browser-dynamic`] = ngVersion;
102
102
  dependencies[`@angular/router`] = ngVersion;
103
- if (!dependencies[`rxjs`]) {
104
- dependencies[`rxjs`] = versions_1.rxjsVersion;
105
- }
103
+ dependencies[`core-js`] = versions_1.coreJsVersion;
104
+ dependencies[`rxjs`] = versions_1.rxjsVersion;
106
105
  dependencies[`zone.js`] = versions_1.zonejsVersion;
107
106
  devDependencies[`@angular/compiler-cli`] = ngVersion;
108
107
  devDependencies[`@angular/language-service`] = ngVersion;
@@ -1,2 +0,0 @@
1
- import { IHelperConfig } from '@nstudio/xplat';
2
- export declare const config: IHelperConfig;
@@ -1,115 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.config = void 0;
4
- const xplat_utils_1 = require("@nstudio/xplat-utils");
5
- exports.config = {
6
- requiresTarget: true,
7
- additionalSupport: applitools,
8
- logNotes: note,
9
- };
10
- function applitools(helperChains, options) {
11
- return (tree, context) => {
12
- // update support index
13
- helperChains.push((0, xplat_utils_1.updateFile)(tree, `/apps/${options.target}-e2e/src/support/index.ts`, updateCypressIndex()));
14
- // update plugin index
15
- helperChains.push((0, xplat_utils_1.updateFile)(tree, `/apps/${options.target}-e2e/src/plugins/index.ts`, updateCypressPlugins()));
16
- // ensure supportFile points to updates
17
- const cypressConfigPath = `/apps/${options.target}-e2e/cypress.json`;
18
- const cypressConfig = (0, xplat_utils_1.getJsonFromFile)(tree, cypressConfigPath);
19
- // console.log('cypressConfig:', cypressConfig);
20
- // plugin path is always defined so ensure support matches
21
- const pluginsFilePath = cypressConfig.pluginsFile;
22
- // console.log('pluginsFilePath:', pluginsFilePath);
23
- const outputPath = pluginsFilePath.split('plugins/')[0];
24
- cypressConfig.supportFile = `${outputPath}support/index.js`;
25
- // console.log('cypressConfig.supportFile:', cypressConfig.supportFile);
26
- helperChains.push((0, xplat_utils_1.updateJsonFile)(tree, cypressConfigPath, cypressConfig));
27
- // Add applitools modules
28
- const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json');
29
- packageJson.devDependencies = packageJson.devDependencies || {};
30
- packageJson.devDependencies['@applitools/eyes-cypress'] = '^3.7.1';
31
- helperChains.push((0, xplat_utils_1.updateJsonFile)(tree, 'package.json', packageJson));
32
- // update sample test
33
- helperChains.push((0, xplat_utils_1.updateFile)(tree, `/apps/${options.target}-e2e/src/integration/app.spec.ts`, updateSampleTest()));
34
- };
35
- }
36
- function note(options) {
37
- if (!(0, xplat_utils_1.isTesting)()) {
38
- console.log(`Applitools support added for: ${options.target}`);
39
- console.log(`Ensure your APPLITOOLS_API_KEY environment variable is set: https://applitools.com/tutorials/cypress.html#step-by-step-guide-run-the-demo-app`);
40
- }
41
- }
42
- function updateCypressIndex() {
43
- return `// ***********************************************************
44
- // This example support/index.js is processed and
45
- // loaded automatically before your test files.
46
- //
47
- // This is a great place to put global configuration and
48
- // behavior that modifies Cypress.
49
- //
50
- // You can change the location of this file or turn off
51
- // automatically serving support files with the
52
- // 'supportFile' configuration option.
53
- //
54
- // You can read more here:
55
- // https://on.cypress.io/configuration
56
- // ***********************************************************
57
-
58
- // Applitools support
59
- import '@applitools/eyes-cypress/commands';
60
-
61
- // Import commands.js using ES2015 syntax:
62
- import './commands';
63
- `;
64
- }
65
- function updateCypressPlugins() {
66
- return `// ***********************************************************
67
- // This example plugins/index.js can be used to load plugins
68
- //
69
- // You can change the location of this file or turn off loading
70
- // the plugins file with the 'pluginsFile' configuration option.
71
- //
72
- // You can read more here:
73
- // https://on.cypress.io/plugins-guide
74
- // ***********************************************************
75
-
76
- // This function is called when a project is opened or re-opened (e.g. due to
77
- // the project's config changing)
78
-
79
- module.exports = (on: any, config: any) => {
80
- // 'on' is used to hook into various events Cypress emits
81
- // 'config' is the resolved Cypress config
82
- };
83
-
84
- // Applitools
85
- require('@applitools/eyes-cypress')(module);
86
- `;
87
- }
88
- function updateSampleTest() {
89
- return `import { getGreeting } from '../support/app.po';
90
- import { eyesOpen, eyesCheckWindow, eyesClose } from '@applitools/eyes-cypress';
91
-
92
- describe('Hello Nx', () => {
93
- beforeEach(() => cy.visit('/'));
94
-
95
- it('should display welcome message', () => {
96
-
97
- // start applitools test
98
- eyesOpen({
99
- appName: 'myapp',
100
- testName: 'Welcome message',
101
- browser: { width: 800, height: 600 },
102
- });
103
-
104
- // check window with applitools
105
- eyesCheckWindow('Main Page');
106
-
107
- // standard cypress testing
108
- getGreeting().contains('Welcome to web-myapp!');
109
-
110
- // end applitools test
111
- eyesClose();
112
- });
113
- });
114
- `;
115
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;AACA,uCAAwC;AAExC,mCAA8B;AAE9B,SAAgB,kBAAkB,CAAC,OAAsB;IACvD,IAAI,CAAC,iBAAS,EAAE,EAAE;QAChB,OAAO,CAAC,GAAG,CAAC,iCAAiC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/D,OAAO,CAAC,GAAG,CAAC,+IAA+I,CAAC,CAAC;KAC9J;AACH,CAAC;AALD,gDAKC"}
@@ -1,2 +0,0 @@
1
- import { IHelperSchema } from '@nstudio/xplat';
2
- export default function (options: IHelperSchema): import("@angular-devkit/schematics").Rule;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const xplat_1 = require("@nstudio/xplat");
4
- const xplat_utils_1 = require("@nstudio/xplat-utils");
5
- const applitools_1 = require("./applitools");
6
- const schematics_1 = require("@angular-devkit/schematics");
7
- const workspace_1 = require("@nrwl/workspace");
8
- const supportedHelpers = {
9
- applitools: applitools_1.config,
10
- };
11
- function default_1(options) {
12
- if (!options.name) {
13
- throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('name', 'Provide the name of the helper to generate.', 'nx g @nstudio/angular:helpers applitools --target=web-myapp'));
14
- }
15
- const helperChain = [];
16
- const helpers = options.name.split(',');
17
- for (const helper of helpers) {
18
- if (supportedHelpers[helper]) {
19
- (0, xplat_1.buildHelperChain)(helper, options, supportedHelpers[helper], helperChain);
20
- }
21
- else {
22
- helperChain.push((0, schematics_1.noop)());
23
- }
24
- }
25
- return (0, schematics_1.chain)([(0, xplat_utils_1.prerun)(options), ...helperChain, (0, workspace_1.addInstallTask)()]);
26
- }
27
- exports.default = default_1;
@@ -1 +0,0 @@
1
- export {};
@@ -1,95 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const schematics_1 = require("@angular-devkit/schematics");
13
- const xplat_utils_1 = require("@nstudio/xplat-utils");
14
- const testing_1 = require("@nstudio/xplat/testing");
15
- const testing_2 = require("../../utils/testing");
16
- (0, xplat_utils_1.setTest)();
17
- xdescribe('helpers schematic', () => {
18
- let appTree;
19
- beforeEach(() => {
20
- appTree = schematics_1.Tree.empty();
21
- appTree = (0, testing_1.createXplatWithApps)(appTree);
22
- });
23
- it('applitools: should create all files', () => __awaiter(void 0, void 0, void 0, function* () {
24
- // const optionsXplat: XPlatOptions = {
25
- // npmScope: 'testing',
26
- // prefix: 'tt',
27
- // platforms: 'web,nativescript'
28
- // };
29
- // appTree = schematicRunner.runSchematic('xplat', optionsXplat, appTree);
30
- const appOptions = {
31
- name: 'foo',
32
- prefix: 'tt',
33
- e2eTestRunner: 'cypress',
34
- useXplat: false,
35
- };
36
- // console.log('appTree:', appTree);
37
- appTree = yield (0, testing_2.runSchematic)('app', appOptions, appTree);
38
- const cypressJsonPath = '/apps/web-foo-e2e/cypress.json';
39
- let fileContent = (0, testing_1.getFileContent)(appTree, cypressJsonPath);
40
- let cypressJson = (0, xplat_utils_1.jsonParse)(fileContent);
41
- expect(cypressJson.supportFile).toBe(false);
42
- const options = {
43
- name: 'applitools',
44
- target: 'web-foo',
45
- };
46
- // console.log('appTree:', appTree);
47
- const tree = yield (0, testing_2.runSchematic)('helpers', options, appTree);
48
- const files = tree.files;
49
- // console.log(files);
50
- expect(files.indexOf('/apps/web-foo-e2e/src/support/index.ts')).toBeGreaterThanOrEqual(0);
51
- expect(files.indexOf('/apps/web-foo-e2e/src/plugins/index.ts')).toBeGreaterThanOrEqual(0);
52
- // modified testing files
53
- let filePath = '/apps/web-foo-e2e/src/support/index.ts';
54
- fileContent = (0, testing_1.getFileContent)(tree, filePath);
55
- // console.log(fileContent);
56
- expect(fileContent.indexOf('@applitools/eyes-cypress/commands')).toBeGreaterThanOrEqual(0);
57
- filePath = '/apps/web-foo-e2e/src/plugins/index.ts';
58
- fileContent = (0, testing_1.getFileContent)(tree, filePath);
59
- // console.log(fileContent);
60
- expect(fileContent.indexOf(`require('@applitools/eyes-cypress')(module);`)).toBeGreaterThanOrEqual(0);
61
- fileContent = (0, testing_1.getFileContent)(tree, cypressJsonPath);
62
- // console.log(fileContent);
63
- cypressJson = (0, xplat_utils_1.jsonParse)(fileContent);
64
- expect(cypressJson.supportFile).toBe(`./src/support/index.js`);
65
- filePath = '/apps/web-foo-e2e/src/integration/app.spec.ts';
66
- fileContent = (0, testing_1.getFileContent)(tree, filePath);
67
- // console.log(fileContent);
68
- expect(fileContent.indexOf(`eyesOpen`)).toBeGreaterThanOrEqual(0);
69
- }));
70
- it('applitools: should throw if target is missing', () => __awaiter(void 0, void 0, void 0, function* () {
71
- // const optionsXplat: XPlatOptions = {
72
- // npmScope: 'testing',
73
- // prefix: 'tt',
74
- // platforms: 'web,nativescript'
75
- // };
76
- // appTree = schematicRunner.runSchematic('xplat', optionsXplat, appTree);
77
- const appOptions = {
78
- name: 'foo',
79
- prefix: 'tt',
80
- e2eTestRunner: 'cypress',
81
- useXplat: false,
82
- };
83
- // console.log('appTree:', appTree);
84
- appTree = yield (0, testing_2.runSchematic)('app', appOptions, appTree);
85
- const cypressJsonPath = '/apps/web-foo-e2e/cypress.json';
86
- let fileContent = (0, testing_1.getFileContent)(appTree, cypressJsonPath);
87
- let cypressJson = (0, xplat_utils_1.jsonParse)(fileContent);
88
- expect(cypressJson.supportFile).toBe(false);
89
- const options = {
90
- name: 'applitools',
91
- };
92
- // console.log('appTree:', appTree);
93
- yield expect((0, testing_2.runSchematic)('helpers', options, appTree)).rejects.toThrow(`The helper "applitools" requires the --target flag.`);
94
- }));
95
- });
@@ -1,22 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "xplat-angular-helpers",
4
- "title": "xplat angular helpers",
5
- "type": "object",
6
- "properties": {
7
- "name": {
8
- "type": "string",
9
- "description": "Comma-delimited list of helpers to generate.",
10
- "alias": "n",
11
- "$default": {
12
- "$source": "argv",
13
- "index": 0
14
- }
15
- },
16
- "target": {
17
- "type": "string",
18
- "description": "Some helpers support targeting to generate the helper for a specific target. ie: nx g @nstudio/angular:helpers applitools --target=web-myapp"
19
- }
20
- },
21
- "required": []
22
- }