@nx/angular 17.3.0-rc.1 → 17.3.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.
Files changed (61) hide show
  1. package/executors.d.ts +1 -1
  2. package/generators.json +6 -1
  3. package/package.json +10 -10
  4. package/src/builders/dev-server/dev-server.impl.js +1 -1
  5. package/src/builders/dev-server/schema.json +1 -1
  6. package/src/executors/module-federation-dev-server/schema.json +1 -1
  7. package/src/executors/ng-packagr-lite/schema.json +1 -1
  8. package/src/executors/package/schema.json +1 -1
  9. package/src/generators/add-linting/schema.json +1 -1
  10. package/src/generators/application/schema.json +4 -4
  11. package/src/generators/component/schema.d.ts +3 -3
  12. package/src/generators/component/schema.json +2 -2
  13. package/src/generators/component-cypress-spec/schema.json +1 -1
  14. package/src/generators/component-test/schema.json +1 -1
  15. package/src/generators/convert-to-application-executor/convert-to-application-executor.d.ts +4 -0
  16. package/src/generators/convert-to-application-executor/convert-to-application-executor.js +240 -0
  17. package/src/generators/convert-to-application-executor/schema.d.ts +4 -0
  18. package/src/generators/convert-to-application-executor/schema.json +26 -0
  19. package/src/generators/directive/schema.d.ts +3 -3
  20. package/src/generators/directive/schema.json +2 -2
  21. package/src/generators/federate-module/schema.json +1 -1
  22. package/src/generators/host/schema.json +4 -4
  23. package/src/generators/init/schema.json +1 -1
  24. package/src/generators/library/schema.json +1 -1
  25. package/src/generators/library-secondary-entry-point/schema.json +1 -1
  26. package/src/generators/move/schema.json +1 -1
  27. package/src/generators/ng-add/schema.json +1 -1
  28. package/src/generators/ngrx/schema.json +1 -1
  29. package/src/generators/ngrx-feature-store/schema.json +1 -1
  30. package/src/generators/ngrx-root-store/schema.json +1 -1
  31. package/src/generators/pipe/schema.d.ts +3 -3
  32. package/src/generators/pipe/schema.json +2 -2
  33. package/src/generators/remote/schema.json +4 -4
  34. package/src/generators/scam/schema.d.ts +3 -3
  35. package/src/generators/scam/schema.json +2 -2
  36. package/src/generators/scam-directive/schema.d.ts +3 -3
  37. package/src/generators/scam-directive/schema.json +2 -2
  38. package/src/generators/scam-pipe/schema.d.ts +3 -3
  39. package/src/generators/scam-pipe/schema.json +2 -2
  40. package/src/generators/scam-to-standalone/schema.json +1 -1
  41. package/src/generators/setup-mf/schema.json +1 -1
  42. package/src/generators/setup-ssr/files/server/application-builder/__serverFileName__ +1 -1
  43. package/src/generators/setup-ssr/lib/add-hydration.js +11 -5
  44. package/src/generators/setup-ssr/lib/add-server-file.d.ts +3 -0
  45. package/src/generators/setup-ssr/lib/add-server-file.js +31 -0
  46. package/src/generators/setup-ssr/lib/constants.d.ts +3 -0
  47. package/src/generators/setup-ssr/lib/constants.js +6 -0
  48. package/src/generators/setup-ssr/lib/generate-files.js +9 -11
  49. package/src/generators/setup-ssr/lib/generate-server-ts-config.js +7 -4
  50. package/src/generators/setup-ssr/lib/index.d.ts +1 -0
  51. package/src/generators/setup-ssr/lib/index.js +1 -0
  52. package/src/generators/setup-ssr/lib/update-project-config.js +20 -1
  53. package/src/generators/setup-ssr/schema.json +1 -1
  54. package/src/generators/setup-ssr/setup-ssr.js +3 -1
  55. package/src/generators/setup-tailwind/schema.json +1 -1
  56. package/src/generators/stories/schema.json +1 -1
  57. package/src/generators/storybook-configuration/schema.json +4 -4
  58. package/src/generators/storybook-configuration/storybook-configuration.js +1 -1
  59. package/src/migrations/update-17-1-0/replace-nguniversal-engines.js +2 -14
  60. package/src/utils/targets.d.ts +2 -0
  61. package/src/utils/targets.js +17 -0
