@nrwl/angular 14.7.0-beta.1 → 14.7.0-beta.2

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 (99) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/generators.d.ts +2 -0
  3. package/generators.js +2 -0
  4. package/generators.js.map +1 -1
  5. package/generators.json +20 -0
  6. package/package.json +10 -9
  7. package/plugins/component-testing.d.ts +38 -0
  8. package/plugins/component-testing.js +202 -0
  9. package/plugins/component-testing.js.map +1 -0
  10. package/src/generators/component-cypress-spec/component-cypress-spec.js +2 -2
  11. package/src/generators/component-cypress-spec/component-cypress-spec.js.map +1 -1
  12. package/src/generators/component-story/component-story.js +2 -3
  13. package/src/generators/component-story/component-story.js.map +1 -1
  14. package/src/generators/component-story/schema.json +1 -1
  15. package/src/generators/component-test/compat.d.ts +2 -0
  16. package/src/generators/component-test/compat.js +6 -0
  17. package/src/generators/component-test/compat.js.map +1 -0
  18. package/src/generators/component-test/component-test.d.ts +3 -0
  19. package/src/generators/component-test/component-test.js +26 -0
  20. package/src/generators/component-test/component-test.js.map +1 -0
  21. package/src/generators/component-test/files/__componentFileName__.cy.ts__tpl__ +19 -0
  22. package/src/generators/component-test/schema.d.ts +12 -0
  23. package/src/generators/component-test/schema.json +42 -0
  24. package/src/generators/cypress-component-configuration/compat.d.ts +2 -0
  25. package/src/generators/cypress-component-configuration/compat.js +6 -0
  26. package/src/generators/cypress-component-configuration/compat.js.map +1 -0
  27. package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +8 -0
  28. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +87 -0
  29. package/src/generators/cypress-component-configuration/cypress-component-configuration.js.map +1 -0
  30. package/src/generators/cypress-component-configuration/files/cypress.config.ts__tpl__ +6 -0
  31. package/src/generators/cypress-component-configuration/schema.d.ts +6 -0
  32. package/src/generators/cypress-component-configuration/schema.json +34 -0
  33. package/src/generators/host/host.js +4 -1
  34. package/src/generators/host/host.js.map +1 -1
  35. package/src/generators/karma/karma.js +27 -0
  36. package/src/generators/karma/karma.js.map +1 -1
  37. package/src/generators/library/lib/add-children.d.ts +1 -1
  38. package/src/generators/library/lib/add-children.js.map +1 -1
  39. package/src/generators/library/lib/add-lazy-loaded-router-configuration.d.ts +1 -1
  40. package/src/generators/library/lib/add-lazy-loaded-router-configuration.js.map +1 -1
  41. package/src/generators/library/lib/add-load-children.d.ts +1 -1
  42. package/src/generators/library/lib/add-load-children.js.map +1 -1
  43. package/src/generators/library/lib/add-module.d.ts +1 -1
  44. package/src/generators/library/lib/add-module.js.map +1 -1
  45. package/src/generators/library/lib/add-router-configuration.d.ts +1 -1
  46. package/src/generators/library/lib/add-router-configuration.js.map +1 -1
  47. package/src/generators/library/lib/add-standalone-component.d.ts +1 -1
  48. package/src/generators/library/lib/add-standalone-component.js +12 -17
  49. package/src/generators/library/lib/add-standalone-component.js.map +1 -1
  50. package/src/generators/library/lib/enable-strict-type-checking.d.ts +1 -1
  51. package/src/generators/library/lib/enable-strict-type-checking.js.map +1 -1
  52. package/src/generators/library/lib/normalize-options.js +19 -1
  53. package/src/generators/library/lib/normalize-options.js.map +1 -1
  54. package/src/generators/library/lib/normalized-schema.d.ts +54 -14
  55. package/src/generators/library/lib/update-lib-package-npm-scope.d.ts +1 -1
  56. package/src/generators/library/lib/update-lib-package-npm-scope.js.map +1 -1
  57. package/src/generators/library/lib/update-ng-package.d.ts +1 -1
  58. package/src/generators/library/lib/update-ng-package.js.map +1 -1
  59. package/src/generators/library/lib/update-project.d.ts +1 -1
  60. package/src/generators/library/lib/update-project.js.map +1 -1
  61. package/src/generators/library/lib/update-tsconfig.d.ts +1 -1
  62. package/src/generators/library/lib/update-tsconfig.js.map +1 -1
  63. package/src/generators/library/library.js +22 -20
  64. package/src/generators/library/library.js.map +1 -1
  65. package/src/generators/library/schema.d.ts +9 -0
  66. package/src/generators/library/schema.json +52 -0
  67. package/src/generators/remote/remote.js +4 -1
  68. package/src/generators/remote/remote.js.map +1 -1
  69. package/src/generators/setup-mf/lib/add-cypress-workaround.js +1 -1
  70. package/src/generators/setup-mf/lib/add-cypress-workaround.js.map +1 -1
  71. package/src/generators/setup-mf/schema.d.ts +1 -0
  72. package/src/generators/setup-mf/schema.json +5 -0
  73. package/src/generators/setup-mf/setup-mf.js +3 -1
  74. package/src/generators/setup-mf/setup-mf.js.map +1 -1
  75. package/src/generators/stories/stories.js +3 -3
  76. package/src/generators/stories/stories.js.map +1 -1
  77. package/src/generators/{stories/lib → utils/storybook-ast}/component-info.d.ts +0 -0
  78. package/src/generators/{stories/lib → utils/storybook-ast}/component-info.js +0 -0
  79. package/src/generators/utils/storybook-ast/component-info.js.map +1 -0
  80. package/src/generators/{stories/lib → utils/storybook-ast}/entry-point.d.ts +0 -0
  81. package/src/generators/{stories/lib → utils/storybook-ast}/entry-point.js +0 -0
  82. package/src/generators/utils/storybook-ast/entry-point.js.map +1 -0
  83. package/src/generators/{stories/lib → utils/storybook-ast}/module-info.d.ts +0 -0
  84. package/src/generators/{stories/lib → utils/storybook-ast}/module-info.js +0 -0
  85. package/src/generators/utils/storybook-ast/module-info.js.map +1 -0
  86. package/src/generators/utils/{storybook.d.ts → storybook-ast/storybook-inputs.d.ts} +2 -1
  87. package/src/generators/utils/{storybook.js → storybook-ast/storybook-inputs.js} +18 -5
  88. package/src/generators/utils/storybook-ast/storybook-inputs.js.map +1 -0
  89. package/src/generators/{stories/lib → utils/storybook-ast}/tree-utilities.d.ts +0 -0
  90. package/src/generators/{stories/lib → utils/storybook-ast}/tree-utilities.js +0 -0
  91. package/src/generators/utils/storybook-ast/tree-utilities.js.map +1 -0
  92. package/src/generators/component-story/lib/get-args-default-value.d.ts +0 -2
  93. package/src/generators/component-story/lib/get-args-default-value.js +0 -17
  94. package/src/generators/component-story/lib/get-args-default-value.js.map +0 -1
  95. package/src/generators/stories/lib/component-info.js.map +0 -1
  96. package/src/generators/stories/lib/entry-point.js.map +0 -1
  97. package/src/generators/stories/lib/module-info.js.map +0 -1
  98. package/src/generators/stories/lib/tree-utilities.js.map +0 -1
  99. package/src/generators/utils/storybook.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,6 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [14.7.0-beta.1](https://github.com/nrwl/nx/compare/14.6.3...14.7.0-beta.1) (2022-09-06)
6
+ # [14.7.0-beta.2](https://github.com/nrwl/nx/compare/14.6.5...14.7.0-beta.2) (2022-09-08)
7
7
 
8
8
  **Note:** Version bump only for package @nrwl/angular
package/generators.d.ts CHANGED
@@ -25,4 +25,6 @@ export * from './src/generators/stories/stories';
25
25
  export * from './src/generators/storybook-configuration/storybook-configuration';
26
26
  export * from './src/generators/upgrade-module/upgrade-module';
27
27
  export * from './src/generators/web-worker/web-worker';
28
+ export * from './src/generators/cypress-component-configuration/cypress-component-configuration';
29
+ export * from './src/generators/component-test/component-test';
28
30
  export * from './src/utils/test-runners';
package/generators.js CHANGED
@@ -28,5 +28,7 @@ tslib_1.__exportStar(require("./src/generators/stories/stories"), exports);
28
28
  tslib_1.__exportStar(require("./src/generators/storybook-configuration/storybook-configuration"), exports);
29
29
  tslib_1.__exportStar(require("./src/generators/upgrade-module/upgrade-module"), exports);
30
30
  tslib_1.__exportStar(require("./src/generators/web-worker/web-worker"), exports);
31
+ tslib_1.__exportStar(require("./src/generators/cypress-component-configuration/cypress-component-configuration"), exports);
32
+ tslib_1.__exportStar(require("./src/generators/component-test/component-test"), exports);
31
33
  tslib_1.__exportStar(require("./src/utils/test-runners"), exports);
32
34
  //# sourceMappingURL=generators.js.map
package/generators.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"generators.js","sourceRoot":"","sources":["../../../packages/angular/generators.ts"],"names":[],"mappings":";;;AAAA,mFAAyD;AACzD,mFAAyD;AACzD,6GAAmF;AACnF,yGAA+E;AAC/E,2FAAiE;AACjE,+EAAqD;AACrD,6GAAmF;AACnF,6FAAmE;AACnE,qEAA2C;AAC3C,qEAA2C;AAC3C,uFAA6D;AAC7D,uEAA6C;AAC7C,uHAA6F;AAC7F,2EAAiD;AACjD,qEAA2C;AAC3C,qEAA2C;AAC3C,yEAA+C;AAC/C,yFAA+D;AAC/D,+EAAqD;AACrD,iGAAuE;AACvE,qEAA2C;AAC3C,6EAAmD;AACnD,yFAA+D;AAC/D,2EAAiD;AACjD,2GAAiF;AACjF,yFAA+D;AAC/D,iFAAuD;AACvD,mEAAyC"}
1
+ {"version":3,"file":"generators.js","sourceRoot":"","sources":["../../../packages/angular/generators.ts"],"names":[],"mappings":";;;AAAA,mFAAyD;AACzD,mFAAyD;AACzD,6GAAmF;AACnF,yGAA+E;AAC/E,2FAAiE;AACjE,+EAAqD;AACrD,6GAAmF;AACnF,6FAAmE;AACnE,qEAA2C;AAC3C,qEAA2C;AAC3C,uFAA6D;AAC7D,uEAA6C;AAC7C,uHAA6F;AAC7F,2EAAiD;AACjD,qEAA2C;AAC3C,qEAA2C;AAC3C,yEAA+C;AAC/C,yFAA+D;AAC/D,+EAAqD;AACrD,iGAAuE;AACvE,qEAA2C;AAC3C,6EAAmD;AACnD,yFAA+D;AAC/D,2EAAiD;AACjD,2GAAiF;AACjF,yFAA+D;AAC/D,iFAAuD;AACvD,2HAAiG;AACjG,yFAA+D;AAC/D,mEAAyC"}
package/generators.json CHANGED
@@ -33,6 +33,11 @@
33
33
  "schema": "./src/generators/component-story/schema.json",
