@nx/angular 24.0.0-pr.37405.acdaf31 → 24.0.0-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.
- package/dist/executors.d.ts +0 -2
- package/dist/executors.js +0 -2
- package/dist/fesm2022/nx-angular.mjs +0 -4
- package/dist/generators.d.ts +0 -8
- package/dist/generators.js +0 -8
- package/dist/ready-check.d.ts +1 -0
- package/dist/ready-check.js +8 -0
- package/dist/src/executors/application/schema.json +1 -2
- package/dist/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.js +9 -1
- package/dist/src/executors/unit-test/schema.json +6 -1
- package/dist/src/executors/unit-test/unit-test.impl.js +5 -0
- package/dist/src/executors/utilities/ng-packagr/stylesheet-processor.js +35 -10
- package/dist/src/generators/add-linting/add-linting.js +1 -3
- package/dist/src/generators/add-linting/schema.d.ts +0 -5
- package/dist/src/generators/add-linting/schema.json +0 -6
- package/dist/src/generators/application/application.js +1 -2
- package/dist/src/generators/application/lib/add-e2e.js +3 -8
- package/dist/src/generators/application/lib/add-linting.js +1 -3
- package/dist/src/generators/application/lib/add-serve-static-target.js +2 -0
- package/dist/src/generators/application/lib/add-unit-test-runner.js +0 -2
- package/dist/src/generators/application/lib/create-project.js +2 -0
- package/dist/src/generators/application/lib/normalize-options.d.ts +1 -1
- package/dist/src/generators/application/lib/normalize-options.js +1 -8
- package/dist/src/generators/application/schema.d.ts +0 -5
- package/dist/src/generators/application/schema.json +1 -7
- package/dist/src/generators/convert-to-rspack/convert-to-rspack.js +9 -4
- package/dist/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +1 -2
- package/dist/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +0 -63
- package/dist/src/generators/convert-to-rspack/lib/validate-no-module-federation.d.ts +2 -0
- package/dist/src/generators/convert-to-rspack/lib/validate-no-module-federation.js +32 -0
- package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -15
- package/dist/src/generators/init/init.js +1 -2
- package/dist/src/generators/init/schema.d.ts +0 -2
- package/dist/src/generators/library/lib/normalized-schema.d.ts +0 -4
- package/dist/src/generators/library/library.js +3 -4
- package/dist/src/generators/library/schema.d.ts +0 -5
- package/dist/src/generators/library/schema.json +0 -6
- package/dist/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +12 -1
- package/dist/src/generators/ng-add/migrators/projects/app.migrator.d.ts +1 -0
- package/dist/src/generators/ng-add/migrators/projects/app.migrator.js +22 -0
- package/dist/src/generators/ng-add/migrators/projects/e2e.migrator.js +12 -16
- package/dist/src/generators/ng-add/utilities/workspace.js +1 -3
- package/dist/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +15 -1
- package/dist/src/generators/setup-ssr/lib/add-dependencies.js +4 -0
- package/dist/src/generators/setup-ssr/lib/update-project-config.js +1 -0
- package/dist/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +0 -2
- package/dist/src/generators/utils/add-jest.d.ts +0 -1
- package/dist/src/generators/utils/add-jest.js +0 -2
- package/dist/src/generators/utils/add-vitest.d.ts +0 -1
- package/dist/src/generators/utils/add-vitest.js +0 -1
- package/dist/src/generators/utils/testing.d.ts +4 -4
- package/dist/src/generators/utils/testing.js +19 -12
- package/dist/src/migrations/update-23-1-0/add-angular-build.js +7 -3
- package/dist/src/migrations/update-23-1-0/add-angular-build.md +1 -1
- package/dist/src/migrations/update-23-1-0/add-trust-proxy-headers.js +9 -2
- package/dist/src/migrations/update-24-0-0/add-ready-when-signal.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/add-ready-when-signal.js +12 -0
- package/dist/src/migrations/update-24-0-0/add-ready-when-signal.md +59 -0
- package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.d.ts +2 -0
- package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.js +85 -0
- package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.md +48 -0
- package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.d.ts +5 -0
- package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.js +332 -0
- package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.md +46 -0
- package/dist/src/plugins/plugin.js +3 -5
- package/dist/src/plugins/utils/dev-server-ready-check.d.ts +17 -0
- package/dist/src/plugins/utils/dev-server-ready-check.js +213 -0
- package/dist/src/utils/assert-cypress-component-testing-support.js +10 -0
- package/dist/src/utils/backward-compatible-versions.js +0 -8
- package/dist/src/utils/versions.d.ts +4 -8
- package/dist/src/utils/versions.js +5 -9
- package/dist/types/nx-angular.d.ts +1 -3
- package/executors.json +0 -10
- package/generators.json +0 -59
- package/migrations.json +109 -0
- package/package.json +13 -21
- package/dist/.npmignore +0 -2
- package/dist/fesm2022/nx-angular-mf.mjs +0 -193
- package/dist/fesm2022/nx-angular-mf.mjs.map +0 -1
- package/dist/fesm2022/nx-angular.mjs.map +0 -1
- package/dist/mf/package.json +0 -4
- package/dist/src/builders/utilities/module-federation.d.ts +0 -11
- package/dist/src/builders/utilities/module-federation.js +0 -109
- package/dist/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
- package/dist/src/executors/module-federation-dev-server/lib/index.js +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +0 -2
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.js +0 -22
- package/dist/src/executors/module-federation-dev-server/lib/start-dev-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/start-dev-remotes.js +0 -29
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -4
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -111
- package/dist/src/executors/module-federation-dev-server/schema.d.ts +0 -38
- package/dist/src/executors/module-federation-dev-server/schema.json +0 -171
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +0 -2
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +0 -20
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.js +0 -30
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -4
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -110
- package/dist/src/executors/module-federation-ssr-dev-server/schema.d.ts +0 -17
- package/dist/src/executors/module-federation-ssr-dev-server/schema.json +0 -124
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.d.ts +0 -4
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.js +0 -36
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.d.ts +0 -5
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.js +0 -448
- package/dist/src/generators/convert-to-with-mf/lib/check-name-matches.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/check-name-matches.js +0 -22
- package/dist/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.js +0 -45
- package/dist/src/generators/convert-to-with-mf/lib/get-webpack-config-path.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +0 -18
- package/dist/src/generators/convert-to-with-mf/lib/index.d.ts +0 -6
- package/dist/src/generators/convert-to-with-mf/lib/index.js +0 -9
- package/dist/src/generators/convert-to-with-mf/lib/is-host-remote-config.d.ts +0 -5
- package/dist/src/generators/convert-to-with-mf/lib/is-host-remote-config.js +0 -57
- package/dist/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.js +0 -13
- package/dist/src/generators/convert-to-with-mf/lib/write-new-webpack-config.d.ts +0 -3
- package/dist/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js +0 -50
- package/dist/src/generators/convert-to-with-mf/schema.d.ts +0 -4
- package/dist/src/generators/convert-to-with-mf/schema.json +0 -33
- package/dist/src/generators/federate-module/federate-module.d.ts +0 -4
- package/dist/src/generators/federate-module/federate-module.js +0 -49
- package/dist/src/generators/federate-module/lib/add-file-to-remote-tsconfig.d.ts +0 -2
- package/dist/src/generators/federate-module/lib/add-file-to-remote-tsconfig.js +0 -14
- package/dist/src/generators/federate-module/lib/add-path-to-exposes.d.ts +0 -8
- package/dist/src/generators/federate-module/lib/add-path-to-exposes.js +0 -77
- package/dist/src/generators/federate-module/lib/add-path-to-ts-config.d.ts +0 -8
- package/dist/src/generators/federate-module/lib/add-path-to-ts-config.js +0 -11
- package/dist/src/generators/federate-module/lib/add-remote.d.ts +0 -7
- package/dist/src/generators/federate-module/lib/add-remote.js +0 -42
- package/dist/src/generators/federate-module/lib/check-remote-exists.d.ts +0 -2
- package/dist/src/generators/federate-module/lib/check-remote-exists.js +0 -21
- package/dist/src/generators/federate-module/lib/index.d.ts +0 -4
- package/dist/src/generators/federate-module/lib/index.js +0 -7
- package/dist/src/generators/federate-module/schema.d.ts +0 -13
- package/dist/src/generators/federate-module/schema.json +0 -83
- package/dist/src/generators/host/files/common/src/main.server.ts__tmpl__ +0 -78
- package/dist/src/generators/host/files/js/webpack.server.config.js__tmpl__ +0 -8
- package/dist/src/generators/host/files/ts/webpack.server.config.ts__tmpl__ +0 -9
- package/dist/src/generators/host/host.d.ts +0 -4
- package/dist/src/generators/host/host.js +0 -133
- package/dist/src/generators/host/lib/index.d.ts +0 -2
- package/dist/src/generators/host/lib/index.js +0 -5
- package/dist/src/generators/host/lib/update-ssr-setup.d.ts +0 -3
- package/dist/src/generators/host/lib/update-ssr-setup.js +0 -54
- package/dist/src/generators/host/lib/validate-options.d.ts +0 -3
- package/dist/src/generators/host/lib/validate-options.js +0 -12
- package/dist/src/generators/host/schema.d.ts +0 -36
- package/dist/src/generators/host/schema.json +0 -195
- package/dist/src/generators/remote/files/base/webpack.server.config.js__tmpl__ +0 -9
- package/dist/src/generators/remote/files/base-ts/webpack.server.config.ts__tmpl__ +0 -9
- package/dist/src/generators/remote/files/common/src/main.server.ts__tmpl__ +0 -84
- package/dist/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +0 -12
- package/dist/src/generators/remote/lib/find-next-available-port.d.ts +0 -2
- package/dist/src/generators/remote/lib/find-next-available-port.js +0 -16
- package/dist/src/generators/remote/lib/index.d.ts +0 -3
- package/dist/src/generators/remote/lib/index.js +0 -6
- package/dist/src/generators/remote/lib/update-ssr-setup.d.ts +0 -9
- package/dist/src/generators/remote/lib/update-ssr-setup.js +0 -82
- package/dist/src/generators/remote/lib/validate-options.d.ts +0 -3
- package/dist/src/generators/remote/lib/validate-options.js +0 -12
- package/dist/src/generators/remote/remote.d.ts +0 -4
- package/dist/src/generators/remote/remote.js +0 -114
- package/dist/src/generators/remote/schema.d.ts +0 -34
- package/dist/src/generators/remote/schema.json +0 -184
- package/dist/src/generators/scam/lib/convert-component-to-scam.d.ts +0 -3
- package/dist/src/generators/scam/lib/convert-component-to-scam.js +0 -41
- package/dist/src/generators/scam/lib/index.d.ts +0 -2
- package/dist/src/generators/scam/lib/index.js +0 -5
- package/dist/src/generators/scam/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/scam/lib/normalize-options.js +0 -34
- package/dist/src/generators/scam/scam.d.ts +0 -7
- package/dist/src/generators/scam/scam.js +0 -28
- package/dist/src/generators/scam/schema.d.ts +0 -30
- package/dist/src/generators/scam/schema.json +0 -126
- package/dist/src/generators/scam-directive/lib/convert-directive-to-scam.d.ts +0 -3
- package/dist/src/generators/scam-directive/lib/convert-directive-to-scam.js +0 -41
- package/dist/src/generators/scam-directive/lib/index.d.ts +0 -2
- package/dist/src/generators/scam-directive/lib/index.js +0 -5
- package/dist/src/generators/scam-directive/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/scam-directive/lib/normalize-options.js +0 -34
- package/dist/src/generators/scam-directive/scam-directive.d.ts +0 -7
- package/dist/src/generators/scam-directive/scam-directive.js +0 -28
- package/dist/src/generators/scam-directive/schema.d.ts +0 -23
- package/dist/src/generators/scam-directive/schema.json +0 -89
- package/dist/src/generators/scam-pipe/lib/convert-pipe-to-scam.d.ts +0 -3
- package/dist/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +0 -41
- package/dist/src/generators/scam-pipe/lib/index.d.ts +0 -2
- package/dist/src/generators/scam-pipe/lib/index.js +0 -5
- package/dist/src/generators/scam-pipe/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/scam-pipe/lib/normalize-options.js +0 -36
- package/dist/src/generators/scam-pipe/scam-pipe.d.ts +0 -7
- package/dist/src/generators/scam-pipe/scam-pipe.js +0 -28
- package/dist/src/generators/scam-pipe/schema.d.ts +0 -21
- package/dist/src/generators/scam-pipe/schema.json +0 -67
- package/dist/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.d.ts +0 -3
- package/dist/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.js +0 -35
- package/dist/src/generators/scam-to-standalone/lib/get-component-data-from-ast.d.ts +0 -6
- package/dist/src/generators/scam-to-standalone/lib/get-component-data-from-ast.js +0 -15
- package/dist/src/generators/scam-to-standalone/lib/get-module-metadata-from-ast.d.ts +0 -9
- package/dist/src/generators/scam-to-standalone/lib/get-module-metadata-from-ast.js +0 -51
- package/dist/src/generators/scam-to-standalone/lib/get-target-project.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/get-target-project.js +0 -13
- package/dist/src/generators/scam-to-standalone/lib/index.d.ts +0 -8
- package/dist/src/generators/scam-to-standalone/lib/index.js +0 -11
- package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.js +0 -20
- package/dist/src/generators/scam-to-standalone/lib/selector-exists-in-ast.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/selector-exists-in-ast.js +0 -7
- package/dist/src/generators/scam-to-standalone/lib/verify-is-inline-scam.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/verify-is-inline-scam.js +0 -10
- package/dist/src/generators/scam-to-standalone/lib/verify-module-is-scam.d.ts +0 -1
- package/dist/src/generators/scam-to-standalone/lib/verify-module-is-scam.js +0 -11
- package/dist/src/generators/scam-to-standalone/scam-to-standalone.d.ts +0 -7
- package/dist/src/generators/scam-to-standalone/scam-to-standalone.js +0 -31
- package/dist/src/generators/scam-to-standalone/schema.d.ts +0 -5
- package/dist/src/generators/scam-to-standalone/schema.json +0 -32
- package/dist/src/generators/setup-mf/files/entry-module-files/__entryModuleFileName__.ts__tmpl__ +0 -18
- package/dist/src/generators/setup-mf/files/entry-module-files/entry.routes.ts__tmpl__ +0 -4
- package/dist/src/generators/setup-mf/files/entry-module-files/entry__componentFileSuffix__.ts__tmpl__ +0 -10
- package/dist/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +0 -42
- package/dist/src/generators/setup-mf/files/standalone-entry-component-files/entry.routes.ts__tmpl__ +0 -4
- package/dist/src/generators/setup-mf/files/standalone-entry-component-files/entry__componentFileSuffix__.ts__tmpl__ +0 -11
- package/dist/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +0 -27
- package/dist/src/generators/setup-mf/files/ts-webpack/tsconfig.lint.json__tmpl__ +0 -12
- package/dist/src/generators/setup-mf/files/ts-webpack/webpack.config.ts__tmpl__ +0 -9
- package/dist/src/generators/setup-mf/files/ts-webpack/webpack.prod.config.ts__tmpl__ +0 -21
- package/dist/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +0 -23
- package/dist/src/generators/setup-mf/files/webpack/webpack.config.js__tmpl__ +0 -9
- package/dist/src/generators/setup-mf/files/webpack/webpack.prod.config.js__tmpl__ +0 -21
- package/dist/src/generators/setup-mf/lib/add-cypress-workaround.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/add-cypress-workaround.js +0 -52
- package/dist/src/generators/setup-mf/lib/add-remote-entry.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/add-remote-entry.js +0 -27
- package/dist/src/generators/setup-mf/lib/add-remote-to-host.d.ts +0 -9
- package/dist/src/generators/setup-mf/lib/add-remote-to-host.js +0 -127
- package/dist/src/generators/setup-mf/lib/change-build-target.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/change-build-target.js +0 -24
- package/dist/src/generators/setup-mf/lib/fix-bootstrap.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/fix-bootstrap.js +0 -40
- package/dist/src/generators/setup-mf/lib/generate-config.d.ts +0 -6
- package/dist/src/generators/setup-mf/lib/generate-config.js +0 -32
- package/dist/src/generators/setup-mf/lib/get-remotes-with-ports.d.ts +0 -6
- package/dist/src/generators/setup-mf/lib/get-remotes-with-ports.js +0 -20
- package/dist/src/generators/setup-mf/lib/index.d.ts +0 -15
- package/dist/src/generators/setup-mf/lib/index.js +0 -18
- package/dist/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.d.ts +0 -2
- package/dist/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.js +0 -15
- package/dist/src/generators/setup-mf/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/normalize-options.js +0 -26
- package/dist/src/generators/setup-mf/lib/remove-dead-code-from-remote.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +0 -61
- package/dist/src/generators/setup-mf/lib/setup-host-if-dynamic.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/setup-host-if-dynamic.js +0 -20
- package/dist/src/generators/setup-mf/lib/setup-serve-target.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/setup-serve-target.js +0 -39
- package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.js +0 -15
- package/dist/src/generators/setup-mf/lib/update-host-app-routes.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/update-host-app-routes.js +0 -39
- package/dist/src/generators/setup-mf/lib/update-tsconfig.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/update-tsconfig.js +0 -18
- package/dist/src/generators/setup-mf/schema.d.ts +0 -35
- package/dist/src/generators/setup-mf/schema.json +0 -99
- package/dist/src/generators/setup-mf/setup-mf.d.ts +0 -4
- package/dist/src/generators/setup-mf/setup-mf.js +0 -90
- package/dist/src/generators/utils/add-mf-env-to-inputs.d.ts +0 -2
- package/dist/src/generators/utils/add-mf-env-to-inputs.js +0 -36
- package/dist/src/generators/utils/assert-mf-utils.d.ts +0 -1
- package/dist/src/generators/utils/assert-mf-utils.js +0 -8
- package/dist/src/generators/utils/export-scam.d.ts +0 -11
- package/dist/src/generators/utils/export-scam.js +0 -35
- package/dist/src/utils/get-mf-projects.d.ts +0 -4
- package/dist/src/utils/get-mf-projects.js +0 -31
- package/dist/src/utils/module-federation-deprecation.d.ts +0 -4
- package/dist/src/utils/module-federation-deprecation.js +0 -29
- package/dist/types/nx-angular-mf.d.ts +0 -72
- package/dist/types/nx-angular-mf.d.ts.map +0 -1
- package/dist/types/nx-angular.d.ts.map +0 -1
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "SCAMGenerator",
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"title": "SCAM Generator Options Schema",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"examples": [
|
|
8
|
-
{
|
|
9
|
-
"description": "Generate a component with the exported symbol matching the file name. It results in the component `FooComponent` at `mylib/src/lib/foo.component.ts`",
|
|
10
|
-
"command": "nx g @nx/angular:scam mylib/src/lib/foo.component.ts"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"description": "Generate a component without providing the file extension. It results in the component `FooComponent` at `mylib/src/lib/foo.component.ts`",
|
|
14
|
-
"command": "nx g @nx/angular:scam mylib/src/lib/foo"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"description": "Generate a component with the exported symbol different from the file name. It results in the component `CustomComponent` at `mylib/src/lib/foo.component.ts`",
|
|
18
|
-
"command": "nx g @nx/angular:scam mylib/src/lib/foo --name=custom"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"description": "Creates a new Angular SCAM.",
|
|
22
|
-
"additionalProperties": false,
|
|
23
|
-
"properties": {
|
|
24
|
-
"path": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "The file path to the SCAM. Relative to the current working directory.",
|
|
27
|
-
"$default": {
|
|
28
|
-
"$source": "argv",
|
|
29
|
-
"index": 0
|
|
30
|
-
},
|
|
31
|
-
"x-prompt": "What is the SCAM file path?"
|
|
32
|
-
},
|
|
33
|
-
"name": {
|
|
34
|
-
"type": "string",
|
|
35
|
-
"description": "The component symbol name. Defaults to the last segment of the file path."
|
|
36
|
-
},
|
|
37
|
-
"displayBlock": {
|
|
38
|
-
"description": "Specifies if the style will contain `:host { display: block; }`.",
|
|
39
|
-
"type": "boolean",
|
|
40
|
-
"default": false,
|
|
41
|
-
"alias": "b"
|
|
42
|
-
},
|
|
43
|
-
"inlineStyle": {
|
|
44
|
-
"description": "Include styles inline in the `component.ts` file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the `component.ts` file.",
|
|
45
|
-
"type": "boolean",
|
|
46
|
-
"default": false,
|
|
47
|
-
"alias": "s"
|
|
48
|
-
},
|
|
49
|
-
"inlineTemplate": {
|
|
50
|
-
"description": "Include template inline in the `component.ts` file. By default, an external template file is created and referenced in the `component.ts` file.",
|
|
51
|
-
"type": "boolean",
|
|
52
|
-
"default": false,
|
|
53
|
-
"alias": "t"
|
|
54
|
-
},
|
|
55
|
-
"viewEncapsulation": {
|
|
56
|
-
"description": "The view encapsulation strategy to use in the new component.",
|
|
57
|
-
"enum": ["Emulated", "None", "ShadowDom"],
|
|
58
|
-
"type": "string",
|
|
59
|
-
"alias": "v"
|
|
60
|
-
},
|
|
61
|
-
"changeDetection": {
|
|
62
|
-
"description": "The change detection strategy to use in the new component. It defaults to `OnPush` for Angular versions >= 22.0.0 and `Default` for lower versions. _Note: the `Eager` value is only supported in Angular versions >= 22.0.0_.",
|
|
63
|
-
"enum": ["Default", "Eager", "OnPush"],
|
|
64
|
-
"type": "string",
|
|
65
|
-
"alias": "c"
|
|
66
|
-
},
|
|
67
|
-
"style": {
|
|
68
|
-
"description": "The file extension or preprocessor to use for style files, or 'none' to skip generating the style file.",
|
|
69
|
-
"type": "string",
|
|
70
|
-
"default": "css",
|
|
71
|
-
"enum": ["css", "scss", "sass", "less", "none"]
|
|
72
|
-
},
|
|
73
|
-
"skipTests": {
|
|
74
|
-
"type": "boolean",
|
|
75
|
-
"description": "Do not create `spec.ts` test files for the new component.",
|
|
76
|
-
"default": false
|
|
77
|
-
},
|
|
78
|
-
"inlineScam": {
|
|
79
|
-
"type": "boolean",
|
|
80
|
-
"description": "Create the `NgModule` in the same file as the component.",
|
|
81
|
-
"default": true,
|
|
82
|
-
"x-priority": "important"
|
|
83
|
-
},
|
|
84
|
-
"selector": {
|
|
85
|
-
"type": "string",
|
|
86
|
-
"format": "html-selector",
|
|
87
|
-
"description": "The `HTML` selector to use for this component."
|
|
88
|
-
},
|
|
89
|
-
"skipSelector": {
|
|
90
|
-
"type": "boolean",
|
|
91
|
-
"default": false,
|
|
92
|
-
"description": "Specifies if the component should have a selector or not."
|
|
93
|
-
},
|
|
94
|
-
"type": {
|
|
95
|
-
"type": "string",
|
|
96
|
-
"description": "Append a custom type to the component's filename. No type is appended unless specified."
|
|
97
|
-
},
|
|
98
|
-
"prefix": {
|
|
99
|
-
"type": "string",
|
|
100
|
-
"description": "The prefix to apply to the generated component selector.",
|
|
101
|
-
"alias": "p",
|
|
102
|
-
"oneOf": [
|
|
103
|
-
{
|
|
104
|
-
"maxLength": 0
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"minLength": 1,
|
|
108
|
-
"format": "html-selector"
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
"export": {
|
|
113
|
-
"type": "boolean",
|
|
114
|
-
"description": "Specifies if the SCAM should be exported from the project's entry point (normally `index.ts`). It only applies to libraries.",
|
|
115
|
-
"default": true,
|
|
116
|
-
"x-priority": "important"
|
|
117
|
-
},
|
|
118
|
-
"skipFormat": {
|
|
119
|
-
"type": "boolean",
|
|
120
|
-
"description": "Skip formatting files.",
|
|
121
|
-
"default": false,
|
|
122
|
-
"x-priority": "internal"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"required": ["path"]
|
|
126
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertDirectiveToScam = convertDirectiveToScam;
|
|
4
|
-
const js_1 = require("@nx/js");
|
|
5
|
-
const internal_1 = require("@nx/js/internal");
|
|
6
|
-
let tsModule;
|
|
7
|
-
function convertDirectiveToScam(tree, options) {
|
|
8
|
-
if (!tree.exists(options.filePath)) {
|
|
9
|
-
throw new Error(`Couldn't find directive at path ${options.filePath} to add SCAM setup.`);
|
|
10
|
-
}
|
|
11
|
-
if (!tsModule) {
|
|
12
|
-
tsModule = (0, internal_1.ensureTypescript)();
|
|
13
|
-
}
|
|
14
|
-
if (options.inlineScam) {
|
|
15
|
-
const currentDirectiveContents = tree.read(options.filePath, 'utf-8');
|
|
16
|
-
let source = tsModule.createSourceFile(options.filePath, currentDirectiveContents, tsModule.ScriptTarget.Latest, true);
|
|
17
|
-
source = (0, js_1.insertImport)(tree, source, options.filePath, 'NgModule', '@angular/core');
|
|
18
|
-
source = (0, js_1.insertImport)(tree, source, options.filePath, 'CommonModule', '@angular/common');
|
|
19
|
-
let updatedDirectiveSource = source.getText();
|
|
20
|
-
updatedDirectiveSource = `${updatedDirectiveSource}${getNgModuleDeclaration(options.symbolName)}`;
|
|
21
|
-
tree.write(options.filePath, updatedDirectiveSource);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
tree.write(options.modulePath, getModuleFileContent(options.symbolName, options.fileName));
|
|
25
|
-
}
|
|
26
|
-
function getModuleFileContent(directiveClassName, directiveFileName) {
|
|
27
|
-
return `import { NgModule } from '@angular/core';
|
|
28
|
-
import { CommonModule } from '@angular/common';
|
|
29
|
-
import { ${directiveClassName} } from './${directiveFileName}';
|
|
30
|
-
${getNgModuleDeclaration(directiveClassName)}`;
|
|
31
|
-
}
|
|
32
|
-
function getNgModuleDeclaration(directiveClassName) {
|
|
33
|
-
return `
|
|
34
|
-
@NgModule({
|
|
35
|
-
imports: [CommonModule],
|
|
36
|
-
declarations: [${directiveClassName}],
|
|
37
|
-
exports: [${directiveClassName}],
|
|
38
|
-
})
|
|
39
|
-
export class ${directiveClassName}Module {}
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeOptions = normalizeOptions;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const artifact_types_1 = require("../../utils/artifact-types");
|
|
7
|
-
const validations_1 = require("../../utils/validations");
|
|
8
|
-
async function normalizeOptions(tree, options) {
|
|
9
|
-
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
10
|
-
name: options.name,
|
|
11
|
-
path: options.path,
|
|
12
|
-
suffix: options.type,
|
|
13
|
-
allowedFileExtensions: ['ts'],
|
|
14
|
-
fileExtension: 'ts',
|
|
15
|
-
});
|
|
16
|
-
const { className } = (0, devkit_1.names)(name);
|
|
17
|
-
const suffixClassName = options.type ? (0, devkit_1.names)(options.type).className : '';
|
|
18
|
-
const symbolName = `${className}${suffixClassName}`;
|
|
19
|
-
(0, validations_1.validateClassName)(symbolName);
|
|
20
|
-
const moduleTypeSeparator = (0, artifact_types_1.getModuleTypeSeparator)(tree);
|
|
21
|
-
const modulePath = (0, devkit_1.joinPathFragments)(directory, `${name}${moduleTypeSeparator}module.ts`);
|
|
22
|
-
return {
|
|
23
|
-
...options,
|
|
24
|
-
export: options.export ?? true,
|
|
25
|
-
inlineScam: options.inlineScam ?? true,
|
|
26
|
-
directory,
|
|
27
|
-
fileName,
|
|
28
|
-
filePath,
|
|
29
|
-
name,
|
|
30
|
-
symbolName,
|
|
31
|
-
projectName,
|
|
32
|
-
modulePath,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
import type { Schema } from './schema';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated SCAMs are superseded by Angular standalone components. Use the `directiveGenerator` instead. It will be removed in Nx v24.
|
|
5
|
-
*/
|
|
6
|
-
export declare function scamDirectiveGenerator(tree: Tree, rawOptions: Schema): Promise<void>;
|
|
7
|
-
export default scamDirectiveGenerator;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scamDirectiveGenerator = scamDirectiveGenerator;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
6
|
-
const directive_1 = require("../directive/directive");
|
|
7
|
-
const export_scam_1 = require("../utils/export-scam");
|
|
8
|
-
const lib_1 = require("./lib");
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated SCAMs are superseded by Angular standalone components. Use the `directiveGenerator` instead. It will be removed in Nx v24.
|
|
11
|
-
*/
|
|
12
|
-
async function scamDirectiveGenerator(tree, rawOptions) {
|
|
13
|
-
(0, assert_supported_angular_version_1.assertSupportedAngularVersion)(tree);
|
|
14
|
-
const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
15
|
-
await (0, directive_1.directiveGenerator)(tree, {
|
|
16
|
-
...options,
|
|
17
|
-
skipImport: true,
|
|
18
|
-
export: false,
|
|
19
|
-
standalone: false,
|
|
20
|
-
skipFormat: true,
|
|
21
|
-
});
|
|
22
|
-
(0, lib_1.convertDirectiveToScam)(tree, options);
|
|
23
|
-
(0, export_scam_1.exportScam)(tree, options);
|
|
24
|
-
if (!options.skipFormat) {
|
|
25
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.default = scamDirectiveGenerator;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface Schema {
|
|
2
|
-
path: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
skipTests?: boolean;
|
|
5
|
-
inlineScam?: boolean;
|
|
6
|
-
prefix?: string;
|
|
7
|
-
selector?: string;
|
|
8
|
-
export?: boolean;
|
|
9
|
-
type?: string;
|
|
10
|
-
skipFormat?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface NormalizedSchema extends Schema {
|
|
14
|
-
name: string;
|
|
15
|
-
directory: string;
|
|
16
|
-
export: boolean;
|
|
17
|
-
fileName: string;
|
|
18
|
-
filePath: string;
|
|
19
|
-
inlineScam: boolean;
|
|
20
|
-
symbolName: string;
|
|
21
|
-
projectName: string;
|
|
22
|
-
modulePath: string;
|
|
23
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "SCAMDirectiveGenerator",
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"title": "SCAM Directive Generator Options Schema",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"examples": [
|
|
8
|
-
{
|
|
9
|
-
"description": "Generate a directive with the exported symbol matching the file name. It results in the directive `FooDirective` at `mylib/src/lib/foo.directive.ts`",
|
|
10
|
-
"command": "nx g @nx/angular:scam-directive mylib/src/lib/foo.directive.ts"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"description": "Generate a directive without providing the file extension. It results in the directive `Foo` at `mylib/src/lib/foo.ts`",
|
|
14
|
-
"command": "nx g @nx/angular:scam-directive mylib/src/lib/foo"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"description": "Generate a directive with a given type/suffix. It results in the directive `FooDirective` at `mylib/src/lib/foo.directive.ts`",
|
|
18
|
-
"command": "nx g @nx/angular:scam-directive mylib/src/lib/foo --type=directive"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"description": "Generate a directive with the exported symbol different from the file name. It results in the directive `Custom` at `mylib/src/lib/foo.ts`",
|
|
22
|
-
"command": "nx g @nx/angular:scam-directive mylib/src/lib/foo --name=custom"
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"description": "Creates a new, generic Angular directive definition in the given or default project.",
|
|
26
|
-
"additionalProperties": false,
|
|
27
|
-
"properties": {
|
|
28
|
-
"path": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"description": "The file path to the SCAM directive. Relative to the current working directory.",
|
|
31
|
-
"$default": {
|
|
32
|
-
"$source": "argv",
|
|
33
|
-
"index": 0
|
|
34
|
-
},
|
|
35
|
-
"x-prompt": "What is the SCAM directive file path?"
|
|
36
|
-
},
|
|
37
|
-
"name": {
|
|
38
|
-
"type": "string",
|
|
39
|
-
"description": "The directive symbol name. Defaults to the last segment of the file path."
|
|
40
|
-
},
|
|
41
|
-
"skipTests": {
|
|
42
|
-
"type": "boolean",
|
|
43
|
-
"description": "Do not create `spec.ts` test files for the new directive.",
|
|
44
|
-
"default": false
|
|
45
|
-
},
|
|
46
|
-
"inlineScam": {
|
|
47
|
-
"type": "boolean",
|
|
48
|
-
"description": "Create the `NgModule` in the same file as the Directive.",
|
|
49
|
-
"default": true,
|
|
50
|
-
"x-priority": "important"
|
|
51
|
-
},
|
|
52
|
-
"selector": {
|
|
53
|
-
"type": "string",
|
|
54
|
-
"format": "html-selector",
|
|
55
|
-
"description": "The `HTML` selector to use for this directive."
|
|
56
|
-
},
|
|
57
|
-
"prefix": {
|
|
58
|
-
"type": "string",
|
|
59
|
-
"description": "The prefix to apply to the generated directive selector.",
|
|
60
|
-
"alias": "p",
|
|
61
|
-
"oneOf": [
|
|
62
|
-
{
|
|
63
|
-
"maxLength": 0
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"minLength": 1,
|
|
67
|
-
"format": "html-selector"
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
},
|
|
71
|
-
"export": {
|
|
72
|
-
"type": "boolean",
|
|
73
|
-
"description": "Specifies if the SCAM should be exported from the project's entry point (normally `index.ts`). It only applies to libraries.",
|
|
74
|
-
"default": true,
|
|
75
|
-
"x-priority": "important"
|
|
76
|
-
},
|
|
77
|
-
"type": {
|
|
78
|
-
"type": "string",
|
|
79
|
-
"description": "Append a custom type to the directive's filename. No type is appended unless specified."
|
|
80
|
-
},
|
|
81
|
-
"skipFormat": {
|
|
82
|
-
"description": "Skip formatting files.",
|
|
83
|
-
"type": "boolean",
|
|
84
|
-
"default": false,
|
|
85
|
-
"x-priority": "internal"
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"required": ["path"]
|
|
89
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertPipeToScam = convertPipeToScam;
|
|
4
|
-
const js_1 = require("@nx/js");
|
|
5
|
-
const internal_1 = require("@nx/js/internal");
|
|
6
|
-
let tsModule;
|
|
7
|
-
function convertPipeToScam(tree, options) {
|
|
8
|
-
if (!tree.exists(options.filePath)) {
|
|
9
|
-
throw new Error(`Couldn't find pipe at path ${options.filePath} to add SCAM setup.`);
|
|
10
|
-
}
|
|
11
|
-
if (!tsModule) {
|
|
12
|
-
tsModule = (0, internal_1.ensureTypescript)();
|
|
13
|
-
}
|
|
14
|
-
if (options.inlineScam) {
|
|
15
|
-
const currentPipeContents = tree.read(options.filePath, 'utf-8');
|
|
16
|
-
let source = tsModule.createSourceFile(options.filePath, currentPipeContents, tsModule.ScriptTarget.Latest, true);
|
|
17
|
-
source = (0, js_1.insertImport)(tree, source, options.filePath, 'NgModule', '@angular/core');
|
|
18
|
-
source = (0, js_1.insertImport)(tree, source, options.filePath, 'CommonModule', '@angular/common');
|
|
19
|
-
let updatedPipeSource = source.getText();
|
|
20
|
-
updatedPipeSource = `${updatedPipeSource}${getNgModuleDeclaration(options.symbolName)}`;
|
|
21
|
-
tree.write(options.filePath, updatedPipeSource);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
tree.write(options.modulePath, getModuleFileContent(options.symbolName, options.fileName));
|
|
25
|
-
}
|
|
26
|
-
function getModuleFileContent(pipeClassName, pipeFileName) {
|
|
27
|
-
return `import { NgModule } from '@angular/core';
|
|
28
|
-
import { CommonModule } from '@angular/common';
|
|
29
|
-
import { ${pipeClassName} } from './${pipeFileName}';
|
|
30
|
-
${getNgModuleDeclaration(pipeClassName)}`;
|
|
31
|
-
}
|
|
32
|
-
function getNgModuleDeclaration(pipeClassName) {
|
|
33
|
-
return `
|
|
34
|
-
@NgModule({
|
|
35
|
-
imports: [CommonModule],
|
|
36
|
-
declarations: [${pipeClassName}],
|
|
37
|
-
exports: [${pipeClassName}],
|
|
38
|
-
})
|
|
39
|
-
export class ${pipeClassName}Module {}
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeOptions = normalizeOptions;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const artifact_types_1 = require("../../utils/artifact-types");
|
|
7
|
-
const validations_1 = require("../../utils/validations");
|
|
8
|
-
async function normalizeOptions(tree, options) {
|
|
9
|
-
options.typeSeparator ??= '-';
|
|
10
|
-
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
11
|
-
name: options.name,
|
|
12
|
-
path: options.path,
|
|
13
|
-
suffix: 'pipe',
|
|
14
|
-
suffixSeparator: options.typeSeparator,
|
|
15
|
-
allowedFileExtensions: ['ts'],
|
|
16
|
-
fileExtension: 'ts',
|
|
17
|
-
});
|
|
18
|
-
const { className } = (0, devkit_1.names)(name);
|
|
19
|
-
const { className: suffixClassName } = (0, devkit_1.names)('pipe');
|
|
20
|
-
const symbolName = `${className}${suffixClassName}`;
|
|
21
|
-
(0, validations_1.validateClassName)(symbolName);
|
|
22
|
-
const moduleTypeSeparator = (0, artifact_types_1.getModuleTypeSeparator)(tree);
|
|
23
|
-
const modulePath = (0, devkit_1.joinPathFragments)(directory, `${name}${moduleTypeSeparator}module.ts`);
|
|
24
|
-
return {
|
|
25
|
-
...options,
|
|
26
|
-
export: options.export ?? true,
|
|
27
|
-
inlineScam: options.inlineScam ?? true,
|
|
28
|
-
directory,
|
|
29
|
-
fileName,
|
|
30
|
-
filePath,
|
|
31
|
-
name,
|
|
32
|
-
symbolName,
|
|
33
|
-
projectName,
|
|
34
|
-
modulePath,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
import type { Schema } from './schema';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated SCAMs are superseded by Angular standalone components. Use the `pipeGenerator` instead. It will be removed in Nx v24.
|
|
5
|
-
*/
|
|
6
|
-
export declare function scamPipeGenerator(tree: Tree, rawOptions: Schema): Promise<void>;
|
|
7
|
-
export default scamPipeGenerator;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scamPipeGenerator = scamPipeGenerator;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
6
|
-
const pipe_1 = require("../pipe/pipe");
|
|
7
|
-
const export_scam_1 = require("../utils/export-scam");
|
|
8
|
-
const lib_1 = require("./lib");
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated SCAMs are superseded by Angular standalone components. Use the `pipeGenerator` instead. It will be removed in Nx v24.
|
|
11
|
-
*/
|
|
12
|
-
async function scamPipeGenerator(tree, rawOptions) {
|
|
13
|
-
(0, assert_supported_angular_version_1.assertSupportedAngularVersion)(tree);
|
|
14
|
-
const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
15
|
-
await (0, pipe_1.pipeGenerator)(tree, {
|
|
16
|
-
...options,
|
|
17
|
-
skipImport: true,
|
|
18
|
-
export: false,
|
|
19
|
-
standalone: false,
|
|
20
|
-
skipFormat: true,
|
|
21
|
-
});
|
|
22
|
-
(0, lib_1.convertPipeToScam)(tree, options);
|
|
23
|
-
(0, export_scam_1.exportScam)(tree, options);
|
|
24
|
-
if (!options.skipFormat) {
|
|
25
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.default = scamPipeGenerator;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface Schema {
|
|
2
|
-
path: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
skipTests?: boolean;
|
|
5
|
-
inlineScam?: boolean;
|
|
6
|
-
export?: boolean;
|
|
7
|
-
typeSeparator?: string;
|
|
8
|
-
skipFormat?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface NormalizedSchema extends Schema {
|
|
12
|
-
name: string;
|
|
13
|
-
directory: string;
|
|
14
|
-
export: boolean;
|
|
15
|
-
fileName: string;
|
|
16
|
-
filePath: string;
|
|
17
|
-
inlineScam: boolean;
|
|
18
|
-
projectName: string;
|
|
19
|
-
symbolName: string;
|
|
20
|
-
modulePath: string;
|
|
21
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "SCAMPipeGenerator",
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"title": "SCAM Pipe Generator Options Schema",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"examples": [
|
|
8
|
-
{
|
|
9
|
-
"description": "Generate a pipe with the exported symbol matching the file name. It results in the pipe `FooPipe` at `mylib/src/lib/foo.pipe.ts`",
|
|
10
|
-
"command": "nx g @nx/angular:scam-pipe mylib/src/lib/foo.pipe.ts"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"description": "Generate a pipe without providing the file extension. It results in the pipe `FooPipe` at `mylib/src/lib/foo.pipe.ts`",
|
|
14
|
-
"command": "nx g @nx/angular:scam-pipe mylib/src/lib/foo"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"description": "Generate a pipe with the exported symbol different from the file name. It results in the pipe `CustomPipe` at `mylib/src/lib/foo.pipe.ts`",
|
|
18
|
-
"command": "nx g @nx/angular:scam-pipe mylib/src/lib/foo --name=custom"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"description": "Creates a new, generic Angular pipe definition in the given or default project.",
|
|
22
|
-
"additionalProperties": false,
|
|
23
|
-
"properties": {
|
|
24
|
-
"path": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "The file path to the SCAM pipe. Relative to the current working directory.",
|
|
27
|
-
"$default": {
|
|
28
|
-
"$source": "argv",
|
|
29
|
-
"index": 0
|
|
30
|
-
},
|
|
31
|
-
"x-prompt": "What is the SCAM pipe file path?"
|
|
32
|
-
},
|
|
33
|
-
"name": {
|
|
34
|
-
"type": "string",
|
|
35
|
-
"description": "The pipe symbol name. Defaults to the last segment of the file path."
|
|
36
|
-
},
|
|
37
|
-
"skipTests": {
|
|
38
|
-
"type": "boolean",
|
|
39
|
-
"description": "Do not create `spec.ts` test files for the new pipe.",
|
|
40
|
-
"default": false
|
|
41
|
-
},
|
|
42
|
-
"inlineScam": {
|
|
43
|
-
"type": "boolean",
|
|
44
|
-
"description": "Create the NgModule in the same file as the Pipe.",
|
|
45
|
-
"default": true,
|
|
46
|
-
"x-priority": "important"
|
|
47
|
-
},
|
|
48
|
-
"export": {
|
|
49
|
-
"type": "boolean",
|
|
50
|
-
"description": "Specifies if the SCAM should be exported from the project's entry point (normally `index.ts`). It only applies to libraries.",
|
|
51
|
-
"default": true,
|
|
52
|
-
"x-priority": "important"
|
|
53
|
-
},
|
|
54
|
-
"typeSeparator": {
|
|
55
|
-
"type": "string",
|
|
56
|
-
"enum": ["-", "."],
|
|
57
|
-
"description": "The separator character to use before the type within the generated file's name. For example, if you set the option to `.`, the file will be named `example.pipe.ts`. It defaults to '-'."
|
|
58
|
-
},
|
|
59
|
-
"skipFormat": {
|
|
60
|
-
"description": "Skip formatting files.",
|
|
61
|
-
"type": "boolean",
|
|
62
|
-
"default": false,
|
|
63
|
-
"x-priority": "internal"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"required": ["path"]
|
|
67
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type Tree } from '@nx/devkit';
|
|
2
|
-
import type { Node, SourceFile } from 'typescript';
|
|
3
|
-
export declare function convertScamToStandalone(componentAST: SourceFile, componentFileContents: string, importsArray: string[], providersArray: string[], moduleNodes: Array<Node>, tree: Tree, normalizedComponentPath: string, componentName: string): void;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertScamToStandalone = convertScamToStandalone;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const version_utils_1 = require("../../utils/version-utils");
|
|
7
|
-
function convertScamToStandalone(componentAST, componentFileContents, importsArray, providersArray, moduleNodes, tree, normalizedComponentPath, componentName) {
|
|
8
|
-
let newComponentContents = '';
|
|
9
|
-
const COMPONENT_PROPERTY_SELECTOR = 'ClassDeclaration > Decorator > CallExpression:has(Identifier[name=Component]) ObjectLiteralExpression';
|
|
10
|
-
const { query } = require('@phenomnomnominal/tsquery');
|
|
11
|
-
const componentDecoratorMetadataNode = query(componentAST, COMPONENT_PROPERTY_SELECTOR)[0];
|
|
12
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
13
|
-
newComponentContents = `${componentFileContents.slice(0, componentDecoratorMetadataNode.getStart() - 1)}({
|
|
14
|
-
imports: [${importsArray.join(',')}],${providersArray.length > 0
|
|
15
|
-
? `providers: [${providersArray.join(',')}],`
|
|
16
|
-
: ''}${componentFileContents.slice(componentDecoratorMetadataNode.getStart() + 1, moduleNodes[0].getStart() - 1)}`;
|
|
17
|
-
tree.write(normalizedComponentPath, newComponentContents);
|
|
18
|
-
const componentPathParts = (0, path_1.parse)(normalizedComponentPath);
|
|
19
|
-
const pathToComponentSpec = (0, devkit_1.joinPathFragments)(componentPathParts.dir, '/', `${componentPathParts.name}.spec.ts`);
|
|
20
|
-
if (tree.exists(pathToComponentSpec)) {
|
|
21
|
-
const componentSpecContents = tree.read(pathToComponentSpec, 'utf-8');
|
|
22
|
-
// Only support testbed based tests
|
|
23
|
-
if (componentSpecContents.includes('TestBed')) {
|
|
24
|
-
let newComponentSpecContents = componentSpecContents;
|
|
25
|
-
if (componentSpecContents.includes('imports: [')) {
|
|
26
|
-
newComponentSpecContents = newComponentSpecContents.replace('imports: [', `imports: [${componentName}, `);
|
|
27
|
-
newComponentSpecContents.replace(/declarations: \[.+/, '');
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
newComponentSpecContents = newComponentSpecContents.replace('declarations: [', 'imports: [');
|
|
31
|
-
}
|
|
32
|
-
tree.write(pathToComponentSpec, newComponentSpecContents);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|