@@ -11,15 +11,15 @@ export interface Schema {
11
11
  export?: boolean;
12
12
  skipFormat?: boolean;
13
13
  /**
14
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18.
14
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
15
15
  */
16
16
  flat?: boolean;
17
17
  /**
18
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v18.
18
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v19.
19
19
  */
20
20
  path?: string;
21
21
  /**
22
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18.
22
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
23
23
  */
24
24
  project?: string;
25
25
  }
@@ -34,13 +34,13 @@
34
34
  "$source": "projectName"
35
35
  },
36
36
  "x-dropdown": "projects",
37
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18."
37
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
38
38
  },
39
39
  "flat": {
40
40
  "type": "boolean",
41
41
  "default": true,
42
42
  "description": "When true (the default) creates files at the top level of the project.",
43
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18."
43
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
44
44
  },
45
45
  "skipTests": {
46
46
  "type": "boolean",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "NxMFRemote",
4
4
  "cli": "nx",
5
5
  "title": "Nx Module Federation Remote App",
@@ -55,15 +55,15 @@
55
55
  },
56
56
  {
57
57
  "value": "scss",
58
- "label": "SASS(.scss) [ http://sass-lang.com ]"
58
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
59
59
  },
60
60
  {
61
61
  "value": "sass",
62
- "label": "SASS(.sass) [ http://sass-lang.com ]"
62
+ "label": "SASS(.sass) [ https://sass-lang.com ]"
63
63
  },
64
64
  {
65
65
  "value": "less",
66
- "label": "LESS [ http://lesscss.org ]"
66
+ "label": "LESS [ https://lesscss.org ]"
67
67
  }
68
68
  ]
69
69
  }
@@ -19,15 +19,15 @@ export interface Schema {
19
19
  export?: boolean;
20
20
  skipFormat?: boolean;
21
21
  /**
22
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18.
22
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
23
23
  */
24
24
  flat?: boolean;
25
25
  /**
26
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v18.
26
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v19.
27
27
  */
28
28
  path?: string;
29
29
  /**
30
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18.
30
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
31
31
  */
32
32
  project?: string;
33
33
  }
@@ -40,7 +40,7 @@
40
40
  "$source": "projectName"
41
41
  },
42
42
  "x-dropdown": "projects",
43
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18."
43
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
44
44
  },
45
45
  "displayBlock": {
46
46
  "description": "Specifies if the style will contain `:host { display: block; }`.",
@@ -94,7 +94,7 @@
94
94
  "type": "boolean",
95
95
  "description": "Create the new files at the top level of the current project.",
96
96
  "default": false,
97
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18."
97
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
98
98
  },
99
99
  "selector": {
100
100
  "type": "string",
@@ -11,15 +11,15 @@ export interface Schema {
11
11
  export?: boolean;
12
12
  skipFormat?: boolean;
13
13
  /**
14
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18.
14
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
15
15
  */
16
16
  flat?: boolean;
17
17
  /**
18
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v18.
18
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v19.
19
19
  */
20
20
  path?: string;
21
21
  /**
22
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18.
22
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
23
23
  */
24
24
  project?: string;
25
25
  }
@@ -41,7 +41,7 @@
41
41
  "$source": "projectName"
42
42
  },
43
43
  "x-dropdown": "projects",
44
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18."
44
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
45
45
  },
46
46
  "skipTests": {
47
47
  "type": "boolean",
@@ -58,7 +58,7 @@
58
58
  "type": "boolean",
59
59
  "description": "Create the new files at the top level of the current project.",
60
60
  "default": true,
61
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18."
61
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
62
62
  },
63
63
  "selector": {
64
64
  "type": "string",
@@ -9,15 +9,15 @@ export interface Schema {
9
9
  export?: boolean;
10
10
  skipFormat?: boolean;
11
11
  /**
12
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18.
12
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
13
13
  */
14
14
  flat?: boolean;
15
15
  /**
16
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v18.
16
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v19.
17
17
  */
18
18
  path?: string;
19
19
  /**
20
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18.
20
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
21
21
  */
22
22
  project?: string;
23
23
  }
@@ -41,7 +41,7 @@
41
41
  "$source": "projectName"
42
42
  },
43
43
  "x-dropdown": "projects",
44
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18."
44
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
45
45
  },