34
34
  "description": "Creates a `stories.ts` file for a component."
35
35
  },
36
+ "component-test": {
37
+ "factory": "./src/generators/component-test/compat",
38
+ "schema": "./src/generators/component-test/schema.json",
39
+ "description": "Creates a cypress component test file for a component."
40
+ },
36
41
  "convert-tslint-to-eslint": {
37
42
  "factory": "./src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint#conversionSchematic",
38
43
  "schema": "./src/generators/convert-tslint-to-eslint/schema.json",
@@ -146,6 +151,11 @@
146
151
  "schema": "./src/generators/storybook-configuration/schema.json",
147
152
  "description": "Adds Storybook configuration to a project."
148
153
  },
154
+ "cypress-component-configuration": {
155
+ "factory": "./src/generators/cypress-component-configuration/compat",
156
+ "schema": "./src/generators/cypress-component-configuration/schema.json",
157
+ "description": "Setup Cypress component testing for a project."
158
+ },
149
159
  "upgrade-module": {
150
160
  "factory": "./src/generators/upgrade-module/compat",
151
161
  "schema": "./src/generators/upgrade-module/schema.json",
@@ -194,6 +204,11 @@
194
204
  "schema": "./src/generators/component-story/schema.json",
195
205
  "description": "Creates a stories.ts file for a component."
196
206
  },
