@nx/angular 16.8.0-beta.3 → 16.8.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mf/mf.js +31 -36
- package/migrations.json +9 -0
- package/package.json +11 -11
- package/plugins/component-testing.js +82 -44
- package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.js +4 -6
- package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +4 -6
- package/src/builders/utilities/buildable-libs.js +1 -2
- package/src/builders/utilities/module-federation.js +2 -3
- package/src/builders/utilities/webpack.js +16 -21
- package/src/builders/webpack-browser/webpack-browser.impl.js +13 -13
- package/src/builders/webpack-dev-server/lib/normalize-options.js +8 -1
- package/src/builders/webpack-dev-server/webpack-dev-server.impl.js +24 -18
- package/src/builders/webpack-server/webpack-server.impl.js +5 -7
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +19 -23
- package/src/executors/browser-esbuild/lib/buildable-libs.js +1 -2
- package/src/executors/delegate-build/delegate-build.impl.js +9 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +4 -7
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.transform.js +4 -5
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-package.transform.js +158 -156
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/options.di.js +6 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js +118 -118
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.js +20 -12
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +18 -21
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +6 -9
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +6 -3
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +122 -122
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
- package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.js +21 -13
- package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.js +5 -8
- package/src/executors/package/package.impl.js +33 -38
- package/src/executors/utilities/angular-version-utils.js +1 -1
- package/src/executors/utilities/tailwindcss.js +2 -2
- package/src/executors/utilities/typescript.js +23 -28
- package/src/generators/add-linting/add-linting.js +76 -69
- package/src/generators/add-linting/lib/add-angular-eslint-dependencies.js +2 -0
- package/src/generators/add-linting/lib/create-eslint-configuration.js +12 -4
- package/src/generators/application/application.js +56 -55
- package/src/generators/application/lib/add-e2e.js +36 -40
- package/src/generators/application/lib/add-linting.js +12 -15
- package/src/generators/application/lib/add-proxy-config.js +4 -1
- package/src/generators/application/lib/add-unit-test-runner.js +15 -18
- package/src/generators/application/lib/create-files.js +44 -47
- package/src/generators/application/lib/enable-strict-type-checking.js +2 -2
- package/src/generators/application/lib/normalize-options.js +37 -25
- package/src/generators/application/lib/set-app-strict-default.js +1 -2
- package/src/generators/application/lib/update-editor-tsconfig.js +1 -2
- package/src/generators/component/component.js +40 -43
- package/src/generators/component/lib/normalize-options.js +15 -5
- package/src/generators/component-cypress-spec/component-cypress-spec.js +25 -28
- package/src/generators/component-story/component-story.js +19 -22
- package/src/generators/convert-to-with-mf/convert-to-with-mf.js +19 -22
- package/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +3 -4
- package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +103 -106
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +59 -62
- package/src/generators/directive/directive.js +21 -24
- package/src/generators/directive/lib/normalize-options.js +11 -5
- package/src/generators/host/files/src/main.server.ts__tmpl__ +1 -1
- package/src/generators/host/host.js +77 -67
- package/src/generators/host/lib/add-ssr.js +32 -33
- package/src/generators/init/init.js +101 -92
- package/src/generators/library/lib/add-standalone-component.js +18 -13
- package/src/generators/library/lib/enable-strict-type-checking.js +17 -5
- package/src/generators/library/lib/normalize-options.js +68 -53
- package/src/generators/library/library.js +89 -92
- package/src/generators/library-secondary-entry-point/lib/add-files.js +5 -1
- package/src/generators/library-secondary-entry-point/lib/normalize-options.js +6 -3
- package/src/generators/library-secondary-entry-point/lib/update-linting-file-patterns.js +1 -2
- package/src/generators/library-secondary-entry-point/library-secondary-entry-point.js +6 -9
- package/src/generators/move/lib/normalize-schema.js +5 -1
- package/src/generators/move/lib/update-module-name.js +1 -1
- package/src/generators/move/lib/update-ng-package.js +1 -2
- package/src/generators/move/lib/update-secondary-entry-points.js +1 -2
- package/src/generators/move/move.js +9 -12
- package/src/generators/ng-add/migrate-from-angular-cli.js +54 -53
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +4 -3
- package/src/generators/ng-add/migrators/builders/angular-devkit-ng-packagr.migrator.js +11 -12
- package/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +39 -42
- package/src/generators/ng-add/migrators/builders/builder.migrator.js +1 -2
- package/src/generators/ng-add/migrators/migrator.js +7 -11
- package/src/generators/ng-add/migrators/projects/app.migrator.js +39 -43
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +115 -91
- package/src/generators/ng-add/migrators/projects/lib.migrator.js +23 -31
- package/src/generators/ng-add/migrators/projects/project.migrator.js +10 -14
- package/src/generators/ng-add/ng-add.js +5 -8
- package/src/generators/ng-add/utilities/dependencies.js +2 -3
- package/src/generators/ng-add/utilities/format-files-task.js +1 -1
- package/src/generators/ng-add/utilities/projects.js +1 -1
- package/src/generators/ng-add/utilities/workspace.js +25 -36
- package/src/generators/ngrx/lib/add-imports-to-module.js +1 -2
- package/src/generators/ngrx/lib/add-ngrx-to-package-json.js +1 -3
- package/src/generators/ngrx/lib/generate-files.js +11 -2
- package/src/generators/ngrx/lib/normalize-options.js +9 -4
- package/src/generators/ngrx/lib/validate-options.js +3 -3
- package/src/generators/ngrx/ngrx.js +18 -21
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.actions.ts__tmpl__ +1 -1
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.spec.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.spec.ts__tmpl__ +6 -6
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.spec.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.spec.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.ts__tmpl__ +1 -1
- package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/lib/add-exports-barrel.js +4 -1
- package/src/generators/ngrx-feature-store/lib/add-imports.js +1 -1
- package/src/generators/ngrx-feature-store/lib/add-ngrx-to-package-json.js +1 -3
- package/src/generators/ngrx-feature-store/lib/generate-files.js +20 -4
- package/src/generators/ngrx-feature-store/lib/normalize-options.d.ts +1 -0
- package/src/generators/ngrx-feature-store/lib/normalize-options.js +22 -3
- package/src/generators/ngrx-feature-store/lib/validate-options.js +2 -2
- package/src/generators/ngrx-feature-store/ngrx-feature-store.js +18 -21
- package/src/generators/ngrx-root-store/lib/add-ngrx-to-package-json.js +8 -6
- package/src/generators/ngrx-root-store/lib/normalize-options.js +8 -4
- package/src/generators/ngrx-root-store/lib/validate-options.js +2 -2
- package/src/generators/ngrx-root-store/ngrx-root-store.js +27 -30
- package/src/generators/pipe/lib/normalize-options.js +9 -3
- package/src/generators/pipe/pipe.js +21 -24
- package/src/generators/remote/files/base/src/main.server.ts__tmpl__ +2 -2
- package/src/generators/remote/lib/add-ssr.js +46 -43
- package/src/generators/remote/lib/find-next-available-port.js +1 -2
- package/src/generators/remote/remote.js +52 -49
- package/src/generators/scam/lib/convert-component-to-scam.js +1 -2
- package/src/generators/scam/lib/normalize-options.js +11 -4
- package/src/generators/scam/scam.js +15 -12
- package/src/generators/scam-directive/lib/normalize-options.js +12 -4
- package/src/generators/scam-directive/scam-directive.js +13 -10
- package/src/generators/scam-pipe/lib/normalize-options.js +12 -4
- package/src/generators/scam-pipe/scam-pipe.js +13 -10
- package/src/generators/scam-to-standalone/scam-to-standalone.js +23 -26
- package/src/generators/setup-mf/lib/add-cypress-workaround.js +1 -1
- package/src/generators/setup-mf/lib/add-remote-to-host.js +4 -1
- package/src/generators/setup-mf/lib/change-build-target.js +10 -4
- package/src/generators/setup-mf/lib/generate-config.js +1 -1
- package/src/generators/setup-mf/lib/get-remotes-with-ports.js +1 -2
- package/src/generators/setup-mf/lib/normalize-options.js +5 -2
- package/src/generators/setup-mf/lib/set-tsconfig-target.js +7 -1
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +1 -2
- package/src/generators/setup-mf/lib/setup-serve-target.js +10 -3
- package/src/generators/setup-mf/setup-mf.js +32 -35
- package/src/generators/setup-ssr/lib/generate-files.js +8 -5
- package/src/generators/setup-ssr/lib/normalize-options.js +9 -10
- package/src/generators/setup-ssr/lib/update-project-config.js +21 -17
- package/src/generators/setup-ssr/setup-ssr.js +26 -27
- package/src/generators/setup-tailwind/lib/add-tailwind-config-path-to-project.js +6 -4
- package/src/generators/setup-tailwind/lib/detect-tailwind-installed-version.js +1 -2
- package/src/generators/setup-tailwind/lib/normalize-options.js +4 -1
- package/src/generators/setup-tailwind/lib/update-application-styles.js +5 -6
- package/src/generators/setup-tailwind/setup-tailwind.js +20 -23
- package/src/generators/stories/lib/get-e2e-project.js +1 -1
- package/src/generators/stories/stories.js +43 -50
- package/src/generators/storybook-configuration/lib/assert-compatible-storybook-version.js +1 -1
- package/src/generators/storybook-configuration/lib/generate-stories.js +10 -13
- package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +12 -15
- package/src/generators/storybook-configuration/storybook-configuration.js +20 -16
- package/src/generators/utils/create-ts-config.js +1 -1
- package/src/generators/utils/entry-point.js +1 -2
- package/src/generators/utils/export-scam.js +1 -1
- package/src/generators/utils/insert-ngmodule-import.js +1 -1
- package/src/generators/utils/path.js +3 -3
- package/src/generators/utils/project.js +2 -3
- package/src/generators/utils/selector.js +1 -1
- package/src/generators/utils/storybook-ast/component-info.js +1 -2
- package/src/generators/utils/storybook-ast/entry-point.js +1 -2
- package/src/generators/utils/storybook-ast/module-info.js +1 -2
- package/src/generators/utils/storybook-ast/tree-utilities.js +1 -1
- package/src/generators/utils/testing.js +141 -138
- package/src/generators/utils/validations.js +1 -1
- package/src/generators/utils/version-utils.js +5 -7
- package/src/generators/web-worker/lib/normalize-options.js +6 -3
- package/src/generators/web-worker/web-worker.js +25 -28
- package/src/migrations/update-14-2-0/remove-show-circular-dependencies-option.js +10 -13
- package/src/migrations/update-14-2-0/update-angular-cli.js +14 -18
- package/src/migrations/update-14-2-0/update-libraries-secondary-entrypoints.js +22 -26
- package/src/migrations/update-14-2-0/update-ngcc-target.js +10 -14
- package/src/migrations/update-14-2-0/update-router-initial-navigation.js +31 -39
- package/src/migrations/update-14-2-0/update-tsconfig-target.js +48 -56
- package/src/migrations/update-14-5-0/migrate-mfe-to-mf.js +14 -17
- package/src/migrations/update-14-5-2/update-angular-cli.js +14 -18
- package/src/migrations/update-14-6-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-0-0/add-karma-inputs.js +27 -32
- package/src/migrations/update-15-0-0/switch-to-jasmine-marbles.js +62 -68
- package/src/migrations/update-15-2-0/remove-browserlist-config.js +34 -37
- package/src/migrations/update-15-2-0/remove-platform-server-exports.js +49 -52
- package/src/migrations/update-15-2-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-2-0/update-karma-main-file.js +11 -12
- package/src/migrations/update-15-2-0/update-typescript-target.js +40 -39
- package/src/migrations/update-15-2-0/update-workspace-config.js +16 -19
- package/src/migrations/update-15-5-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-7-0/install-required-packages.js +26 -28
- package/src/migrations/update-15-8-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-9-0/update-file-server-executor.js +31 -35
- package/src/migrations/update-15-9-0/update-testing-tsconfig.js +17 -22
- package/src/migrations/update-16-0-0/remove-karma-defaults.js +15 -18
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +22 -25
- package/src/migrations/update-16-0-0/remove-protractor-defaults.js +15 -18
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +38 -42
- package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +15 -19
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +49 -52
- package/src/migrations/update-16-1-0/update-angular-cli.js +14 -18
- package/src/migrations/update-16-1-0/update-server-executor-config.js +13 -16
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +25 -29
- package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.js +13 -16
- package/src/migrations/update-16-4-0/update-angular-cli.js +14 -18
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +19 -24
- package/src/migrations/update-16-7-0/update-angular-cli.js +14 -18
- package/src/migrations/utils/projects.js +9 -15
- package/src/utils/backward-compatible-versions.js +2 -0
- package/src/utils/get-mf-projects.js +1 -2
- package/src/utils/mf/utils.js +43 -44
- package/src/utils/mf/with-module-federation-ssr.js +39 -24
- package/src/utils/mf/with-module-federation.js +40 -21
- package/src/utils/nx-devkit/ast-utils.js +2 -3
- package/src/utils/nx-devkit/testing.js +9 -9
- package/src/utils/version-utils.js +2 -4
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.js +2 -1
|
@@ -1,53 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const utils_1 = require("../utils");
|
|
7
6
|
const lib_1 = require("./lib");
|
|
8
|
-
function componentGenerator(tree, rawOptions) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
tpl: '',
|
|
29
|
-
});
|
|
30
|
-
if (options.skipTests) {
|
|
31
|
-
const pathToSpecFile = (0, devkit_1.joinPathFragments)(options.directory, `${componentNames.fileName}.${typeNames.fileName}.spec.ts`);
|
|
32
|
-
tree.delete(pathToSpecFile);
|
|
33
|
-
}
|
|
34
|
-
if (options.inlineTemplate) {
|
|
35
|
-
const pathToTemplateFile = (0, devkit_1.joinPathFragments)(options.directory, `${componentNames.fileName}.${typeNames.fileName}.html`);
|
|
36
|
-
tree.delete(pathToTemplateFile);
|
|
37
|
-
}
|
|
38
|
-
if (options.inlineStyle) {
|
|
39
|
-
const pathToStyleFile = (0, devkit_1.joinPathFragments)(options.directory, `${componentNames.fileName}.${typeNames.fileName}.${options.style}`);
|
|
40
|
-
tree.delete(pathToStyleFile);
|
|
41
|
-
}
|
|
42
|
-
if (!options.skipImport && !options.standalone) {
|
|
43
|
-
const modulePath = (0, lib_1.findModuleFromOptions)(tree, options, options.projectRoot);
|
|
44
|
-
(0, utils_1.addToNgModule)(tree, options.path, modulePath, componentNames.fileName, `${componentNames.className}${typeNames.className}`, `${componentNames.fileName}.${typeNames.fileName}`, 'declarations', options.flat, options.export);
|
|
45
|
-
}
|
|
46
|
-
(0, lib_1.exportComponentInEntryPoint)(tree, options);
|
|
47
|
-
if (!options.skipFormat) {
|
|
48
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
49
|
-
}
|
|
7
|
+
async function componentGenerator(tree, rawOptions) {
|
|
8
|
+
(0, lib_1.validateOptions)(tree, rawOptions);
|
|
9
|
+
const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
10
|
+
const componentNames = (0, devkit_1.names)(options.name);
|
|
11
|
+
const typeNames = (0, devkit_1.names)(options.type);
|
|
12
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), options.directory, {
|
|
13
|
+
fileName: componentNames.fileName,
|
|
14
|
+
className: componentNames.className,
|
|
15
|
+
type: typeNames.fileName,
|
|
16
|
+
typeClassName: typeNames.className,
|
|
17
|
+
style: options.style,
|
|
18
|
+
inlineStyle: options.inlineStyle,
|
|
19
|
+
inlineTemplate: options.inlineTemplate,
|
|
20
|
+
standalone: options.standalone,
|
|
21
|
+
skipSelector: options.skipSelector,
|
|
22
|
+
changeDetection: options.changeDetection,
|
|
23
|
+
viewEncapsulation: options.viewEncapsulation,
|
|
24
|
+
displayBlock: options.displayBlock,
|
|
25
|
+
selector: options.selector,
|
|
26
|
+
tpl: '',
|
|
50
27
|
});
|
|
28
|
+
if (options.skipTests) {
|
|
29
|
+
const pathToSpecFile = (0, devkit_1.joinPathFragments)(options.directory, `${componentNames.fileName}.${typeNames.fileName}.spec.ts`);
|
|
30
|
+
tree.delete(pathToSpecFile);
|
|
31
|
+
}
|
|
32
|
+
if (options.inlineTemplate) {
|
|
33
|
+
const pathToTemplateFile = (0, devkit_1.joinPathFragments)(options.directory, `${componentNames.fileName}.${typeNames.fileName}.html`);
|
|
34
|
+
tree.delete(pathToTemplateFile);
|
|
35
|
+
}
|
|
36
|
+
if (options.style === 'none' || options.inlineStyle) {
|
|
37
|
+
const pathToStyleFile = (0, devkit_1.joinPathFragments)(options.directory, `${componentNames.fileName}.${typeNames.fileName}.${options.style}`);
|
|
38
|
+
tree.delete(pathToStyleFile);
|
|
39
|
+
}
|
|
40
|
+
if (!options.skipImport && !options.standalone) {
|
|
41
|
+
const modulePath = (0, lib_1.findModuleFromOptions)(tree, options, options.projectRoot);
|
|
42
|
+
(0, utils_1.addToNgModule)(tree, options.path, modulePath, componentNames.fileName, `${componentNames.className}${typeNames.className}`, `${componentNames.fileName}.${typeNames.fileName}`, 'declarations', options.flat, options.export);
|
|
43
|
+
}
|
|
44
|
+
(0, lib_1.exportComponentInEntryPoint)(tree, options);
|
|
45
|
+
if (!options.skipFormat) {
|
|
46
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
47
|
+
}
|
|
51
48
|
}
|
|
52
49
|
exports.componentGenerator = componentGenerator;
|
|
53
50
|
exports.default = componentGenerator;
|
|
@@ -5,13 +5,23 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const path_1 = require("../../utils/path");
|
|
6
6
|
const selector_1 = require("../../utils/selector");
|
|
7
7
|
function normalizeOptions(tree, options) {
|
|
8
|
-
|
|
9
|
-
(_a = options.type) !== null && _a !== void 0 ? _a : (options.type = 'component');
|
|
8
|
+
options.type ??= 'component';
|
|
10
9
|
const { directory, filePath, name, path, root, sourceRoot } = (0, path_1.normalizeNameAndPaths)(tree, options);
|
|
11
10
|
const { prefix } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
12
|
-
const selector =
|
|
13
|
-
|
|
11
|
+
const selector = options.selector ??
|
|
12
|
+
(0, selector_1.buildSelector)(tree, name, options.prefix, prefix, 'fileName');
|
|
13
|
+
return {
|
|
14
|
+
...options,
|
|
15
|
+
name,
|
|
16
|
+
changeDetection: options.changeDetection ?? 'Default',
|
|
17
|
+
style: options.style ?? 'css',
|
|
18
|
+
flat: options.flat ?? false,
|
|
19
|
+
directory,
|
|
14
20
|
filePath,
|
|
15
|
-
path,
|
|
21
|
+
path,
|
|
22
|
+
projectSourceRoot: sourceRoot,
|
|
23
|
+
projectRoot: root,
|
|
24
|
+
selector,
|
|
25
|
+
};
|
|
16
26
|
}
|
|
17
27
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentCypressSpecGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
|
|
7
6
|
const get_args_default_value_1 = require("./lib/get-args-default-value");
|
|
8
7
|
const get_component_selector_1 = require("./lib/get-component-selector");
|
|
9
|
-
function componentCypressSpecGenerator(tree, options) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
fileExt: isCypressV10 ? 'cy.ts' : 'spec.ts',
|
|
32
|
-
});
|
|
33
|
-
if (!options.skipFormat) {
|
|
34
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
35
|
-
}
|
|
8
|
+
async function componentCypressSpecGenerator(tree, options) {
|
|
9
|
+
const { cypressProject, projectName, projectPath, componentPath, componentFileName, componentName, specDirectory, } = options;
|
|
10
|
+
const e2eProjectName = cypressProject || `${projectName}-e2e`;
|
|
11
|
+
const { sourceRoot, root } = (0, devkit_1.readProjectConfiguration)(tree, e2eProjectName);
|
|
12
|
+
const isCypressV10 = tree.exists((0, devkit_1.joinPathFragments)(root, 'cypress.config.ts'));
|
|
13
|
+
const e2eLibIntegrationFolderPath = (0, devkit_1.joinPathFragments)(sourceRoot, isCypressV10 ? 'e2e' : 'integration');
|
|
14
|
+
const templatesDir = (0, devkit_1.joinPathFragments)(__dirname, 'files');
|
|
15
|
+
const destinationDir = (0, devkit_1.joinPathFragments)(e2eLibIntegrationFolderPath, specDirectory ?? componentPath);
|
|
16
|
+
const storyFile = (0, devkit_1.joinPathFragments)(destinationDir, `${componentFileName}.${isCypressV10 ? 'cy' : 'spec'}.ts`);
|
|
17
|
+
if (tree.exists(storyFile)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const fullComponentPath = (0, devkit_1.joinPathFragments)(projectPath, componentPath, `${componentFileName}.ts`);
|
|
21
|
+
const props = (0, storybook_inputs_1.getComponentProps)(tree, fullComponentPath, get_args_default_value_1.getArgsDefaultValue);
|
|
22
|
+
const componentSelector = (0, get_component_selector_1.getComponentSelector)(tree, fullComponentPath);
|
|
23
|
+
(0, devkit_1.generateFiles)(tree, templatesDir, destinationDir, {
|
|
24
|
+
projectName,
|
|
25
|
+
componentFileName,
|
|
26
|
+
componentName,
|
|
27
|
+
componentSelector,
|
|
28
|
+
props,
|
|
29
|
+
fileExt: isCypressV10 ? 'cy.ts' : 'spec.ts',
|
|
36
30
|
});
|
|
31
|
+
if (!options.skipFormat) {
|
|
32
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
33
|
+
}
|
|
37
34
|
}
|
|
38
35
|
exports.componentCypressSpecGenerator = componentCypressSpecGenerator;
|
|
39
36
|
exports.default = componentCypressSpecGenerator;
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentStoryGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
|
|
7
|
-
function componentStoryGenerator(tree, options) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
tmpl: '',
|
|
24
|
-
});
|
|
25
|
-
if (!options.skipFormat) {
|
|
26
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
27
|
-
}
|
|
6
|
+
async function componentStoryGenerator(tree, options) {
|
|
7
|
+
const { componentFileName, componentName, componentPath, projectPath } = options;
|
|
8
|
+
const templatesDir = (0, devkit_1.joinPathFragments)(__dirname, 'files');
|
|
9
|
+
const destinationDir = (0, devkit_1.joinPathFragments)(projectPath, componentPath);
|
|
10
|
+
const storyFile = (0, devkit_1.joinPathFragments)(destinationDir, `${componentFileName}.stories.ts`);
|
|
11
|
+
if (tree.exists(storyFile)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const props = (0, storybook_inputs_1.getComponentProps)(tree, (0, devkit_1.joinPathFragments)(destinationDir, `${componentFileName}.ts`));
|
|
15
|
+
(0, devkit_1.generateFiles)(tree, templatesDir, destinationDir, {
|
|
16
|
+
componentFileName: componentFileName,
|
|
17
|
+
componentName: componentName,
|
|
18
|
+
componentNameSimple: componentFileName.replace('.component', ''),
|
|
19
|
+
interactionTests: options.interactionTests,
|
|
20
|
+
props: props.filter((p) => typeof p.defaultValue !== 'undefined'),
|
|
21
|
+
tmpl: '',
|
|
28
22
|
});
|
|
23
|
+
if (!options.skipFormat) {
|
|
24
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
25
|
+
}
|
|
29
26
|
}
|
|
30
27
|
exports.componentStoryGenerator = componentStoryGenerator;
|
|
31
28
|
exports.default = componentStoryGenerator;
|
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertToWithMF = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const get_mf_projects_1 = require("../../utils/get-mf-projects");
|
|
7
6
|
const lib_1 = require("./lib");
|
|
8
|
-
function convertToWithMF(tree, schema) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
throw new Error(`Cannot automatically migrate "${schema.project}" to "withModuleFederation" micro frontend webpack config.
|
|
7
|
+
async function convertToWithMF(tree, schema) {
|
|
8
|
+
const projects = new Set((0, get_mf_projects_1.getMFProjects)(tree, { legacy: true }));
|
|
9
|
+
if (!projects.has(schema.project)) {
|
|
10
|
+
throw new Error(`Could not find project "${schema.project}" with a Micro Frontend configuration in your workspace. Please check the name of the project you're wishing to convert exists.`);
|
|
11
|
+
}
|
|
12
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
|
|
13
|
+
const pathToWebpackConfig = (0, lib_1.getWebpackConfigPath)(project, schema.project);
|
|
14
|
+
const webpackAst = (0, lib_1.parseASTOfWebpackConfig)(tree, pathToWebpackConfig);
|
|
15
|
+
if (!(0, lib_1.checkOutputNameMatchesProjectName)(webpackAst, schema.project)) {
|
|
16
|
+
throw new Error(`Cannot automatically migrate "${schema.project}" to "withModuleFederation" micro frontend webpack config.
|
|
19
17
|
"uniqueName" in webpack config (${pathToWebpackConfig}) does not match project name.`);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
}
|
|
19
|
+
if (!(0, lib_1.checkSharedNpmPackagesMatchExpected)(webpackAst)) {
|
|
20
|
+
throw new Error(`Cannot automatically migrate "${schema.project}" to "withModuleFederation" micro frontend webpack config.
|
|
23
21
|
There are npm packages being shared with a custom configuration in webpack config (${pathToWebpackConfig}).`);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
22
|
+
}
|
|
23
|
+
devkit_1.logger.warn(`This Micro Frontend configuration conversion will overwrite "${schema.project}"'s current webpack config. If you have anything custom that is not related to Micro Frontends, it will be lost. You should be able to see the changes in your version control system.`);
|
|
24
|
+
const [updatedWebpackConfig, mfConfig] = (0, lib_1.writeNewWebpackConfig)(webpackAst, (0, lib_1.isHostRemoteConfig)(webpackAst), schema.project);
|
|
25
|
+
tree.write(pathToWebpackConfig, updatedWebpackConfig);
|
|
26
|
+
tree.write((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js'), mfConfig);
|
|
27
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
31
28
|
}
|
|
32
29
|
exports.convertToWithMF = convertToWithMF;
|
|
33
30
|
exports.default = convertToWithMF;
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getWebpackConfigPath = void 0;
|
|
4
4
|
function getWebpackConfigPath(project, projectName) {
|
|
5
|
-
var _a, _b, _c;
|
|
6
5
|
let pathToWebpackConfig = '';
|
|
7
|
-
for (const target of Object.values(
|
|
6
|
+
for (const target of Object.values(project.targets ?? {})) {
|
|
8
7
|
if ((target.executor === '@nx/angular:webpack-browser' ||
|
|
9
8
|
target.executor === '@nrwl/angular:webpack-browser') &&
|
|
10
|
-
|
|
11
|
-
pathToWebpackConfig =
|
|
9
|
+
target.options.customWebpackConfig?.path) {
|
|
10
|
+
pathToWebpackConfig = target.options.customWebpackConfig?.path;
|
|
12
11
|
break;
|
|
13
12
|
}
|
|
14
13
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.conversionGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const cypress_1 = require("@nx/cypress");
|
|
6
5
|
const devkit_1 = require("@nx/devkit");
|
|
7
6
|
const linter_1 = require("@nx/linter");
|
|
@@ -9,113 +8,111 @@ const add_linting_1 = require("../add-linting/add-linting");
|
|
|
9
8
|
/**
|
|
10
9
|
* @deprecated This generator will be removed in v17
|
|
11
10
|
*/
|
|
12
|
-
function conversionGenerator(host, options) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
catch (_a) {
|
|
97
|
-
devkit_1.logger.warn('This Angular app has an e2e project, but it was not possible to convert it from TSLint to ESLint. This could be because the e2e project did not have a tslint.json file to begin with.');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Based on user preference and remaining usage, remove TSLint from the workspace entirely.
|
|
102
|
-
*/
|
|
103
|
-
let uninstallTSLintTask = () => Promise.resolve(undefined);
|
|
104
|
-
if (options.removeTSLintIfNoMoreTSLintTargets &&
|
|
105
|
-
!projectConverter.isTSLintUsedInWorkspace()) {
|
|
106
|
-
uninstallTSLintTask = projectConverter.removeTSLintFromWorkspace();
|
|
11
|
+
async function conversionGenerator(host, options) {
|
|
12
|
+
/**
|
|
13
|
+
* The ProjectConverter instance encapsulates all the standard operations we need
|
|
14
|
+
* to perform in order to convert a project from TSLint to ESLint, as well as some
|
|
15
|
+
* extensibility points for adjusting the behavior on a per package basis.
|
|
16
|
+
*
|
|
17
|
+
* E.g. @nx/angular projects might need to make different changes to the final
|
|
18
|
+
* ESLint config when compared with @nx/next projects.
|
|
19
|
+
*
|
|
20
|
+
* See the ProjectConverter implementation for a full breakdown of what it does.
|
|
21
|
+
*/
|
|
22
|
+
const projectConverter = new linter_1.ProjectConverter({
|
|
23
|
+
host,
|
|
24
|
+
projectName: options.project,
|
|
25
|
+
ignoreExistingTslintConfig: options.ignoreExistingTslintConfig,
|
|
26
|
+
eslintInitializer: async ({ projectName, projectConfig }) => {
|
|
27
|
+
await (0, add_linting_1.addLintingGenerator)(host, {
|
|
28
|
+
projectName,
|
|
29
|
+
projectRoot: projectConfig.root,
|
|
30
|
+
prefix: projectConfig.prefix || 'app',
|
|
31
|
+
/**
|
|
32
|
+
* We set the parserOptions.project config just in case the converted config uses
|
|
33
|
+
* rules which require type-checking. Later in the conversion we check if it actually
|
|
34
|
+
* does and remove the config again if it doesn't, so that it is most efficient.
|
|
35
|
+
*/
|
|
36
|
+
setParserOptionsProject: true,
|
|
37
|
+
skipFormat: true,
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* If root eslint configuration already exists it will not be recreated
|
|
43
|
+
* but we also don't want to re-run the tslint config conversion
|
|
44
|
+
* as it was likely already done
|
|
45
|
+
*/
|
|
46
|
+
const rootEslintConfigExists = host.exists('.eslintrc.json');
|
|
47
|
+
/**
|
|
48
|
+
* Create the standard (which is applicable to the current package) ESLint setup
|
|
49
|
+
* for converting the project.
|
|
50
|
+
*/
|
|
51
|
+
const eslintInitInstallTask = await projectConverter.initESLint();
|
|
52
|
+
/**
|
|
53
|
+
* Convert the root tslint.json and apply the converted rules to the root .eslintrc.json
|
|
54
|
+
*/
|
|
55
|
+
const rootConfigInstallTask = await projectConverter.convertRootTSLintConfig((json) => {
|
|
56
|
+
json.overrides = [
|
|
57
|
+
{ files: ['*.ts'], rules: {} },
|
|
58
|
+
{ files: ['*.html'], rules: {} },
|
|
59
|
+
];
|
|
60
|
+
return applyAngularRulesToCorrectOverrides(json);
|
|
61
|
+
}, rootEslintConfigExists);
|
|
62
|
+
/**
|
|
63
|
+
* Convert the project's tslint.json to an equivalent ESLint config.
|
|
64
|
+
*/
|
|
65
|
+
const projectConfigInstallTask = await projectConverter.convertProjectConfig((json) => applyAngularRulesToCorrectOverrides(json));
|
|
66
|
+
/**
|
|
67
|
+
* Clean up the original TSLint configuration for the project.
|
|
68
|
+
*/
|
|
69
|
+
projectConverter.removeProjectTSLintFile();
|
|
70
|
+
// Only project shouldn't be added as a default
|
|
71
|
+
const { project, ...defaults } = options;
|
|
72
|
+
/**
|
|
73
|
+
* Store user preferences for the collection
|
|
74
|
+
*/
|
|
75
|
+
projectConverter.setDefaults('@nx/angular', defaults);
|
|
76
|
+
/**
|
|
77
|
+
* If the Angular project is an app which has an e2e project, try and convert that as well.
|
|
78
|
+
*/
|
|
79
|
+
let cypressInstallTask = () => Promise.resolve(undefined);
|
|
80
|
+
const e2eProjectName = projectConverter.getE2EProjectName();
|
|
81
|
+
if (e2eProjectName) {
|
|
82
|
+
try {
|
|
83
|
+
cypressInstallTask = await (0, cypress_1.conversionGenerator)(host, {
|
|
84
|
+
project: e2eProjectName,
|
|
85
|
+
ignoreExistingTslintConfig: options.ignoreExistingTslintConfig,
|
|
86
|
+
/**
|
|
87
|
+
* We can always set this to false, because it will already be handled by the next
|
|
88
|
+
* step of this parent generator, if applicable
|
|
89
|
+
*/
|
|
90
|
+
removeTSLintIfNoMoreTSLintTargets: false,
|
|
91
|
+
skipFormat: true,
|
|
92
|
+
});
|
|
107
93
|
}
|
|
108
|
-
|
|
109
|
-
|
|
94
|
+
catch {
|
|
95
|
+
devkit_1.logger.warn('This Angular app has an e2e project, but it was not possible to convert it from TSLint to ESLint. This could be because the e2e project did not have a tslint.json file to begin with.');
|
|
110
96
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Based on user preference and remaining usage, remove TSLint from the workspace entirely.
|
|
100
|
+
*/
|
|
101
|
+
let uninstallTSLintTask = () => Promise.resolve(undefined);
|
|
102
|
+
if (options.removeTSLintIfNoMoreTSLintTargets &&
|
|
103
|
+
!projectConverter.isTSLintUsedInWorkspace()) {
|
|
104
|
+
uninstallTSLintTask = projectConverter.removeTSLintFromWorkspace();
|
|
105
|
+
}
|
|
106
|
+
if (!options.skipFormat) {
|
|
107
|
+
await (0, devkit_1.formatFiles)(host);
|
|
108
|
+
}
|
|
109
|
+
return async () => {
|
|
110
|
+
await eslintInitInstallTask();
|
|
111
|
+
await rootConfigInstallTask();
|
|
112
|
+
await projectConfigInstallTask();
|
|
113
|
+
await cypressInstallTask();
|
|
114
|
+
await uninstallTSLintTask();
|
|
115
|
+
};
|
|
119
116
|
}
|
|
120
117
|
exports.conversionGenerator = conversionGenerator;
|
|
121
118
|
/**
|