46
46
  "skipTests": {
47
47
  "type": "boolean",
@@ -58,7 +58,7 @@
58
58
  "type": "boolean",
59
59
  "description": "Create the new files at the top level of the current project.",
60
60
  "default": true,
61
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18."
61
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
62
62
  },
63
63
  "export": {
64
64
  "type": "boolean",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "GeneratorAngularScamToStandalone",
4
4
  "cli": "nx",
5
5
  "title": "Convert an Inline SCAM to Standalone Component",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "GeneratorAngularMFSetup",
4
4
  "cli": "nx",
5
5
  "title": "Generate Module Federation Setup for Angular App",
@@ -9,7 +9,7 @@ import <% if (standalone) { %>bootstrap<% } else { %>{ <%= rootModuleClassName %
9
9
  export function app(): express.Express {
10
10
  const server = express();
11
11
  const serverDistFolder = dirname(fileURLToPath(import.meta.url));
12
- const browserDistFolder = resolve(serverDistFolder, '../browser');
12
+ const browserDistFolder = resolve(serverDistFolder, '../<%= browserBundleOutputPath %>');
13
13
  const indexHtml = join(serverDistFolder, 'index.server.html');
14
14
 
15
15
  const commonEngine = new CommonEngine();
@@ -2,23 +2,29 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addHydration = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
6
- const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
7
5
  const js_1 = require("@nx/js");
6
+ const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
7
+ const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
8
8
  let tsModule;
9
+ let tsquery;
9
10
  function addHydration(tree, options) {
10
11
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
11
12
  if (!tsModule) {
12
13
  tsModule = (0, ensure_typescript_1.ensureTypescript)();
14
+ tsquery = require('@phenomnomnominal/tsquery').tsquery;
13
15
  }
14
- const addImport = (source, symbolName, packageName, filePath, isDefault = false) => {
15
- return (0, js_1.insertImport)(tree, source, filePath, symbolName, packageName, isDefault);
16
- };
17
16
  const pathToClientConfigFile = options.standalone
18
17
  ? (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'app/app.config.ts')
19
18
  : (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'app/app.module.ts');
20
19
  const sourceText = tree.read(pathToClientConfigFile, 'utf-8');
21
20
  let sourceFile = tsModule.createSourceFile(pathToClientConfigFile, sourceText, tsModule.ScriptTarget.Latest, true);
21
+ const provideClientHydrationCallExpression = tsquery(sourceFile, 'ObjectLiteralExpression PropertyAssignment:has(Identifier[name=providers]) ArrayLiteralExpression CallExpression:has(Identifier[name=provideClientHydration])')[0];
22
+ if (provideClientHydrationCallExpression) {
23
+ return;
24
+ }
25
+ const addImport = (source, symbolName, packageName, filePath, isDefault = false) => {
26
+ return (0, js_1.insertImport)(tree, source, filePath, symbolName, packageName, isDefault);
27
+ };
22
28
  sourceFile = addImport(sourceFile, 'provideClientHydration', '@angular/platform-browser', pathToClientConfigFile);
23
29
  if (options.standalone) {
24
30
  (0, ast_utils_1.addProviderToAppConfig)(tree, pathToClientConfigFile, 'provideClientHydration()');
@@ -0,0 +1,3 @@
1
+ import type { Tree } from '@nx/devkit';
2
+ import type { Schema } from '../schema';
3
+ export declare function addServerFile(tree: Tree, schema: Schema, isUsingApplicationBuilder: boolean): void;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addServerFile = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const version_utils_1 = require("../../utils/version-utils");
6
+ const constants_1 = require("./constants");
7
+ function addServerFile(tree, schema, isUsingApplicationBuilder) {
8
+ const { root: projectRoot, targets } = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
9
+ const { outputPath } = targets.build.options;
10
+ const browserBundleOutputPath = isUsingApplicationBuilder
11
+ ? getApplicationBuilderBrowserOutputPath(outputPath)
12
+ : outputPath;
13
+ const pathToFiles = (0, devkit_1.joinPathFragments)(__dirname, '..', 'files');
14
+ const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
15
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'server', ...(isUsingApplicationBuilder
16
+ ? ['application-builder']
17
+ : angularMajorVersion >= 17
18
+ ? ['server-builder', 'v17+']
19
+ : ['server-builder', 'pre-v17'])), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
20
+ }
21
+ exports.addServerFile = addServerFile;
22
+ function getApplicationBuilderBrowserOutputPath(outputPath) {
23
+ if (outputPath) {
24
+ if (typeof outputPath === 'string') {
25
+ // when `outputPath` is a string, it's the base path, so we return the default browser path
26
+ return constants_1.DEFAULT_BROWSER_DIR;
27
+ }
28
+ return outputPath.browser ?? constants_1.DEFAULT_BROWSER_DIR;
29
+ }
30
+ return constants_1.DEFAULT_BROWSER_DIR;
31
+ }
@@ -0,0 +1,3 @@
1
+ export declare const DEFAULT_BROWSER_DIR = "browser";
2
+ export declare const DEFAULT_MEDIA_DIR = "media";
3
+ export declare const DEFAULT_SERVER_DIR = "server";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_SERVER_DIR = exports.DEFAULT_MEDIA_DIR = exports.DEFAULT_BROWSER_DIR = void 0;
4
+ exports.DEFAULT_BROWSER_DIR = 'browser';
5
+ exports.DEFAULT_MEDIA_DIR = 'media';
6
+ exports.DEFAULT_SERVER_DIR = 'server';
@@ -6,23 +6,21 @@ const semver_1 = require("semver");
6
6
  const version_utils_1 = require("../../utils/version-utils");
7
7
  function generateSSRFiles(tree, schema, isUsingApplicationBuilder) {
8
8
  const { root: projectRoot, targets } = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
9
- const baseOutputPath = targets.build.options.outputPath;
10
- const browserBundleOutputPath = (0, devkit_1.joinPathFragments)(baseOutputPath, 'browser');
9
+ if (targets.server ||
10
+ (isUsingApplicationBuilder && targets.build.options?.server !== undefined)) {
11
+ // server has already been added
12
+ return;
13
+ }
11
14
  const pathToFiles = (0, devkit_1.joinPathFragments)(__dirname, '..', 'files');
12
- const { version: angularVersion, major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
15
+ const { version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
13
16
  if (schema.standalone) {
14
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'standalone'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
17
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'standalone'), projectRoot, { ...schema, tpl: '' });
15
18
  }
16
19
  else {
17
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'base'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
20
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'base'), projectRoot, { ...schema, tpl: '' });
18
21
  if ((0, semver_1.lt)(angularVersion, '15.2.0')) {
19
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'pre-v15-2'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
22
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'pre-v15-2'), projectRoot, { ...schema, tpl: '' });
20
23
  }
21
24
  }
22
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'server', ...(isUsingApplicationBuilder
23
- ? ['application-builder']
24
- : angularMajorVersion >= 17
25
- ? ['server-builder', 'v17+']
26
- : ['server-builder', 'pre-v17'])), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
27
25
  }