207
+ "component-test": {
208
+ "factory": "./src/generators/component-test/component-test",
209
+ "schema": "./src/generators/component-test/schema.json",
210
+ "description": "Creates a cypress component test file for a component."
211
+ },
197
212
  "convert-tslint-to-eslint": {
198
213
  "factory": "./src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint#conversionGenerator",
199
214
  "schema": "./src/generators/convert-tslint-to-eslint/schema.json",
@@ -307,6 +322,11 @@
307
322
  "schema": "./src/generators/storybook-configuration/schema.json",
308
323
  "description": "Adds Storybook configuration to a project."
309
324
  },
325
+ "cypress-component-configuration": {
326
+ "factory": "./src/generators/cypress-component-configuration/cypress-component-configuration",
327
+ "schema": "./src/generators/cypress-component-configuration/schema.json",
328
+ "description": "Setup Cypress component testing for a project."
329
+ },
310
330
  "upgrade-module": {
311
331
  "factory": "./src/generators/upgrade-module/upgrade-module",
312
332
  "schema": "./src/generators/upgrade-module/schema.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/angular",
3
- "version": "14.7.0-beta.1",
3
+ "version": "14.7.0-beta.2",
4
4
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Cypress, Karma, and Protractor. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,6 +23,7 @@
23
23
  "./tailwind": "./tailwind.js",
24
24
  "./src/generators/utils": "./src/generators/utils/index.js",
25
25
  "./module-federation": "./module-federation/index.js",
26
+ "./plugins/component-testing": "./plugins/component-testing.js",
26
27
  "./package.json": {
27
28
  "default": "./package.json"
28
29
  },
@@ -65,13 +66,13 @@
65
66
  },
66
67
  "dependencies": {
67
68
  "@angular-devkit/schematics": "~14.2.0",
68
- "@nrwl/cypress": "14.7.0-beta.1",
69
- "@nrwl/devkit": "14.7.0-beta.1",
70
- "@nrwl/jest": "14.7.0-beta.1",
71
- "@nrwl/linter": "14.7.0-beta.1",
72
- "@nrwl/storybook": "14.7.0-beta.1",
73
- "@nrwl/web": "14.7.0-beta.1",
74
- "@nrwl/workspace": "14.7.0-beta.1",
69
+ "@nrwl/cypress": "14.7.0-beta.2",
70
+ "@nrwl/devkit": "14.7.0-beta.2",
71
+ "@nrwl/jest": "14.7.0-beta.2",
72
+ "@nrwl/linter": "14.7.0-beta.2",
73
+ "@nrwl/storybook": "14.7.0-beta.2",
74
+ "@nrwl/web": "14.7.0-beta.2",
75
+ "@nrwl/workspace": "14.7.0-beta.2",
75
76
  "@phenomnomnominal/tsquery": "4.1.1",
76
77
  "@schematics/angular": "~14.2.0",
77
78
  "chalk": "4.1.0",
@@ -95,5 +96,5 @@
95
96
  "fesm2015": "fesm2015/nrwl-angular.mjs",
96
97
  "typings": "index.d.ts",
97
98
  "sideEffects": false,
98
- "gitHead": "9fd9bfc78cee62974407c7f617b233c618988a6a"
99
+ "gitHead": "caec117288560cc7bbaae7a545f332e6dcfc0119"
99
100
  }
