@nx/angular 0.0.0-pr-30715-a5f5e3b → 0.0.0-pr-31313-387cdca
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/fesm2022/nx-angular-mf.mjs.map +1 -1
- package/fesm2022/nx-angular.mjs.map +1 -1
- package/index.d.ts +1 -2
- package/mf/index.d.ts +1 -71
- package/mf/mf.d.ts +69 -0
- package/migrations.json +0 -98
- package/package.json +16 -25
- package/plugins/component-testing.js +3 -8
- package/src/builders/dev-server/dev-server.impl.js +7 -4
- package/src/builders/dev-server/lib/normalize-options.js +6 -0
- package/src/builders/dev-server/lib/validate-options.js +4 -0
- package/src/builders/dev-server/schema.d.ts +15 -3
- package/src/builders/dev-server/schema.json +9 -3
- package/src/builders/webpack-browser/webpack-browser.impl.js +0 -2
- package/src/builders/webpack-server/webpack-server.impl.d.ts +1 -3
- package/src/builders/webpack-server/webpack-server.impl.js +0 -2
- package/src/executors/application/application.impl.d.ts +2 -2
- package/src/executors/application/application.impl.js +6 -11
- package/src/executors/application/schema.d.ts +1 -1
- package/src/executors/application/schema.json +10 -21
- package/src/executors/application/utils/normalize-options.js +1 -8
- package/src/executors/application/utils/validate-options.js +40 -10
- package/src/executors/extract-i18n/extract-i18n.impl.js +14 -6
- package/src/executors/extract-i18n/schema.d.ts +6 -1
- package/src/executors/module-federation-dev-server/lib/normalize-options.js +7 -1
- package/src/executors/module-federation-dev-server/schema.d.ts +15 -3
- package/src/executors/module-federation-dev-server/schema.json +15 -2
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +8 -10
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.d.ts +3 -6
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.js +8 -46
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.di.d.ts +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.di.js +3 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.d.ts +2 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.js +6 -22
- package/src/executors/ng-packagr-lite/schema.json +3 -2
- package/src/executors/package/package.impl.js +5 -1
- package/src/executors/package/schema.d.ts +1 -3
- package/src/executors/package/schema.json +3 -2
- package/src/executors/utilities/esbuild-extensions.d.ts +1 -2
- package/src/executors/utilities/ng-packagr/package-imports.d.ts +1 -3
- package/src/executors/utilities/ng-packagr/package-imports.js +2 -2
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.d.ts +24 -1
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.js +105 -12
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +8 -4
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.d.ts +1 -1
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.js +11 -18
- package/src/generators/add-linting/add-linting.js +0 -8
- package/src/generators/application/application.js +1 -21
- package/src/generators/application/files/base-pre18/src/favicon.ico +0 -0
- package/src/generators/application/files/ng-module/src/app/app.component.spec.ts__tpl__ +29 -0
- package/src/generators/application/files/ng-module/src/app/{app__componentFileSuffix__.ts__tpl__ → app.component.ts__tpl__} +3 -3
- package/src/generators/application/files/ng-module/src/app/app.module.ts__tpl__ +17 -0
- package/src/generators/application/files/ng-module/src/main.ts__tpl__ +3 -11
- package/src/generators/application/files/nx-welcome/claimed/ng-module/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/claimed/standalone/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/not-configured/ng-module/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/not-configured/standalone/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/unclaimed/ng-module/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/unclaimed/standalone/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/standalone-components/src/app/app.component.__style__ +0 -0
- package/src/generators/application/files/standalone-components/src/app/app.component.spec.ts__tpl__ +28 -0
- package/src/generators/application/files/standalone-components/src/app/{app__componentFileSuffix__.ts__tpl__ → app.component.ts__tpl__} +5 -5
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +2 -6
- package/src/generators/application/files/standalone-components/src/main.ts__tpl__ +2 -2
- package/src/generators/application/lib/create-files.d.ts +1 -1
- package/src/generators/application/lib/create-files.js +14 -15
- package/src/generators/application/lib/create-project.d.ts +1 -1
- package/src/generators/application/lib/create-project.js +26 -119
- package/src/generators/application/lib/enable-strict-type-checking.js +0 -3
- package/src/generators/application/schema.json +1 -1
- package/src/generators/component/component.js +2 -13
- package/src/generators/component/files/__fileName__.ts__tpl__ +1 -1
- package/src/generators/component/lib/component.js +1 -11
- package/src/generators/component/lib/module.d.ts +2 -7
- package/src/generators/component/lib/module.js +5 -7
- package/src/generators/component/lib/normalize-options.js +3 -7
- package/src/generators/component/schema.d.ts +0 -1
- package/src/generators/component/schema.json +2 -6
- package/src/generators/convert-to-application-executor/convert-to-application-executor.js +22 -19
- package/src/generators/convert-to-rspack/convert-to-rspack.js +2 -6
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +1 -1
- package/src/generators/directive/directive.js +1 -1
- package/src/generators/directive/lib/normalize-options.js +2 -7
- package/src/generators/directive/schema.d.ts +0 -1
- package/src/generators/directive/schema.json +2 -10
- package/src/generators/host/host.js +21 -1
- package/src/generators/host/schema.d.ts +1 -0
- package/src/generators/host/schema.json +7 -1
- package/src/generators/init/init.js +1 -1
- package/src/generators/library/files/ng-module/src/index.ts__tpl__ +1 -1
- package/src/generators/library/files/standalone-components/src/lib/lib.routes.ts__tpl__ +2 -2
- package/src/generators/library/lib/add-standalone-component.js +0 -1
- package/src/generators/library/lib/create-files.js +1 -10
- package/src/generators/library/lib/enable-strict-type-checking.d.ts +1 -1
- package/src/generators/library/lib/enable-strict-type-checking.js +0 -3
- package/src/generators/library/lib/normalize-options.d.ts +3 -3
- package/src/generators/library/lib/normalize-options.js +1 -6
- package/src/generators/library/lib/normalized-schema.d.ts +0 -2
- package/src/generators/library-secondary-entry-point/files/src/index.ts__tmpl__ +1 -1
- package/src/generators/library-secondary-entry-point/lib/add-files.js +1 -2
- package/src/generators/library-secondary-entry-point/lib/normalize-options.d.ts +2 -2
- package/src/generators/library-secondary-entry-point/lib/normalize-options.js +0 -3
- package/src/generators/library-secondary-entry-point/schema.d.ts +0 -1
- package/src/generators/move/lib/update-module-name.js +10 -17
- package/src/generators/move/lib/update-secondary-entry-points.js +3 -0
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +1 -1
- package/src/generators/ng-add/migrators/projects/app.migrator.js +8 -43
- package/src/generators/ngrx/schema.json +3 -3
- package/src/generators/ngrx-root-store/lib/normalize-options.js +2 -9
- package/src/generators/pipe/lib/normalize-options.js +0 -4
- package/src/generators/pipe/pipe.js +1 -1
- package/src/generators/pipe/schema.d.ts +0 -1
- package/src/generators/pipe/schema.json +2 -11
- package/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +4 -4
- package/src/generators/remote/lib/update-ssr-setup.js +0 -5
- package/src/generators/remote/remote.js +23 -0
- package/src/generators/remote/schema.d.ts +1 -0
- package/src/generators/remote/schema.json +7 -1
- package/src/generators/scam/lib/convert-component-to-scam.js +3 -1
- package/src/generators/scam/lib/normalize-options.js +3 -11
- package/src/generators/scam/schema.d.ts +0 -1
- package/src/generators/scam/schema.json +2 -1
- package/src/generators/scam-directive/lib/convert-directive-to-scam.js +3 -1
- package/src/generators/scam-directive/lib/normalize-options.js +2 -11
- package/src/generators/scam-directive/schema.d.ts +0 -2
- package/src/generators/scam-directive/schema.json +2 -10
- package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +3 -1
- package/src/generators/scam-pipe/lib/normalize-options.js +0 -8
- package/src/generators/scam-pipe/schema.d.ts +0 -2
- package/src/generators/scam-pipe/schema.json +0 -5
- package/src/generators/setup-mf/files/entry-module-files/{entry__componentFileSuffix__.ts__tmpl__ → entry.component.ts__tmpl__} +1 -1
- package/src/generators/setup-mf/files/entry-module-files/{__entryModuleFileName__.ts__tmpl__ → entry.module.ts__tmpl__} +4 -4
- package/src/generators/setup-mf/files/entry-module-files/entry.routes.ts__tmpl__ +2 -2
- package/src/generators/setup-mf/files/host-files/app.component.spec.ts__tmpl__ +47 -0
- package/src/generators/setup-mf/files/standalone-entry-component-files/{entry__componentFileSuffix__.ts__tmpl__ → entry.component.ts__tmpl__} +3 -3
- package/src/generators/setup-mf/files/standalone-entry-component-files/entry.routes.ts__tmpl__ +2 -2
- package/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +1 -1
- package/src/generators/setup-mf/files/ts-webpack/tsconfig.lint.json__tmpl__ +1 -1
- package/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +1 -1
- package/src/generators/setup-mf/lib/add-remote-entry.d.ts +2 -2
- package/src/generators/setup-mf/lib/add-remote-entry.js +3 -9
- package/src/generators/setup-mf/lib/add-remote-to-host.js +1 -11
- package/src/generators/setup-mf/lib/fix-bootstrap.d.ts +2 -2
- package/src/generators/setup-mf/lib/fix-bootstrap.js +4 -4
- package/src/generators/setup-mf/lib/generate-config.d.ts +2 -2
- package/src/generators/setup-mf/lib/generate-config.js +0 -1
- package/src/generators/setup-mf/lib/normalize-options.d.ts +1 -1
- package/src/generators/setup-mf/lib/normalize-options.js +0 -13
- package/src/generators/setup-mf/lib/remove-dead-code-from-remote.d.ts +2 -2
- package/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +14 -18
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +5 -1
- package/src/generators/setup-mf/lib/setup-tspath-for-remote.d.ts +2 -2
- package/src/generators/setup-mf/lib/setup-tspath-for-remote.js +1 -1
- package/src/generators/setup-mf/lib/update-host-app-routes.d.ts +2 -2
- package/src/generators/setup-mf/lib/update-host-app-routes.js +9 -12
- package/src/generators/setup-mf/lib/update-tsconfig.d.ts +2 -2
- package/src/generators/setup-mf/lib/update-tsconfig.js +5 -5
- package/src/generators/setup-mf/schema.d.ts +0 -7
- package/src/generators/setup-ssr/lib/add-dependencies.js +7 -4
- package/src/generators/setup-ssr/lib/add-hydration.js +3 -10
- package/src/generators/setup-ssr/lib/add-server-file.js +2 -7
- package/src/generators/setup-ssr/lib/generate-files.js +4 -17
- package/src/generators/setup-ssr/lib/generate-server-ts-config.js +2 -5
- package/src/generators/setup-ssr/lib/normalize-options.js +2 -2
- package/src/generators/setup-ssr/lib/update-project-config.js +0 -5
- package/src/generators/setup-ssr/lib/validate-options.js +2 -2
- package/src/generators/setup-ssr/schema.json +1 -1
- package/src/generators/utils/add-jest.js +1 -6
- package/src/generators/utils/assert-mf-utils.d.ts +1 -0
- package/src/generators/utils/assert-mf-utils.js +11 -0
- package/src/generators/utils/ensure-angular-dependencies.js +3 -6
- package/src/generators/utils/export-scam.d.ts +0 -1
- package/src/generators/utils/export-scam.js +2 -1
- package/src/generators/utils/find-module.js +13 -18
- package/src/generators/utils/storybook-ast/component-info.js +24 -40
- package/src/generators/utils/storybook-ast/module-info.d.ts +1 -1
- package/src/generators/utils/storybook-ast/module-info.js +8 -3
- package/src/generators/utils/testing.js +28 -28
- package/src/generators/utils/version-utils.js +2 -2
- package/src/generators/web-worker/lib/add-snippet.js +3 -3
- package/src/plugins/plugin.js +13 -22
- package/src/utils/backward-compatible-versions.d.ts +2 -2
- package/src/utils/backward-compatible-versions.js +21 -20
- package/src/utils/nx-devkit/ast-utils.js +3 -17
- package/src/utils/nx-devkit/testing.js +9 -9
- package/src/utils/versions.d.ts +4 -3
- package/src/utils/versions.js +5 -4
- package/src/executors/utilities/builder-package.d.ts +0 -1
- package/src/executors/utilities/builder-package.js +0 -11
- package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.spec.ts__tpl__ +0 -28
- package/src/generators/application/files/ng-module/src/app/app__moduleTypeSeparator__module.ts__tpl__ +0 -17
- package/src/generators/application/files/standalone-components/src/app/app__componentFileSuffix__.spec.ts__tpl__ +0 -27
- package/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +0 -43
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/__main__ +0 -1
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/app/__rootModuleFileName__ +0 -12
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +0 -8
- package/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +0 -66
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/__main__ +0 -7
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +0 -12
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +0 -8
- package/src/generators/setup-ssr/files/v20+/server-builder/ngmodule-src/__main__ +0 -1
- package/src/generators/setup-ssr/files/v20+/server-builder/ngmodule-src/app/__rootModuleFileName__ +0 -14
- package/src/generators/setup-ssr/files/v20+/server-builder/root/tsconfig.server.json.template +0 -16
- package/src/generators/setup-ssr/files/v20+/server-builder/server/__serverFileName__ +0 -69
- package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/__main__ +0 -7
- package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/app/app.config.server.ts.template +0 -11
- package/src/generators/utils/app-components-info.d.ts +0 -9
- package/src/generators/utils/app-components-info.js +0 -39
- package/src/generators/utils/artifact-types.d.ts +0 -3
- package/src/generators/utils/artifact-types.js +0 -33
- package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.d.ts +0 -2
- package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.js +0 -110
- package/src/migrations/update-21-2-0/replace-provide-server-routing.d.ts +0 -2
- package/src/migrations/update-21-2-0/replace-provide-server-routing.js +0 -103
- package/src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide.d.ts +0 -2
- package/src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide.js +0 -47
- package/src/migrations/update-21-2-0/update-angular-cli.d.ts +0 -3
- package/src/migrations/update-21-2-0/update-angular-cli.js +0 -23
- /package/src/generators/application/files/{base → base-18+}/public/favicon.ico +0 -0
- /package/src/generators/application/files/{ng-module/src/app/app__componentFileSuffix__.__style__ → base-pre18/src/assets/.gitkeep__tpl__} +0 -0
- /package/src/generators/application/files/{standalone-components/src/app/app__componentFileSuffix__.__style__ → ng-module/src/app/app.component.__style__} +0 -0
- /package/src/generators/application/files/ng-module/src/app/{app__componentFileSuffix__.html__tpl__ → app.component.html__tpl__} +0 -0
- /package/src/generators/application/files/standalone-components/src/app/{app__componentFileSuffix__.html__tpl__ → app.component.html__tpl__} +0 -0
- /package/src/generators/component/files/{__fileName____ngext__.html__tpl__ → __fileName__.html__tpl__} +0 -0
- /package/src/generators/library/files/ng-module/src/lib/{__libFileName____moduleTypeSeparator__module.ts__tpl__ → __libFileName__.module.ts__tpl__} +0 -0
- /package/src/generators/library-secondary-entry-point/files/src/lib/{__fileName____moduleTypeSeparator__module.ts__tmpl__ → __fileName__.module.ts__tmpl__} +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/application-builder/ngmodule-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/application-builder/ngmodule-src/app/__rootModuleFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/application-builder/server/__serverFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/application-builder/standalone-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/application-builder/standalone-src/app/app.config.server.ts__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/application-builder-common-engine/server/__serverFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/server-builder/ngmodule-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/server-builder/ngmodule-src/app/__rootModuleFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/server-builder/root/tsconfig.server.json.template +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/server-builder/server/__serverFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/server-builder/standalone-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19 → v19+}/server-builder/standalone-src/app/app.config.server.ts.template +0 -0
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Adapted from the original ng-packagr source.
|
|
3
3
|
*
|
|
4
4
|
* Changes made:
|
|
5
|
-
* -
|
|
5
|
+
* - Use our own function to get the TailwindCSS config path to support a
|
|
6
|
+
* config at the root of the workspace.
|
|
6
7
|
*/
|
|
7
8
|
export declare enum CssUrl {
|
|
8
9
|
inline = "inline",
|
|
@@ -24,3 +25,25 @@ export declare class StylesheetProcessor {
|
|
|
24
25
|
destroy(): void;
|
|
25
26
|
private createRenderWorker;
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* This class is used when ng-packagr version is 17.2.0. The async `loadPostcssConfiguration` function
|
|
30
|
+
* introduced in ng-packagr 17.2.0 causes a memory leak due to multiple workers being created. We must
|
|
31
|
+
* keep this class to support any workspace that might be using ng-packagr 17.2.0 where that function
|
|
32
|
+
* need to be awaited.
|
|
33
|
+
*/
|
|
34
|
+
export declare class AsyncStylesheetProcessor {
|
|
35
|
+
private readonly projectBasePath;
|
|
36
|
+
private readonly basePath;
|
|
37
|
+
private readonly cssUrl?;
|
|
38
|
+
private readonly includePaths?;
|
|
39
|
+
private readonly cacheDirectory?;
|
|
40
|
+
private renderWorker;
|
|
41
|
+
constructor(projectBasePath: string, basePath: string, cssUrl?: CssUrl, includePaths?: string[], cacheDirectory?: string | false);
|
|
42
|
+
process({ filePath, content, }: {
|
|
43
|
+
filePath: string;
|
|
44
|
+
content: string;
|
|
45
|
+
}): Promise<string>;
|
|
46
|
+
/** Destory workers in pool. */
|
|
47
|
+
destroy(): void;
|
|
48
|
+
private createRenderWorker;
|
|
49
|
+
}
|
|
@@ -3,17 +3,22 @@
|
|
|
3
3
|
* Adapted from the original ng-packagr source.
|
|
4
4
|
*
|
|
5
5
|
* Changes made:
|
|
6
|
-
* -
|
|
6
|
+
* - Use our own function to get the TailwindCSS config path to support a
|
|
7
|
+
* config at the root of the workspace.
|
|
7
8
|
*/
|
|
8
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.StylesheetProcessor = exports.CssUrl = void 0;
|
|
10
|
+
exports.AsyncStylesheetProcessor = exports.StylesheetProcessor = exports.CssUrl = void 0;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
|
|
12
13
|
const fs_1 = require("fs");
|
|
13
14
|
const path_1 = require("path");
|
|
14
15
|
const Piscina = require('piscina');
|
|
15
|
-
const color_1 = require("ng-packagr/
|
|
16
|
+
const color_1 = require("ng-packagr/lib/utils/color");
|
|
17
|
+
// using this instead of the one from ng-packagr
|
|
18
|
+
const tailwindcss_1 = require("../tailwindcss");
|
|
16
19
|
const devkit_1 = require("@nx/devkit");
|
|
20
|
+
const semver_1 = require("semver");
|
|
21
|
+
const ng_packagr_version_1 = require("../ng-packagr-version");
|
|
17
22
|
const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
|
|
18
23
|
const maxThreads = typeof maxWorkersVariable === 'string' && maxWorkersVariable !== ''
|
|
19
24
|
? +maxWorkersVariable
|
|
@@ -67,15 +72,25 @@ class StylesheetProcessor {
|
|
|
67
72
|
currentDir = (0, path_1.dirname)(prevDir);
|
|
68
73
|
}
|
|
69
74
|
const browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
|
|
70
|
-
const {
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.projectBasePath
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const { version: ngPackagrVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
|
|
76
|
+
let tailwindConfigPath;
|
|
77
|
+
let postcssConfiguration;
|
|
78
|
+
if ((0, semver_1.gte)(ngPackagrVersion, '18.0.0')) {
|
|
79
|
+
const { findTailwindConfiguration, generateSearchDirectories, loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
|
|
80
|
+
let searchDirs = generateSearchDirectories([this.projectBasePath]);
|
|
81
|
+
postcssConfiguration = loadPostcssConfiguration(searchDirs);
|
|
82
|
+
// (nx-specific): we support loading the TailwindCSS config from the root of the workspace
|
|
83
|
+
searchDirs = generateSearchDirectories([
|
|
84
|
+
this.projectBasePath,
|
|
85
|
+
devkit_1.workspaceRoot,
|
|
86
|
+
]);
|
|
87
|
+
tailwindConfigPath = findTailwindConfiguration(searchDirs);
|
|
88
|
+
}
|
|
89
|
+
else if ((0, semver_1.gt)(ngPackagrVersion, '17.2.0')) {
|
|
90
|
+
const { loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
|
|
91
|
+
postcssConfiguration = loadPostcssConfiguration(this.projectBasePath);
|
|
92
|
+
tailwindConfigPath = (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot);
|
|
93
|
+
}
|
|
79
94
|
this.renderWorker = new Piscina({
|
|
80
95
|
filename: require.resolve('ng-packagr/lib/styles/stylesheet-processor-worker'),
|
|
81
96
|
maxThreads,
|
|
@@ -98,6 +113,84 @@ class StylesheetProcessor {
|
|
|
98
113
|
}
|
|
99
114
|
}
|
|
100
115
|
exports.StylesheetProcessor = StylesheetProcessor;
|
|
116
|
+
/**
|
|
117
|
+
* This class is used when ng-packagr version is 17.2.0. The async `loadPostcssConfiguration` function
|
|
118
|
+
* introduced in ng-packagr 17.2.0 causes a memory leak due to multiple workers being created. We must
|
|
119
|
+
* keep this class to support any workspace that might be using ng-packagr 17.2.0 where that function
|
|
120
|
+
* need to be awaited.
|
|
121
|
+
*/
|
|
122
|
+
class AsyncStylesheetProcessor {
|
|
123
|
+
constructor(projectBasePath, basePath, cssUrl, includePaths, cacheDirectory) {
|
|
124
|
+
this.projectBasePath = projectBasePath;
|
|
125
|
+
this.basePath = basePath;
|
|
126
|
+
this.cssUrl = cssUrl;
|
|
127
|
+
this.includePaths = includePaths;
|
|
128
|
+
this.cacheDirectory = cacheDirectory;
|
|
129
|
+
// By default, browserslist defaults are too inclusive
|
|
130
|
+
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
|
131
|
+
// We change the default query to browsers that Angular support.
|
|
132
|
+
// https://angular.io/guide/browser-support
|
|
133
|
+
browserslist_1.default.defaults = [
|
|
134
|
+
'last 2 Chrome versions',
|
|
135
|
+
'last 1 Firefox version',
|
|
136
|
+
'last 2 Edge major versions',
|
|
137
|
+
'last 2 Safari major versions',
|
|
138
|
+
'last 2 iOS major versions',
|
|
139
|
+
'Firefox ESR',
|
|
140
|
+
];
|
|
141
|
+
}
|
|
142
|
+
async process({ filePath, content, }) {
|
|
143
|
+
await this.createRenderWorker();
|
|
144
|
+
return this.renderWorker.run({ content, filePath });
|
|
145
|
+
}
|
|
146
|
+
/** Destory workers in pool. */
|
|
147
|
+
destroy() {
|
|
148
|
+
void this.renderWorker?.destroy();
|
|
149
|
+
}
|
|
150
|
+
async createRenderWorker() {
|
|
151
|
+
if (this.renderWorker) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const styleIncludePaths = [...this.includePaths];
|
|
155
|
+
let prevDir = null;
|
|
156
|
+
let currentDir = this.basePath;
|
|
157
|
+
while (currentDir !== prevDir) {
|
|
158
|
+
const p = (0, path_1.join)(currentDir, 'node_modules');
|
|
159
|
+
if ((0, fs_1.existsSync)(p)) {
|
|
160
|
+
styleIncludePaths.push(p);
|
|
161
|
+
}
|
|
162
|
+
prevDir = currentDir;
|
|
163
|
+
currentDir = (0, path_1.dirname)(prevDir);
|
|
164
|
+
}
|
|
165
|
+
const browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
|
|
166
|
+
const { version: ngPackagrVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
|
|
167
|
+
let postcssConfiguration;
|
|
168
|
+
if (ngPackagrVersion === '17.2.0') {
|
|
169
|
+
const { loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
|
|
170
|
+
postcssConfiguration = await loadPostcssConfiguration(this.projectBasePath);
|
|
171
|
+
}
|
|
172
|
+
this.renderWorker = new Piscina({
|
|
173
|
+
filename: require.resolve('ng-packagr/lib/styles/stylesheet-processor-worker'),
|
|
174
|
+
maxThreads,
|
|
175
|
+
recordTiming: false,
|
|
176
|
+
env: {
|
|
177
|
+
...process.env,
|
|
178
|
+
FORCE_COLOR: '' + color_1.colors.enabled,
|
|
179
|
+
},
|
|
180
|
+
workerData: {
|
|
181
|
+
postcssConfiguration,
|
|
182
|
+
tailwindConfigPath: (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot),
|
|
183
|
+
projectBasePath: this.projectBasePath,
|
|
184
|
+
browserslistData,
|
|
185
|
+
targets: transformSupportedBrowsersToTargets(browserslistData),
|
|
186
|
+
cacheDirectory: this.cacheDirectory,
|
|
187
|
+
cssUrl: this.cssUrl,
|
|
188
|
+
styleIncludePaths,
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.AsyncStylesheetProcessor = AsyncStylesheetProcessor;
|
|
101
194
|
function transformSupportedBrowsersToTargets(supportedBrowsers) {
|
|
102
195
|
const transformed = [];
|
|
103
196
|
// https://esbuild.github.io/api/#target
|
|
@@ -4,8 +4,8 @@ exports.getStylesheetProcessorFactoryProvider = getStylesheetProcessorFactoryPro
|
|
|
4
4
|
const ng_packagr_version_1 = require("./ng-packagr-version");
|
|
5
5
|
const package_imports_1 = require("./package-imports");
|
|
6
6
|
function getStylesheetProcessorFactoryProvider() {
|
|
7
|
-
const { major: ngPackagrMajorVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
|
|
8
|
-
const { STYLESHEET_PROCESSOR_TOKEN } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/
|
|
7
|
+
const { major: ngPackagrMajorVersion, version: ngPackagrVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
|
|
8
|
+
const { STYLESHEET_PROCESSOR_TOKEN } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/lib/styles/stylesheet-processor.di', ngPackagrMajorVersion);
|
|
9
9
|
return {
|
|
10
10
|
provide: STYLESHEET_PROCESSOR_TOKEN,
|
|
11
11
|
useFactory: () => {
|
|
@@ -13,8 +13,12 @@ function getStylesheetProcessorFactoryProvider() {
|
|
|
13
13
|
const { getStylesheetProcessor, } = require('./v19+/stylesheet-processor');
|
|
14
14
|
return getStylesheetProcessor();
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
if (ngPackagrVersion !== '17.2.0') {
|
|
17
|
+
const { StylesheetProcessor, } = require('./pre-v19/stylesheet-processor');
|
|
18
|
+
return StylesheetProcessor;
|
|
19
|
+
}
|
|
20
|
+
const { AsyncStylesheetProcessor, } = require('./pre-v19/stylesheet-processor');
|
|
21
|
+
return AsyncStylesheetProcessor;
|
|
18
22
|
},
|
|
19
23
|
deps: [],
|
|
20
24
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Changes made:
|
|
5
5
|
* - Add the project root to the search directories.
|
|
6
6
|
*/
|
|
7
|
-
import type { NgPackageEntryConfig } from 'ng-packagr/
|
|
7
|
+
import type { NgPackageEntryConfig } from 'ng-packagr/ng-entrypoint.schema';
|
|
8
8
|
export declare enum CssUrl {
|
|
9
9
|
inline = "inline",
|
|
10
10
|
none = "none"
|
|
@@ -20,29 +20,22 @@ var CssUrl;
|
|
|
20
20
|
})(CssUrl || (exports.CssUrl = CssUrl = {}));
|
|
21
21
|
function getStylesheetProcessor() {
|
|
22
22
|
const { major: ngPackagrMajorVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
|
|
23
|
-
const { ComponentStylesheetBundler } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/
|
|
24
|
-
const { generateSearchDirectories, getTailwindConfig, loadPostcssConfiguration, } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/
|
|
23
|
+
const { ComponentStylesheetBundler } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/lib/styles/component-stylesheets', ngPackagrMajorVersion);
|
|
24
|
+
const { generateSearchDirectories, getTailwindConfig, loadPostcssConfiguration, } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/lib/styles/postcss-configuration', ngPackagrMajorVersion);
|
|
25
25
|
class StylesheetProcessor extends ComponentStylesheetBundler {
|
|
26
26
|
constructor(projectBasePath, basePath, cssUrl, includePaths, sass, cacheDirectory, watch) {
|
|
27
27
|
// By default, browserslist defaults are too inclusive
|
|
28
28
|
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
|
29
29
|
// We change the default query to browsers that Angular support.
|
|
30
|
-
// https://angular.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
'last 1 Firefox version',
|
|
40
|
-
'last 2 Edge major versions',
|
|
41
|
-
'last 2 Safari major versions',
|
|
42
|
-
'last 2 iOS major versions',
|
|
43
|
-
'Firefox ESR',
|
|
44
|
-
];
|
|
45
|
-
}
|
|
30
|
+
// https://angular.io/guide/browser-support
|
|
31
|
+
browserslist_1.default.defaults = [
|
|
32
|
+
'last 2 Chrome versions',
|
|
33
|
+
'last 1 Firefox version',
|
|
34
|
+
'last 2 Edge major versions',
|
|
35
|
+
'last 2 Safari major versions',
|
|
36
|
+
'last 2 iOS major versions',
|
|
37
|
+
'Firefox ESR',
|
|
38
|
+
];
|
|
46
39
|
const browserslistData = (0, browserslist_1.default)(undefined, { path: basePath });
|
|
47
40
|
let searchDirs = generateSearchDirectories([projectBasePath]);
|
|
48
41
|
const postcssConfiguration = loadPostcssConfiguration(searchDirs);
|
|
@@ -55,10 +55,6 @@ async function addLintingGenerator(tree, options) {
|
|
|
55
55
|
style: 'kebab-case',
|
|
56
56
|
},
|
|
57
57
|
],
|
|
58
|
-
// Temporary disable these rules until Angular ESLint recommended
|
|
59
|
-
// rules are updated with the new Style Guide
|
|
60
|
-
'@angular-eslint/component-class-suffix': 'off',
|
|
61
|
-
'@angular-eslint/directive-class-suffix': 'off',
|
|
62
58
|
},
|
|
63
59
|
});
|
|
64
60
|
(0, eslint_file_1.addOverrideToLintConfig)(tree, options.projectRoot, {
|
|
@@ -99,10 +95,6 @@ async function addLintingGenerator(tree, options) {
|
|
|
99
95
|
style: 'kebab-case',
|
|
100
96
|
},
|
|
101
97
|
],
|
|
102
|
-
// Temporary disable these rules until Angular ESLint recommended
|
|
103
|
-
// rules are updated with the new Style Guide
|
|
104
|
-
'@angular-eslint/component-class-suffix': 'off',
|
|
105
|
-
'@angular-eslint/directive-class-suffix': 'off',
|
|
106
98
|
},
|
|
107
99
|
},
|
|
108
100
|
{
|
|
@@ -5,12 +5,11 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
7
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
|
-
const convert_to_rspack_1 = require("../convert-to-rspack/convert-to-rspack");
|
|
9
8
|
const init_1 = require("../init/init");
|
|
9
|
+
const convert_to_rspack_1 = require("../convert-to-rspack/convert-to-rspack");
|
|
10
10
|
const setup_ssr_1 = require("../setup-ssr/setup-ssr");
|
|
11
11
|
const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
|
|
12
12
|
const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
|
|
13
|
-
const version_utils_1 = require("../utils/version-utils");
|
|
14
13
|
const lib_1 = require("./lib");
|
|
15
14
|
async function applicationGenerator(tree, schema) {
|
|
16
15
|
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'application');
|
|
@@ -84,25 +83,6 @@ async function applicationGenerator(tree, schema) {
|
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
|
-
if (!options.skipPackageJson) {
|
|
88
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
89
|
-
if (angularMajorVersion >= 20) {
|
|
90
|
-
const angularDevkitVersion = (0, version_utils_1.getInstalledAngularDevkitVersion)(tree) ??
|
|
91
|
-
(0, version_utils_1.versions)(tree).angularDevkitVersion;
|
|
92
|
-
const devDependencies = {};
|
|
93
|
-
if (options.bundler === 'esbuild') {
|
|
94
|
-
devDependencies['@angular/build'] = angularDevkitVersion;
|
|
95
|
-
}
|
|
96
|
-
else if (isRspack) {
|
|
97
|
-
devDependencies['@angular/build'] = angularDevkitVersion;
|
|
98
|
-
devDependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
devDependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
|
|
102
|
-
}
|
|
103
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, true);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
86
|
if (!options.skipFormat) {
|
|
107
87
|
await (0, devkit_1.formatFiles)(tree);
|
|
108
88
|
}
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
import { AppComponent } from './app.component';<% if(!minimal) { %>
|
|
3
|
+
import { NxWelcomeComponent } from './nx-welcome.component';<% } %><% if(routing && useRouterTestingModule) { %>
|
|
4
|
+
import { RouterTestingModule } from '@angular/router/testing';<% } %><% if(routing && !useRouterTestingModule) { %>
|
|
5
|
+
import { RouterModule } from '@angular/router';<% } %>
|
|
6
|
+
|
|
7
|
+
describe('AppComponent', () => {
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [<% if(routing && useRouterTestingModule) { %>RouterTestingModule<% } %><% if(routing && !useRouterTestingModule) { %>RouterModule.forRoot([])<% } %>],
|
|
11
|
+
declarations: [AppComponent<% if(!minimal) { %>, NxWelcomeComponent<% } %>]
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should render title', () => {
|
|
16
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
const compiled = fixture.nativeElement as HTMLElement;
|
|
19
|
+
expect(compiled.querySelector('h1')?.textContent).toContain(
|
|
20
|
+
'Welcome <%= appName %>'
|
|
21
|
+
);
|
|
22
|
+
});<% if(!minimal) { %>
|
|
23
|
+
|
|
24
|
+
it(`should have as title '<%= appName %>'`, () => {
|
|
25
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
26
|
+
const app = fixture.componentInstance;
|
|
27
|
+
expect(app.title).toEqual('<%= appName %>');
|
|
28
|
+
});<% } %>
|
|
29
|
+
});
|
|
@@ -3,12 +3,12 @@ import { Component<% if(viewEncapsulation) { %>, ViewEncapsulation<% } %> } from
|
|
|
3
3
|
@Component({
|
|
4
4
|
selector: '<%= rootSelector %>',<% if (setStandaloneFalse) { %>
|
|
5
5
|
standalone: false,<% } if(!inlineTemplate) { %>
|
|
6
|
-
templateUrl: './app
|
|
6
|
+
templateUrl: './app.component.html',<% } else { %>
|
|
7
7
|
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if(!inlineStyle) { %>
|
|
8
|
-
styleUrl: './app
|
|
8
|
+
styleUrl: './app.component.<%= style %>',<% } else { %>
|
|
9
9
|
styles: ``,<% } %><% if(viewEncapsulation) { %>
|
|
10
10
|
encapsulation: ViewEncapsulation.<%= viewEncapsulation %>,<% } %>
|
|
11
11
|
})
|
|
12
|
-
export class
|
|
12
|
+
export class AppComponent {<% if(!minimal) { %>
|
|
13
13
|
title = '<%= appName %>';
|
|
14
14
|
<% } %>}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { BrowserModule } from '@angular/platform-browser';<% if(routing) { %>
|
|
3
|
+
import { RouterModule } from '@angular/router';<% } %>
|
|
4
|
+
import { AppComponent } from './app.component';<% if(routing) { %>
|
|
5
|
+
import { appRoutes } from './app.routes';<% } %><% if(!minimal) { %>
|
|
6
|
+
import { NxWelcomeComponent } from './nx-welcome.component';<% } %>
|
|
7
|
+
|
|
8
|
+
@NgModule({
|
|
9
|
+
declarations: [AppComponent<% if(!minimal) { %>, NxWelcomeComponent<% } %>],
|
|
10
|
+
imports: [
|
|
11
|
+
BrowserModule,<% if(routing) { %>
|
|
12
|
+
RouterModule.forRoot(appRoutes),<% } %>
|
|
13
|
+
],
|
|
14
|
+
providers: [],
|
|
15
|
+
bootstrap: [AppComponent],
|
|
16
|
+
})
|
|
17
|
+
export class AppModule {}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
<%_ if (usePlatformBrowserDynamic) { _%>
|
|
2
1
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
3
|
-
|
|
4
|
-
import { platformBrowser } from '@angular/platform-browser';
|
|
5
|
-
<%_ } _%>
|
|
6
|
-
import { AppModule } from './app/app<%= moduleTypeSeparator %>module';
|
|
2
|
+
import { AppModule } from './app/app.module';
|
|
7
3
|
|
|
8
|
-
<%_ if (usePlatformBrowserDynamic) { _%>
|
|
9
4
|
platformBrowserDynamic()
|
|
10
|
-
<%
|
|
11
|
-
platformBrowser()
|
|
12
|
-
<%_ } _%>
|
|
13
|
-
.bootstrapModule(AppModule, {
|
|
5
|
+
.bootstrapModule(AppModule<% if (useEventCoalescing) { %>, {
|
|
14
6
|
ngZoneEventCoalescing: true
|
|
15
|
-
})
|
|
7
|
+
}<% } %>)
|
|
16
8
|
.catch((err) => console.error(err));
|
package/src/generators/application/files/standalone-components/src/app/app.component.__style__
ADDED
|
File without changes
|
package/src/generators/application/files/standalone-components/src/app/app.component.spec.ts__tpl__
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
import { AppComponent } from './app.component';<% if(!minimal) { %>
|
|
3
|
+
import { NxWelcomeComponent } from './nx-welcome.component';<% } %><% if(routing && useRouterTestingModule) { %>
|
|
4
|
+
import { RouterTestingModule } from '@angular/router/testing';<% } %><% if(routing && !useRouterTestingModule) { %>
|
|
5
|
+
import { RouterModule } from '@angular/router';<% } %>
|
|
6
|
+
|
|
7
|
+
describe('AppComponent', () => {
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [AppComponent<% if(!minimal) { %>, NxWelcomeComponent<% } %><% if(routing && useRouterTestingModule) { %>, RouterTestingModule<% } %><% if(routing && !useRouterTestingModule) { %>, RouterModule.forRoot([])<% } %>],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should render title', () => {
|
|
15
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
16
|
+
fixture.detectChanges();
|
|
17
|
+
const compiled = fixture.nativeElement as HTMLElement;
|
|
18
|
+
expect(compiled.querySelector('h1')?.textContent).toContain(
|
|
19
|
+
'Welcome <%= appName %>'
|
|
20
|
+
);
|
|
21
|
+
});<% if(!minimal) { %>
|
|
22
|
+
|
|
23
|
+
it(`should have as title '<%= appName %>'`, () => {
|
|
24
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
25
|
+
const app = fixture.componentInstance;
|
|
26
|
+
expect(app.title).toEqual('<%= appName %>');
|
|
27
|
+
});<% } %>
|
|
28
|
+
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Component<% if(viewEncapsulation) { %>, ViewEncapsulation<% } %> } from '@angular/core';<% if(routing) { %>
|
|
2
2
|
import { RouterModule } from '@angular/router';<% } %><% if(!minimal) { %>
|
|
3
|
-
import {
|
|
3
|
+
import { NxWelcomeComponent } from './nx-welcome.component';<% } %>
|
|
4
4
|
|
|
5
5
|
@Component({<% if (setStandaloneTrue) { %>
|
|
6
6
|
standalone: true,<% } %>
|
|
7
|
-
imports: [<% if(!minimal) { %>
|
|
7
|
+
imports: [<% if(!minimal) { %>NxWelcomeComponent, <% } %><% if(routing) { %>RouterModule<% } %>],
|
|
8
8
|
selector: '<%= rootSelector %>',<% if(!inlineTemplate) { %>
|
|
9
|
-
templateUrl: './app
|
|
9
|
+
templateUrl: './app.component.html',<% } else { %>
|
|
10
10
|
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if(!inlineStyle) { %>
|
|
11
|
-
styleUrl: './app
|
|
11
|
+
styleUrl: './app.component.<%= style %>',<% } else { %>
|
|
12
12
|
styles: ``,<% } %><% if(viewEncapsulation) { %>
|
|
13
13
|
encapsulation: ViewEncapsulation.<%= viewEncapsulation %>,<% } %>
|
|
14
14
|
})
|
|
15
|
-
export class
|
|
15
|
+
export class AppComponent {<% if(!minimal) { %>
|
|
16
16
|
title = '<%= appName %>';
|
|
17
17
|
<% } %>}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { ApplicationConfig<% if (
|
|
1
|
+
import { ApplicationConfig<% if (useEventCoalescing) { %>, provideZoneChangeDetection<% } %> } from '@angular/core';<% if (routing) { %>
|
|
2
2
|
import { provideRouter } from '@angular/router';
|
|
3
3
|
import { appRoutes } from './app.routes';<% } %>
|
|
4
4
|
|
|
5
5
|
export const appConfig: ApplicationConfig = {
|
|
6
|
-
providers: [<% if (
|
|
7
|
-
provideBrowserGlobalErrorListeners(),<% } %>
|
|
8
|
-
provideZoneChangeDetection({ eventCoalescing: true })<% if (routing) { %>,
|
|
9
|
-
provideRouter(appRoutes)<% } %>
|
|
10
|
-
]
|
|
6
|
+
providers: [<% if (useEventCoalescing) { %>provideZoneChangeDetection({ eventCoalescing: true }), <% } %><% if (routing) { %>provideRouter(appRoutes) <% } %>]
|
|
11
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { bootstrapApplication } from '@angular/platform-browser';
|
|
2
2
|
import { appConfig } from './app/app.config';
|
|
3
|
-
import {
|
|
3
|
+
import { AppComponent } from './app/app.component';
|
|
4
4
|
|
|
5
|
-
bootstrapApplication(
|
|
5
|
+
bootstrapApplication(AppComponent, appConfig).catch((err) =>
|
|
6
6
|
console.error(err)
|
|
7
7
|
);
|
|
@@ -3,13 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createFiles = createFiles;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
7
6
|
const semver_1 = require("semver");
|
|
8
7
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
9
|
-
const artifact_types_1 = require("../../utils/artifact-types");
|
|
10
8
|
const selector_1 = require("../../utils/selector");
|
|
11
9
|
const update_project_root_tsconfig_1 = require("../../utils/update-project-root-tsconfig");
|
|
12
10
|
const version_utils_1 = require("../../utils/version-utils");
|
|
11
|
+
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
13
12
|
async function createFiles(tree, options, rootOffset) {
|
|
14
13
|
const { major: angularMajorVersion, version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
15
14
|
const isUsingApplicationBuilder = options.bundler === 'esbuild';
|
|
@@ -21,9 +20,6 @@ async function createFiles(tree, options, rootOffset) {
|
|
|
21
20
|
const onBoardingStatus = await (0, onboarding_1.createNxCloudOnboardingURLForWelcomeApp)(tree, options.nxCloudToken);
|
|
22
21
|
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
23
22
|
(await (0, onboarding_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
24
|
-
const componentType = (0, artifact_types_1.getComponentType)(tree);
|
|
25
|
-
const componentFileSuffix = componentType ? `.${componentType}` : '';
|
|
26
|
-
const moduleTypeSeparator = (0, artifact_types_1.getModuleTypeSeparator)(tree);
|
|
27
23
|
const substitutions = {
|
|
28
24
|
rootSelector,
|
|
29
25
|
appName: options.name,
|
|
@@ -40,14 +36,11 @@ async function createFiles(tree, options, rootOffset) {
|
|
|
40
36
|
rootOffset,
|
|
41
37
|
isUsingApplicationBuilder,
|
|
42
38
|
disableModernClassFieldsBehavior,
|
|
43
|
-
|
|
39
|
+
useEventCoalescing: angularMajorVersion >= 18,
|
|
40
|
+
useRouterTestingModule: angularMajorVersion < 18,
|
|
41
|
+
// Angular v19 or higher defaults to true, while v18 or lower defaults to false
|
|
44
42
|
setStandaloneFalse: angularMajorVersion >= 19,
|
|
45
43
|
setStandaloneTrue: angularMajorVersion < 19,
|
|
46
|
-
provideGlobalErrorListener: angularMajorVersion >= 20,
|
|
47
|
-
usePlatformBrowserDynamic: angularMajorVersion < 20,
|
|
48
|
-
componentType: componentType ? (0, devkit_1.names)(componentType).className : '',
|
|
49
|
-
componentFileSuffix,
|
|
50
|
-
moduleTypeSeparator,
|
|
51
44
|
connectCloudUrl,
|
|
52
45
|
tutorialUrl: options.standalone
|
|
53
46
|
? 'https://nx.dev/getting-started/tutorials/angular-standalone-tutorial?utm_source=nx-project'
|
|
@@ -56,6 +49,12 @@ async function createFiles(tree, options, rootOffset) {
|
|
|
56
49
|
};
|
|
57
50
|
const angularAppType = options.standalone ? 'standalone' : 'ng-module';
|
|
58
51
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base'), options.appProjectRoot, substitutions);
|
|
52
|
+
if (angularMajorVersion >= 18) {
|
|
53
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base-18+'), options.appProjectRoot, substitutions);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base-pre18'), options.appProjectRoot, substitutions);
|
|
57
|
+
}
|
|
59
58
|
if (options.standalone) {
|
|
60
59
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/standalone-components'), options.appProjectRoot, substitutions);
|
|
61
60
|
}
|
|
@@ -68,15 +67,15 @@ async function createFiles(tree, options, rootOffset) {
|
|
|
68
67
|
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, '/src/app/app.routes.ts'));
|
|
69
68
|
}
|
|
70
69
|
if (options.skipTests || options.unitTestRunner === test_runners_1.UnitTestRunner.None) {
|
|
71
|
-
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot,
|
|
70
|
+
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, '/src/app/app.component.spec.ts'));
|
|
72
71
|
}
|
|
73
72
|
if (options.inlineTemplate) {
|
|
74
|
-
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot,
|
|
73
|
+
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, '/src/app/app.component.html'));
|
|
75
74
|
}
|
|
76
75
|
if (options.inlineStyle) {
|
|
77
|
-
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot,
|
|
76
|
+
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, `/src/app/app.component.${options.style}`));
|
|
78
77
|
}
|
|
79
78
|
if (options.minimal) {
|
|
80
|
-
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot,
|
|
79
|
+
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/app/nx-welcome.component.ts'));
|
|
81
80
|
}
|
|
82
81
|
}
|