28
26
  exports.generateSSRFiles = generateSSRFiles;
@@ -7,11 +7,14 @@ function setServerTsConfigOptionsForApplicationBuilder(tree, options) {
7
7
  const { targets } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
8
8
  const tsConfigPath = targets.build.options.tsConfig;
9
9
  (0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
10
- json.files ??= [];
11
- json.files.push((0, devkit_1.joinPathFragments)('src', options.main), (0, devkit_1.joinPathFragments)(options.serverFileName));
10
+ const files = new Set(json.files ?? []);
11
+ files.add((0, devkit_1.joinPathFragments)('src', options.main));
12
+ files.add((0, devkit_1.joinPathFragments)(options.serverFileName));
13
+ json.files = Array.from(files);
12
14
  json.compilerOptions ??= {};
13
- json.compilerOptions.types ??= [];
14
- json.compilerOptions.types.push('node');
15
+ const types = new Set(json.compilerOptions.types ?? []);
16
+ types.add('node');
17
+ json.compilerOptions.types = Array.from(types);
15
18
  return json;
16
19
  });
17
20
  }
@@ -1,4 +1,5 @@
1
1
  export * from './add-dependencies';
2
+ export * from './add-server-file';
2
3
  export * from './generate-files';
3
4
  export * from './generate-server-ts-config';
4
5
  export * from './normalize-options';
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./add-dependencies"), exports);
5
+ tslib_1.__exportStar(require("./add-server-file"), exports);
5
6
  tslib_1.__exportStar(require("./generate-files"), exports);
6
7
  tslib_1.__exportStar(require("./generate-server-ts-config"), exports);
7
8
  tslib_1.__exportStar(require("./normalize-options"), exports);