@@ -0,0 +1,38 @@
1
+ import { NxComponentTestingOptions } from '@nrwl/cypress/plugins/cypress-preset';
2
+ import type { BrowserBuilderSchema } from '../src/builders/webpack-browser/webpack-browser.impl';
3
+ /**
4
+ * Angular nx preset for Cypress Component Testing
5
+ *
6
+ * This preset contains the base configuration
7
+ * for your component tests that nx recommends.
8
+ * including a devServer that supports nx workspaces.
9
+ * you can easily extend this within your cypress config via spreading the preset
10
+ * @example
11
+ * export default defineConfig({
12
+ * component: {
13
+ * ...nxComponentTestingPreset(__filename)
14
+ * // add your own config here
15
+ * }
16
+ * })
17
+ *
18
+ * @param pathToConfig will be used for loading project options and to construct the output paths for videos and screenshots
19
+ * @param options override options
20
+ */
21
+ export declare function nxComponentTestingPreset(pathToConfig: string, options?: NxComponentTestingOptions): {
22
+ specPattern: string[];
23
+ devServer: {
24
+ options: {
25
+ projectConfig: {
26
+ root: string;
27
+ sourceRoot: string;
28
+ buildOptions: BrowserBuilderSchema;
29
+ };
30
+ };
31
+ framework: "angular";
32
+ bundler: "webpack";
33
+ };
34
+ videosFolder: string;
35
+ screenshotsFolder: string;
36
+ video: boolean;
37
+ chromeWebSecurity: boolean;
38
+ };
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nxComponentTestingPreset = void 0;
4
+ const cypress_preset_1 = require("@nrwl/cypress/plugins/cypress-preset");
5
+ const ct_helpers_1 = require("@nrwl/cypress/src/utils/ct-helpers");
6
+ const devkit_1 = require("@nrwl/devkit");
7
+ const runtime_lint_utils_1 = require("@nrwl/workspace/src/utils/runtime-lint-utils");
8
+ const fs_1 = require("fs");
9
+ const path_1 = require("path");
10
+ /**
11
+ * Angular nx preset for Cypress Component Testing
12
+ *
13
+ * This preset contains the base configuration
14
+ * for your component tests that nx recommends.
15
+ * including a devServer that supports nx workspaces.
16
+ * you can easily extend this within your cypress config via spreading the preset
17
+ * @example
18
+ * export default defineConfig({
19
+ * component: {
20
+ * ...nxComponentTestingPreset(__filename)
21
+ * // add your own config here
22
+ * }
23
+ * })
24
+ *
25
+ * @param pathToConfig will be used for loading project options and to construct the output paths for videos and screenshots
26
+ * @param options override options
27
+ */
28
+ function nxComponentTestingPreset(pathToConfig, options) {
29
+ var _a, _b, _c, _d;
30
+ let graph;
31
+ try {
32
+ graph = (0, devkit_1.readCachedProjectGraph)();
33
+ }
34
+ catch (e) {
35
+ throw new Error(
36
+ // don't want to strip indents so error stack has correct indentation
37
+ `Unable to read the project graph for component testing.
38
+ This is likely due to not running via nx. i.e. 'nx component-test my-project'.
39
+ Please open an issue if this error persists.
40
+ ${e.stack ? e.stack : e}`);
41
+ }
42
+ const ctProjectConfig = (0, cypress_preset_1.getProjectConfigByPath)(graph, pathToConfig);
43
+ const ctConfigurationName = process.env.NX_CYPRESS_TARGET_CONFIGURATION;
44
+ const ctContext = (0, cypress_preset_1.createExecutorContext)(graph, ctProjectConfig.targets, ctProjectConfig.name, (options === null || options === void 0 ? void 0 : options.ctTargetName) || 'component-test', ctConfigurationName);
45
+ const buildTarget = getBuildableTarget(ctContext);
46
+ if (!buildTarget.project && !((_b = (_a = graph.nodes) === null || _a === void 0 ? void 0 : _a[buildTarget.project]) === null || _b === void 0 ? void 0 : _b.data)) {
47
+ throw new Error((0, devkit_1.stripIndents) `Unable to find project configuration for build target.
48
+ Project Name? ${buildTarget.project}
49
+ Has project config? ${!!((_d = (_c = graph.nodes) === null || _c === void 0 ? void 0 : _c[buildTarget.project]) === null || _d === void 0 ? void 0 : _d.data)}`);
50
+ }
51
+ const fromWorkspaceRoot = (0, path_1.relative)(devkit_1.workspaceRoot, pathToConfig);
52
+ const normalizedFromWorkspaceRootPath = (0, fs_1.lstatSync)(pathToConfig).isFile()
53
+ ? (0, path_1.dirname)(fromWorkspaceRoot)
54
+ : fromWorkspaceRoot;
55
+ const offset = (0, devkit_1.offsetFromRoot)(normalizedFromWorkspaceRootPath);
56
+ const buildContext = (0, cypress_preset_1.createExecutorContext)(graph, graph.nodes[buildTarget.project].data.targets, buildTarget.project, buildTarget.target, buildTarget.configuration);
57
+ const buildableProjectConfig = normalizeBuildTargetOptions(buildContext, ctContext, offset);
58
+ return Object.assign(Object.assign({}, (0, cypress_preset_1.nxBaseCypressPreset)(pathToConfig)), {
59
+ // NOTE: cannot use a glob pattern since it will break cypress generated tsconfig.
60
+ specPattern: ['**/*.cy.ts', '**/*.cy.js'], devServer: Object.assign(Object.assign({}, {
61
+ framework: 'angular',
62
+ bundler: 'webpack',
63
+ }), { options: {
64
+ projectConfig: buildableProjectConfig,
65
+ } }) });
66
+ }
67
+ exports.nxComponentTestingPreset = nxComponentTestingPreset;
68
+ function getBuildableTarget(ctContext) {
69
+ var _a;
70
+ const targets = (_a = ctContext.projectGraph.nodes[ctContext.projectName].data) === null || _a === void 0 ? void 0 : _a.targets;
71
+ const targetConfig = targets === null || targets === void 0 ? void 0 : targets[ctContext.targetName];
72
+ if (!targetConfig) {
73
+ throw new Error((0, devkit_1.stripIndents) `Unable to find component testing target configuration in project '${ctContext.projectName}'.
74
+ Has targets? ${!!targets}
75
+ Has target name? ${ctContext.targetName}
76
+ Has ct project name? ${ctContext.projectName}
77
+ `);
78
+ }
79
+ const cypressCtOptions = (0, devkit_1.readTargetOptions)({
80
+ project: ctContext.projectName,
81
+ target: ctContext.targetName,
82
+ configuration: ctContext.configurationName,
83
+ }, ctContext);
84
+ if (!cypressCtOptions.devServerTarget) {
85
+ throw new Error(`Unable to find the 'devServerTarget' executor option in the '${ctContext.targetName}' target of the '${ctContext.projectName}' project`);
86
+ }
87
+ return (0, devkit_1.parseTargetString)(cypressCtOptions.devServerTarget);
88
+ }
89
+ function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
90
+ const options = (0, devkit_1.readTargetOptions)({
91
+ project: buildContext.projectName,
92
+ target: buildContext.targetName,
93
+ configuration: buildContext.configurationName,
94
+ }, buildContext);
95
+ const buildOptions = withSchemaDefaults(options);
96
+ // paths need to be unix paths for angular devkit
97
+ buildOptions.polyfills = (0, devkit_1.joinPathFragments)(offset, buildOptions.polyfills);
98
+ buildOptions.main = (0, devkit_1.joinPathFragments)(offset, buildOptions.main);
99
+ buildOptions.index =
100
+ typeof buildOptions.index === 'string'
101
+ ? (0, devkit_1.joinPathFragments)(offset, buildOptions.index)
102
+ : (buildOptions.index.input = (0, devkit_1.joinPathFragments)(offset, buildOptions.index.input));
103
+ buildOptions.tsConfig = (0, devkit_1.joinPathFragments)(offset, buildOptions.tsConfig);
104
+ buildOptions.fileReplacements = buildOptions.fileReplacements.map((fr) => {
105
+ fr.replace = (0, devkit_1.joinPathFragments)(offset, fr.replace);
106
+ fr.with = (0, devkit_1.joinPathFragments)(offset, fr.with);
107
+ return fr;
108
+ });
109
+ // if the ct project isn't being used in the build project
110
+ // then we don't want to have the assets/scripts/styles be included to
111
+ // prevent inclusion of unintended stuff like tailwind
112
+ if ((0, ct_helpers_1.isCtProjectUsingBuildProject)(ctContext.projectGraph, buildContext.projectName, ctContext.projectName)) {
113
+ buildOptions.assets = buildOptions.assets.map((asset) => {
114
+ return typeof asset === 'string'
115
+ ? (0, devkit_1.joinPathFragments)(offset, asset)
116
+ : (asset.input = (0, devkit_1.joinPathFragments)(offset, asset.input));
117
+ });
118
+ buildOptions.styles = buildOptions.styles.map((style) => {
119
+ return typeof style === 'string'
120
+ ? (0, devkit_1.joinPathFragments)(offset, style)
121
+ : (style.input = (0, devkit_1.joinPathFragments)(offset, style.input));
122
+ });
123
+ buildOptions.scripts = buildOptions.scripts.map((script) => {
124
+ return typeof script === 'string'
125
+ ? (0, devkit_1.joinPathFragments)(offset, script)
126
+ : (script.input = (0, devkit_1.joinPathFragments)(offset, script.input));
127
+ });
128
+ }
129
+ else {
130
+ const stylePath = getTempStylesForTailwind(ctContext);
131
+ buildOptions.styles = stylePath ? [stylePath] : [];
132
+ buildOptions.assets = [];
133
+ buildOptions.scripts = [];
134
+ }
135
+ const { root, sourceRoot } = buildContext.projectGraph.nodes[buildContext.projectName].data;
136
+ return {
137
+ root: (0, devkit_1.joinPathFragments)(offset, root),
138
+ sourceRoot: (0, devkit_1.joinPathFragments)(offset, sourceRoot),
139
+ buildOptions,
140
+ };
141
+ }
142
+ function withSchemaDefaults(options) {
143
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
144
+ if (!options.main) {
145
+ throw new Error('Missing executor options "main"');
146
+ }
147
+ if (!options.index) {
148
+ throw new Error('Missing executor options "index"');
149
+ }
150
+ if (!options.tsConfig) {
151
+ throw new Error('Missing executor options "tsConfig"');
152
+ }
153
+ // cypress defaults aot to false so we cannot use buildOptimizer
154
+ // otherwise the 'buildOptimizer' cannot be used without 'aot' error is thrown
155
+ options.buildOptimizer = false;
156
+ options.aot = false;
157
+ (_a = options.assets) !== null && _a !== void 0 ? _a : (options.assets = []);
158
+ (_b = options.allowedCommonJsDependencies) !== null && _b !== void 0 ? _b : (options.allowedCommonJsDependencies = []);
159
+ (_c = options.budgets) !== null && _c !== void 0 ? _c : (options.budgets = []);
160
+ (_d = options.commonChunk) !== null && _d !== void 0 ? _d : (options.commonChunk = true);
161
+ (_e = options.crossOrigin) !== null && _e !== void 0 ? _e : (options.crossOrigin = 'none');
162
+ (_f = options.deleteOutputPath) !== null && _f !== void 0 ? _f : (options.deleteOutputPath = true);
163
+ (_g = options.extractLicenses) !== null && _g !== void 0 ? _g : (options.extractLicenses = true);
164
+ (_h = options.fileReplacements) !== null && _h !== void 0 ? _h : (options.fileReplacements = []);
165
+ (_j = options.inlineStyleLanguage) !== null && _j !== void 0 ? _j : (options.inlineStyleLanguage = 'css');
166
+ (_k = options.i18nDuplicateTranslation) !== null && _k !== void 0 ? _k : (options.i18nDuplicateTranslation = 'warning');
167
+ (_l = options.outputHashing) !== null && _l !== void 0 ? _l : (options.outputHashing = 'none');
168
+ (_m = options.progress) !== null && _m !== void 0 ? _m : (options.progress = true);
169
+ (_o = options.scripts) !== null && _o !== void 0 ? _o : (options.scripts = []);
170
+ return options;
171
+ }
172
+ /**
173
+ * @returns a path from the workspace root to a temp file containing the base tailwind setup
174
+ * if tailwind is being used in the project root or workspace root
175
+ * this file should get cleaned up via the cypress executor
176
+ */
177
+ function getTempStylesForTailwind(ctExecutorContext) {
178
+ const mappedGraph = (0, runtime_lint_utils_1.mapProjectGraphFiles)(ctExecutorContext.projectGraph);
179
+ const ctProjectConfig = ctExecutorContext.projectGraph.nodes[ctExecutorContext.projectName].data;
180
+ // angular only supports `tailwind.config.{js,cjs}`
181
+ const ctProjectTailwindConfig = (0, path_1.join)(ctProjectConfig.root, 'tailwind.config');
182
+ const isTailWindInCtProject = !!mappedGraph.allFiles[ctProjectTailwindConfig];
183
+ const isTailWindInRoot = !!mappedGraph.allFiles['tailwind.config'];
184
+ if (isTailWindInRoot || isTailWindInCtProject) {
185
+ const pathToStyle = (0, ct_helpers_1.getTempTailwindPath)(ctExecutorContext);
186
+ try {
187
+ (0, fs_1.mkdirSync)((0, path_1.dirname)(pathToStyle), { recursive: true });
188
+ (0, fs_1.writeFileSync)(pathToStyle, `
189
+ @tailwind base;
190
+ @tailwind components;
191
+ @tailwind utilities;
192
+ `, { encoding: 'utf-8' });
193
+ return pathToStyle;
194
+ }
195
+ catch (makeTmpFileError) {
196
+ devkit_1.logger.warn((0, devkit_1.stripIndents) `Issue creating a temp file for tailwind styles. Defaulting to no tailwind setup.
197
+ Temp file path? ${pathToStyle}`);
198
+ devkit_1.logger.error(makeTmpFileError);
199
+ }
200
+ }
201
+ }
202
+ //# sourceMappingURL=component-testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-testing.js","sourceRoot":"","sources":["../../../../packages/angular/plugins/component-testing.ts"],"names":[],"mappings":";;;AAAA,yEAK8C;AAC9C,mEAG4C;AAC5C,yCAYsB;AACtB,qFAAoF;AACpF,2BAAyD;AACzD,+BAA+C;AAG/C;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,wBAAwB,CACtC,YAAoB,EACpB,OAAmC;;IAEnC,IAAI,KAAmB,CAAC;IACxB,IAAI;QACF,KAAK,GAAG,IAAA,+BAAsB,GAAE,CAAC;KAClC;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,KAAK;QACb,qEAAqE;QACrE;;;EAG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AgB,GAAG,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAEnE,IAAI,gBAAgB,IAAI,qBAAqB,EAAE;QAC7C,MAAM,WAAW,GAAG,IAAA,gCAAmB,EAAC,iBAAiB,CAAC,CAAC;QAC3D,IAAI;YACF,IAAA,cAAS,EAAC,IAAA,cAAO,EAAC,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YACrD,IAAA,kBAAa,EACX,WAAW,EACX;;;;CAIP,EACO,EAAE,QAAQ,EAAE,OAAO,EAAE,CACtB,CAAC;YAEF,OAAO,WAAW,CAAC;SACpB;QAAC,OAAO,gBAAgB,EAAE;YACzB,eAAM,CAAC,IAAI,CAAC,IAAA,qBAAY,EAAA;wBACN,WAAW,EAAE,CAAC,CAAC;YACjC,eAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;SAChC;KACF;AACH,CAAC"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.componentCypressSpecGenerator = void 0;
4
4
  const devkit_1 = require("@nrwl/devkit");
5
- const storybook_1 = require("../utils/storybook");
5
+ const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
6
6
  const get_args_default_value_1 = require("./lib/get-args-default-value");
7
7
  const get_component_selector_1 = require("./lib/get-component-selector");
8
8
  function componentCypressSpecGenerator(tree, options) {
@@ -18,7 +18,7 @@ function componentCypressSpecGenerator(tree, options) {
18
18
  return;
19
19
  }
20
20
  const fullComponentPath = (0, devkit_1.joinPathFragments)(projectPath, componentPath, `${componentFileName}.ts`);
21
- const props = (0, storybook_1.getComponentProps)(tree, fullComponentPath, get_args_default_value_1.getArgsDefaultValue);
21
+ const props = (0, storybook_inputs_1.getComponentProps)(tree, fullComponentPath, get_args_default_value_1.getArgsDefaultValue);
22
22
  const componentSelector = (0, get_component_selector_1.getComponentSelector)(tree, fullComponentPath);
23
23
  (0, devkit_1.generateFiles)(tree, templatesDir, destinationDir, {
24
24
  projectName,
@@ -1 +1 @@
1
- {"version":3,"file":"component-cypress-spec.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-cypress-spec/component-cypress-spec.ts"],"names":[],"mappings":";;;AACA,yCAKsB;AACtB,kDAAuD;AACvD,yEAAmE;AACnE,yEAAoE;AAGpE,SAAgB,6BAA6B,CAC3C,IAAU,EACV,OAA6C;IAE7C,MAAM,EACJ,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,GAAG,OAAO,CAAC;IACZ,MAAM,cAAc,GAAG,cAAc,IAAI,GAAG,WAAW,MAAM,CAAC;IAC9D,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC5E,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAC9B,IAAA,0BAAiB,EAAC,IAAI,EAAE,mBAAmB,CAAC,CAC7C,CAAC;IACF,MAAM,2BAA2B,GAAG,IAAA,0BAAiB,EACnD,UAAU,EACV,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CACrC,CAAC;IAEF,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,2BAA2B,EAC3B,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,aAAa,CAC/B,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,0BAAiB,EACjC,cAAc,EACd,GAAG,iBAAiB,IAAI,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAC1D,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC1B,OAAO;KACR;IAED,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EACzC,WAAW,EACX,aAAa,EACb,GAAG,iBAAiB,KAAK,CAC1B,CAAC;IACF,MAAM,KAAK,GAAG,IAAA,6BAAiB,EAAC,IAAI,EAAE,iBAAiB,EAAE,4CAAmB,CAAC,CAAC;IAC9E,MAAM,iBAAiB,GAAG,IAAA,6CAAoB,EAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAExE,IAAA,sBAAa,EAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE;QAChD,WAAW;QACX,iBAAiB;QACjB,aAAa;QACb,iBAAiB;QACjB,KAAK;QACL,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;KAC5C,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACvB,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;KACnB;AACH,CAAC;AAzDD,sEAyDC;AAED,kBAAe,6BAA6B,CAAC"}
1
+ {"version":3,"file":"component-cypress-spec.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-cypress-spec/component-cypress-spec.ts"],"names":[],"mappings":";;;AACA,yCAKsB;AACtB,8EAA4E;AAC5E,yEAAmE;AACnE,yEAAoE;AAGpE,SAAgB,6BAA6B,CAC3C,IAAU,EACV,OAA6C;IAE7C,MAAM,EACJ,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,GAAG,OAAO,CAAC;IACZ,MAAM,cAAc,GAAG,cAAc,IAAI,GAAG,WAAW,MAAM,CAAC;IAC9D,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC5E,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAC9B,IAAA,0BAAiB,EAAC,IAAI,EAAE,mBAAmB,CAAC,CAC7C,CAAC;IACF,MAAM,2BAA2B,GAAG,IAAA,0BAAiB,EACnD,UAAU,EACV,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CACrC,CAAC;IAEF,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,2BAA2B,EAC3B,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,aAAa,CAC/B,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,0BAAiB,EACjC,cAAc,EACd,GAAG,iBAAiB,IAAI,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAC1D,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC1B,OAAO;KACR;IAED,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EACzC,WAAW,EACX,aAAa,EACb,GAAG,iBAAiB,KAAK,CAC1B,CAAC;IACF,MAAM,KAAK,GAAG,IAAA,oCAAiB,EAAC,IAAI,EAAE,iBAAiB,EAAE,4CAAmB,CAAC,CAAC;IAC9E,MAAM,iBAAiB,GAAG,IAAA,6CAAoB,EAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAExE,IAAA,sBAAa,EAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE;QAChD,WAAW;QACX,iBAAiB;QACjB,aAAa;QACb,iBAAiB;QACjB,KAAK;QACL,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;KAC5C,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACvB,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;KACnB;AACH,CAAC;AAzDD,sEAyDC;AAED,kBAAe,6BAA6B,CAAC"}
@@ -2,8 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.componentStoryGenerator = void 0;
4
4
  const devkit_1 = require("@nrwl/devkit");
5
- const storybook_1 = require("../utils/storybook");
6
- const get_args_default_value_1 = require("./lib/get-args-default-value");
5
+ const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
7
6
  function componentStoryGenerator(tree, options) {
8
7
  const { componentFileName, componentName, componentPath, projectPath } = options;
9
8
  const templatesDir = (0, devkit_1.joinPathFragments)(__dirname, 'files');
@@ -12,7 +11,7 @@ function componentStoryGenerator(tree, options) {
12
11
  if (tree.exists(storyFile)) {
13
12
  return;
14
13
  }
15
- const props = (0, storybook_1.getComponentProps)(tree, (0, devkit_1.joinPathFragments)(destinationDir, `${componentFileName}.ts`), get_args_default_value_1.getArgsDefaultValue);
14
+ const props = (0, storybook_inputs_1.getComponentProps)(tree, (0, devkit_1.joinPathFragments)(destinationDir, `${componentFileName}.ts`));
16
15
  (0, devkit_1.generateFiles)(tree, templatesDir, destinationDir, {
17
16
  componentFileName: componentFileName,
18
17
  componentName: componentName,
@@ -1 +1 @@
1
- {"version":3,"file":"component-story.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-story/component-story.ts"],"names":[],"mappings":";;;AACA,yCAA6E;AAC7E,kDAAuD;AACvD,yEAAmE;AAGnE,SAAgB,uBAAuB,CACrC,IAAU,EACV,OAAuC;IAEvC,MAAM,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,GACpE,OAAO,CAAC;IAEV,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,IAAA,0BAAiB,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,IAAA,0BAAiB,EACjC,cAAc,EACd,GAAG,iBAAiB,aAAa,CAClC,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC1B,OAAO;KACR;IAED,MAAM,KAAK,GAAG,IAAA,6BAAiB,EAC7B,IAAI,EACJ,IAAA,0BAAiB,EAAC,cAAc,EAAE,GAAG,iBAAiB,KAAK,CAAC,EAC5D,4CAAmB,CACpB,CAAC;IAEF,IAAA,sBAAa,EAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE;QAChD,iBAAiB,EAAE,iBAAiB;QACpC,aAAa,EAAE,aAAa;QAC5B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,YAAY,KAAK,WAAW,CAAC;QACjE,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACvB,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;KACnB;AACH,CAAC;AAlCD,0DAkCC;AAED,kBAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"component-story.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-story/component-story.ts"],"names":[],"mappings":";;;AACA,yCAA6E;AAC7E,8EAA4E;AAG5E,SAAgB,uBAAuB,CACrC,IAAU,EACV,OAAuC;IAEvC,MAAM,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,GACpE,OAAO,CAAC;IAEV,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,IAAA,0BAAiB,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,IAAA,0BAAiB,EACjC,cAAc,EACd,GAAG,iBAAiB,aAAa,CAClC,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC1B,OAAO;KACR;IAED,MAAM,KAAK,GAAG,IAAA,oCAAiB,EAC7B,IAAI,EACJ,IAAA,0BAAiB,EAAC,cAAc,EAAE,GAAG,iBAAiB,KAAK,CAAC,CAC7D,CAAC;IAEF,IAAA,sBAAa,EAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE;QAChD,iBAAiB,EAAE,iBAAiB;QACpC,aAAa,EAAE,aAAa;QAC5B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,YAAY,KAAK,WAAW,CAAC;QACjE,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACvB,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;KACnB;AACH,CAAC;AAjCD,0DAiCC;AAED,kBAAe,uBAAuB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "NxAngularComponentStoryGenerator",
4
4
  "type": "object",
5
5
  "cli": "nx",
@@ -0,0 +1,2 @@
1
+ declare const _default: (generatorOptions: import("./schema").ComponentTestSchema) => (tree: any, context: any) => Promise<any>;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nrwl/devkit");
4
+ const component_test_1 = require("./component-test");
5
+ exports.default = (0, devkit_1.convertNxGenerator)(component_test_1.componentTestGenerator);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-test/compat.ts"],"names":[],"mappings":";;AAAA,yCAAkD;AAClD,qDAA0D;AAE1D,kBAAe,IAAA,2BAAkB,EAAC,uCAAsB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ import { ComponentTestSchema } from './schema';
3
+ export declare function componentTestGenerator(tree: Tree, options: ComponentTestSchema): void;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.componentTestGenerator = void 0;
4
+ const cypress_version_1 = require("@nrwl/cypress/src/utils/cypress-version");
5
+ const devkit_1 = require("@nrwl/devkit");
6
+ const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
7
+ function componentTestGenerator(tree, options) {
8
+ (0, cypress_version_1.assertMinimumCypressVersion)(10);
9
+ const { root } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
10
+ const componentDirPath = (0, devkit_1.joinPathFragments)(root, options.componentDir);
11
+ const componentFilePath = (0, devkit_1.joinPathFragments)(componentDirPath, `${options.componentFileName}.ts`);
12
+ const componentTestFilePath = (0, devkit_1.joinPathFragments)(componentDirPath, `${options.componentFileName}.cy.ts`);
13
+ if (tree.exists(componentFilePath) && !tree.exists(componentTestFilePath)) {
14
+ const props = (0, storybook_inputs_1.getComponentProps)(tree, componentFilePath, storybook_inputs_1.getArgsDefaultValue, false);
15
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), componentDirPath, {
16
+ componentName: options.componentName,
17
+ componentFileName: options.componentFileName.startsWith('./')
18
+ ? options.componentFileName.slice(2)
19
+ : options.componentFileName,
20
+ props: props.filter((p) => typeof p.defaultValue !== 'undefined'),
21
+ tpl: '',
22
+ });
23
+ }
24
+ }
25
+ exports.componentTestGenerator = componentTestGenerator;
26
+ //# sourceMappingURL=component-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-test.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-test/component-test.ts"],"names":[],"mappings":";;;AAAA,6EAAsF;AACtF,yCAKsB;AACtB,8EAGiD;AAGjD,SAAgB,sBAAsB,CACpC,IAAU,EACV,OAA4B;IAE5B,IAAA,6CAA2B,EAAC,EAAE,CAAC,CAAC;IAChC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,MAAM,gBAAgB,GAAG,IAAA,0BAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACvE,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EACzC,gBAAgB,EAChB,GAAG,OAAO,CAAC,iBAAiB,KAAK,CAClC,CAAC;IACF,MAAM,qBAAqB,GAAG,IAAA,0BAAiB,EAC7C,gBAAgB,EAChB,GAAG,OAAO,CAAC,iBAAiB,QAAQ,CACrC,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE;QACzE,MAAM,KAAK,GAAG,IAAA,oCAAiB,EAC7B,IAAI,EACJ,iBAAiB,EACjB,sCAAmB,EACnB,KAAK,CACN,CAAC;QACF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EACrC,gBAAgB,EAChB;YACE,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC;gBAC3D,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;gBACpC,CAAC,CAAC,OAAO,CAAC,iBAAiB;YAC7B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,YAAY,KAAK,WAAW,CAAC;YACjE,GAAG,EAAE,EAAE;SACR,CACF,CAAC;KACH;AACH,CAAC;AArCD,wDAqCC"}
@@ -0,0 +1,19 @@
1
+ import { MountConfig, mount } from 'cypress/angular';
2
+ import { <%= componentName %> } from './<%= componentFileName %>';
3
+
4
+ describe(<%= componentName %>.name, () => {
5
+ const config: MountConfig<<%= componentName %>> = {
6
+ declarations: [],
7
+ imports: [],
8
+ providers: []
9
+ }
10
+
11
+ it('renders', () => {
12
+ mount(<%= componentName %>,<% if(props.length > 0) { %> {
13
+ ...config,
14
+ componentProperties: {<% for (let prop of props) { %>
15
+ <%= prop.name %>: <%- prop.defaultValue %>,<% } %>
16
+ }
17
+ }<% } else { %> config<% } %>);
18
+ })
19
+ })
@@ -0,0 +1,12 @@
1
+ export interface ComponentTestSchema {
2
+ project: string;
3
+ // SomethingComponent
4
+ componentName: string;
5
+ // path from source root to component dir
6
+ // ./src/lib/something
7
+ componentDir: string;
8
+ // file name without ext
9
+ // something.component
10
+ componentFileName: string;
11
+ skipFormat?: boolean;
12
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxAngularComponentTestGenerator",
4
+ "type": "object",
5
+ "cli": "nx",
6
+ "description": "Create a `*.cy.ts` file for Cypress component testing for an Angular component.",
7
+ "properties": {
8
+ "project": {
9
+ "type": "string",
10
+ "description": "The name of the project where the component is located.",
11
+ "x-dropdown": "projects",
12
+ "x-prompt": "What project is the component located in?"
13
+ },
14
+ "componentName": {
15
+ "type": "string",
16
+ "description": "Class name of the component to create a test for.",
17
+ "examples": ["MyFancyButtonComponent"]
18
+ },
19
+ "componentDir": {
20
+ "type": "string",
21
+ "description": "Relative path to the folder that contains the component from the project root.",
22
+ "example": ["src/lib/my-fancy-button"]
23
+ },
24
+ "componentFileName": {
25
+ "type": "string",
26
+ "description": "File name that contains the component without the `.ts` extension.",
27
+ "examples": ["my-fancy-button.component"]
28
+ },
29
+ "skipFormat": {
30
+ "description": "Skip formatting files.",
31
+ "type": "boolean",
32
+ "default": false
33
+ }
34
+ },
35
+ "additionalProperties": false,
36
+ "required": [
37
+ "projectPath",
38
+ "componentName",
39
+ "componentPath",
40
+ "componentFileName"
41
+ ]
42
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (generatorOptions: import("./schema").CypressComponentConfigSchema) => (tree: any, context: any) => Promise<any>;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nrwl/devkit");
4
+ const cypress_component_configuration_1 = require("./cypress-component-configuration");
5
+ exports.default = (0, devkit_1.convertNxGenerator)(cypress_component_configuration_1.cypressComponentConfiguration);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/cypress-component-configuration/compat.ts"],"names":[],"mappings":";;AAAA,yCAAkD;AAClD,uFAAkF;AAElF,kBAAe,IAAA,2BAAkB,EAAC,+DAA6B,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ import { CypressComponentConfigSchema } from './schema';
3
+ /**
4
+ * This is for cypress built in component testing, if you want to test with
5
+ * storybook + cypress then use the componentCypressGenerator instead.
6
+ */
7
+ export declare function cypressComponentConfiguration(tree: Tree, options: CypressComponentConfigSchema): Promise<() => void>;
8
+ export default cypressComponentConfiguration;