@@ -3,10 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateProjectConfigForBrowserBuilder = exports.updateProjectConfigForApplicationBuilder = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const version_utils_1 = require("../../utils/version-utils");
6
+ const constants_1 = require("./constants");
6
7
  function updateProjectConfigForApplicationBuilder(tree, options) {
7
8
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
8
9
  const buildTarget = project.targets.build;
10
+ let outputPath = buildTarget.options?.outputPath;
11
+ if (outputPath &&
12
+ typeof outputPath !== 'string' &&
13
+ outputPath.browser === '') {
14
+ const base = outputPath.base;
15
+ devkit_1.logger.warn(`The output location of the browser build has been updated from "${base}" to "${(0, devkit_1.joinPathFragments)(base, constants_1.DEFAULT_BROWSER_DIR)}".
16
+ You might need to adjust your deployment pipeline.`);
17
+ if ((outputPath.media && outputPath.media !== constants_1.DEFAULT_MEDIA_DIR) ||
18
+ (outputPath.server && outputPath.server !== constants_1.DEFAULT_SERVER_DIR)) {
19
+ delete outputPath.browser;
20
+ }
21
+ else {
22
+ outputPath = outputPath.base;
23
+ }
24
+ }
9
25
  buildTarget.options ??= {};
26
+ buildTarget.options.outputPath = outputPath;
10
27
  buildTarget.options.server = (0, devkit_1.joinPathFragments)(project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src'), options.main);
11
28
  buildTarget.options.prerender = true;
12
29
  buildTarget.options.ssr = {
@@ -29,7 +46,9 @@ function updateProjectConfigForBrowserBuilder(tree, schema) {
29
46
  }
30
47
  projectConfig.targets.server = {
31
48
  dependsOn: ['build'],
32
- executor: '@angular-devkit/build-angular:server',
49
+ executor: buildTarget.executor.startsWith('@angular-devkit/build-angular:')
50
+ ? '@angular-devkit/build-angular:server'
51
+ : '@nx/angular:webpack-server',
33
52
  options: {
34
53
  outputPath: (0, devkit_1.joinPathFragments)(baseOutputPath, 'server'),
35
54
  main: (0, devkit_1.joinPathFragments)(projectConfig.root, schema.serverFileName),
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "GeneratorAngularUniversalSetup",
4
4
  "cli": "nx",
5
5
  "title": "Generate Angular Universal (SSR) setup for an Angular App",
@@ -8,7 +8,8 @@ async function setupSsr(tree, schema) {
8
8
  (0, lib_1.validateOptions)(tree, schema);
9
9
  const options = (0, lib_1.normalizeOptions)(tree, schema);
10
10
  const { targets } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
11
- const isUsingApplicationBuilder = targets.build.executor === '@angular-devkit/build-angular:application';
11
+ const isUsingApplicationBuilder = targets.build.executor === '@angular-devkit/build-angular:application' ||
12
+ targets.build.executor === '@nx/angular:application';
12
13
  (0, lib_1.addDependencies)(tree, isUsingApplicationBuilder);
13
14
  (0, lib_1.generateSSRFiles)(tree, options, isUsingApplicationBuilder);
14
15
  if (!options.standalone) {
@@ -29,6 +30,7 @@ async function setupSsr(tree, schema) {
29
30
  (0, lib_1.updateProjectConfigForBrowserBuilder)(tree, options);
30
31
  (0, lib_1.generateTsConfigServerJsonForBrowserBuilder)(tree, options);
31
32
  }
33
+ (0, lib_1.addServerFile)(tree, options, isUsingApplicationBuilder);
32
34
  if (!options.skipFormat) {
33
35
  await (0, devkit_1.formatFiles)(tree);
34
36
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "NxAngularTailwindSetupGenerator",
4
4
  "cli": "nx",
5
5
  "title": "Configures Tailwind CSS for an application or a buildable/publishable library.",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "NxAngularStorybookStoriesGenerator",
4
4
  "title": "Create Storybook stories/specs",
5
5
  "description": "Creates Storybook stories/specs for all Angular components declared in a project.",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "$id": "NxAngularStorybookConfigurationGenerator",
4
4
  "title": "Adds Storybook configuration to a project.",
5
5
  "description": "Adds Storybook configuration to a project to be able to use and create stories.",
@@ -29,7 +29,7 @@
29
29
  "configureCypress": {
30
30
  "type": "boolean",
31
31
  "description": "Specifies whether to configure Cypress or not.",
32
- "x-deprecated": "Use interactionTests instead. This option will be removed in v18."
32
+ "x-deprecated": "Use interactionTests instead. This option will be removed in v19."
33
33
  },
34
34
  "generateStories": {
35
35
  "type": "boolean",
@@ -41,7 +41,7 @@
41
41
  "generateCypressSpecs": {
42
42
  "type": "boolean",
43
43
  "description": "Specifies whether to automatically generate test files in the generated Cypress e2e app.",
44
- "x-deprecated": "Use interactionTests instead. This option will be removed in v18."
44
+ "x-deprecated": "Use interactionTests instead. This option will be removed in v19."
45
45
  },
46
46
  "configureStaticServe": {
47
47
  "type": "boolean",
@@ -53,7 +53,7 @@
53
53
  "cypressDirectory": {
54
54
  "type": "string",
55
55
  "description": "A directory where the Cypress project will be placed. Placed at the root by default.",
56
- "x-deprecated": "Use interactionTests instead. This option will be removed in v18."
56
+ "x-deprecated": "Use interactionTests instead. This option will be removed in v19."
57
57
  },
58
58
  "linter": {
59
59
  "description": "The tool to use for running lint checks.",
@@ -6,7 +6,7 @@ const assert_compatible_storybook_version_1 = require("./lib/assert-compatible-s
6
6
  const generate_stories_1 = require("./lib/generate-stories");
7
7
  const generate_storybook_configuration_1 = require("./lib/generate-storybook-configuration");
8
8
  const validate_options_1 = require("./lib/validate-options");
9
- // TODO(katerina): Nx 18 -> remove Cypress
9
+ // TODO(katerina): Nx 19 -> remove Cypress
10
10
  async function storybookConfigurationGenerator(tree, options) {
11
11
  (0, assert_compatible_storybook_version_1.assertCompatibleStorybookVersion)();
12
12
  (0, validate_options_1.validateOptions)(options);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const devkit_1 = require("@nx/devkit");
4
4
  const path_1 = require("path");
5
5
  const version_utils_1 = require("../../generators/utils/version-utils");
6
+ const targets_1 = require("../../utils/targets");
6
7
  const projects_1 = require("../utils/projects");
7
8
  const UNIVERSAL_PACKAGES = [
8
9
  '@nguniversal/common',
@@ -38,7 +39,7 @@ async function default_1(tree) {
38
39
  continue;
39
40
  }
40
41
  const outputPath = project.targets.build?.options?.outputPath;
41
- for (const [, { main }] of allTargetOptions(target)) {
42
+ for (const [, { main }] of (0, targets_1.allTargetOptions)(target)) {
42
43
  if (typeof main === 'string' &&
43
44
  typeof outputPath === 'string' &&
44
45
  tree.read(main, 'utf-8').includes('ngExpressEngine')) {
@@ -91,19 +92,6 @@ async function default_1(tree) {
91
92
  await (0, devkit_1.formatFiles)(tree);
92
93
  }
93
94
  exports.default = default_1;
94
- function* allTargetOptions(target) {
95
- if (target.options) {
96
- yield [undefined, target.options];
97
- }
98
- if (!target.configurations) {
99
- return;
100
- }
101
- for (const [name, options] of Object.entries(target.configurations)) {
102
- if (options !== undefined) {
103
- yield [name, options];
104
- }
105
- }
106
- }
107
95
  const TOKENS_FILE_CONTENT = `
108
96
  import { InjectionToken } from '@angular/core';
109
97
  import { Request, Response } from 'express';
@@ -0,0 +1,2 @@
1
+ import { TargetConfiguration } from '@nx/devkit';
2
+ export declare function allTargetOptions<T>(target: TargetConfiguration<T>): Iterable<[string | undefined, T]>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allTargetOptions = void 0;
4
+ function* allTargetOptions(target) {
5
+ if (target.options) {
6
+ yield [undefined, target.options];
7
+ }
8
+ if (!target.configurations) {
9
+ return;
10
+ }
11
+ for (const [name, options] of Object.entries(target.configurations)) {
12
+ if (options !== undefined) {
13
+ yield [name, options];
14
+ }
15
+ }
16
+ }
17
+ exports.allTargetOptions = allTargetOptions;