@nx/next 18.0.0-beta.0 → 18.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/generators.json +2 -2
  2. package/migrations.json +9 -0
  3. package/package.json +10 -10
  4. package/plugins/component-testing.d.ts +1 -11
  5. package/plugins/component-testing.js +22 -7
  6. package/plugins/with-nx.js +1 -1
  7. package/plugins/with-stylus.js +1 -1
  8. package/src/executors/build/schema.json +1 -1
  9. package/src/generators/application/application.js +5 -0
  10. package/src/generators/application/lib/add-e2e.js +1 -0
  11. package/src/generators/application/lib/add-linting.js +1 -0
  12. package/src/generators/application/lib/create-application-files.helpers.js +19 -0
  13. package/src/generators/application/lib/normalize-options.js +1 -0
  14. package/src/generators/application/schema.d.ts +1 -0
  15. package/src/generators/application/schema.json +3 -3
  16. package/src/generators/component/component.d.ts +4 -4
  17. package/src/generators/component/component.js +1 -1
  18. package/src/generators/component/schema.json +7 -7
  19. package/src/generators/custom-server/schema.json +1 -1
  20. package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +1 -0
  21. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +23 -9
  22. package/src/generators/cypress-component-configuration/schema.d.ts +1 -0
  23. package/src/generators/cypress-component-configuration/schema.json +1 -1
  24. package/src/generators/init/init.d.ts +2 -1
  25. package/src/generators/init/init.js +11 -6
  26. package/src/generators/init/schema.d.ts +1 -0
  27. package/src/generators/init/schema.json +1 -1
  28. package/src/generators/library/lib/normalize-options.js +1 -0
  29. package/src/generators/library/library.js +1 -0
  30. package/src/generators/library/schema.d.ts +1 -0
  31. package/src/generators/library/schema.json +3 -3
  32. package/src/generators/page/page.js +1 -1
  33. package/src/generators/page/schema.d.ts +2 -2
  34. package/src/generators/page/schema.json +5 -5
package/generators.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "extends": ["@nx/react"],
5
5
  "generators": {
6
6
  "init": {
7
- "factory": "./src/generators/init/init#nextInitGenerator",
7
+ "factory": "./src/generators/init/init#nextInitGeneratorInternal",
8
8
  "schema": "./src/generators/init/schema.json",
9
9
  "description": "Initialize the `@nrwl/next` plugin.",
10
10
  "hidden": true
@@ -39,7 +39,7 @@
39
39
  "description": "Set up a custom server."
40
40
  },
41
41
  "cypress-component-configuration": {
42
- "factory": "./src/generators/cypress-component-configuration/cypress-component-configuration",
42
+ "factory": "./src/generators/cypress-component-configuration/cypress-component-configuration#cypressComponentConfigurationInternal",
43
43
  "schema": "./src/generators/cypress-component-configuration/schema.json",
44
44
  "description": "cypress-component-configuration generator"
45
45
  }
package/migrations.json CHANGED
@@ -83,6 +83,15 @@
83
83
  "alwaysAddToPackageJson": false
84
84
  }
85
85
  }
86
+ },
87
+ "17.3.1-beta.0": {
88
+ "version": "17.3.1-beta.0",
89
+ "packages": {
90
+ "next": {
91
+ "version": "14.0.4",
92
+ "alwaysAddToPackageJson": false
93
+ }
94
+ }
86
95
  }
87
96
  }
88
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/next",
3
- "version": "18.0.0-beta.0",
3
+ "version": "18.0.0-beta.2",
4
4
  "private": false,
5
5
  "description": "The Next.js plugin for Nx contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n\n- Integration with building, serving, and exporting a Next.js application.\n\n- Integration with React libraries within the workspace. \n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
6
6
  "repository": {
@@ -31,26 +31,26 @@
31
31
  "migrations": "./migrations.json"
32
32
  },
33
33
  "peerDependencies": {
34
- "next": ">=13.0.0"
34
+ "next": ">=14.0.0"
35
35
  },
36
36
  "dependencies": {
37
- "@nx/devkit": "18.0.0-beta.0",
37
+ "@nx/devkit": "18.0.0-beta.2",
38
38
  "@babel/plugin-proposal-decorators": "^7.22.7",
39
39
  "@svgr/webpack": "^8.0.1",
40
40
  "chalk": "^4.1.0",
41
41
  "copy-webpack-plugin": "^10.2.4",
42
42
  "fs-extra": "^11.1.0",
43
43
  "ignore": "^5.0.4",
44
- "semver": "7.5.3",
44
+ "semver": "^7.5.3",
45
45
  "url-loader": "^4.1.1",
46
46
  "tslib": "^2.3.0",
47
47
  "webpack-merge": "^5.8.0",
48
- "@nx/js": "18.0.0-beta.0",
49
- "@nx/eslint": "18.0.0-beta.0",
50
- "@nx/react": "18.0.0-beta.0",
51
- "@nx/web": "18.0.0-beta.0",
52
- "@nx/workspace": "18.0.0-beta.0",
53
- "@nrwl/next": "18.0.0-beta.0"
48
+ "@nx/js": "18.0.0-beta.2",
49
+ "@nx/eslint": "18.0.0-beta.2",
50
+ "@nx/react": "18.0.0-beta.2",
51
+ "@nx/web": "18.0.0-beta.2",
52
+ "@nx/workspace": "18.0.0-beta.2",
53
+ "@nrwl/next": "18.0.0-beta.2"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"
@@ -1,12 +1,2 @@
1
1
  import { NxComponentTestingOptions } from '@nx/cypress/plugins/cypress-preset';
2
- export declare function nxComponentTestingPreset(pathToConfig: string, options?: NxComponentTestingOptions): {
3
- specPattern: string;
4
- devServer: {
5
- webpackConfig: import("webpack").Configuration;
6
- framework: "react";
7
- bundler: "webpack";
8
- };
9
- videosFolder: string;
10
- screenshotsFolder: string;
11
- chromeWebSecurity: boolean;
12
- };
2
+ export declare function nxComponentTestingPreset(pathToConfig: string, options?: NxComponentTestingOptions): any;
@@ -8,17 +8,25 @@ const react_1 = require("@nx/react");
8
8
  const webpack_1 = require("@nx/webpack");
9
9
  const path_1 = require("path");
10
10
  function nxComponentTestingPreset(pathToConfig, options) {
11
+ if (global.NX_GRAPH_CREATION || global.NX_CYPRESS_INIT_GENERATOR_RUNNING) {
12
+ // this is only used by plugins, so we don't need the component testing
13
+ // options, cast to any to avoid type errors
14
+ return (0, cypress_preset_1.nxBaseCypressPreset)(pathToConfig);
15
+ }
11
16
  const graph = (0, devkit_1.readCachedProjectGraph)();
12
17
  const { targets: ctTargets, name: ctProjectName } = (0, ct_helpers_1.getProjectConfigByPath)(graph, pathToConfig);
13
18
  const ctTargetName = options?.ctTargetName || 'component-test';
14
19
  const ctConfigurationName = process.env.NX_CYPRESS_TARGET_CONFIGURATION;
15
20
  const ctExecutorContext = (0, ct_helpers_1.createExecutorContext)(graph, ctTargets, ctProjectName, ctTargetName, ctConfigurationName);
16
- const ctExecutorOptions = (0, devkit_1.readTargetOptions)({
17
- project: ctProjectName,
18
- target: ctTargetName,
19
- configuration: ctConfigurationName,
20
- }, ctExecutorContext);
21
- const buildTarget = ctExecutorOptions.devServerTarget;
21
+ let buildTarget = options?.buildTarget;
22
+ if (!buildTarget) {
23
+ const ctExecutorOptions = (0, devkit_1.readTargetOptions)({
24
+ project: ctProjectName,
25
+ target: ctTargetName,
26
+ configuration: ctConfigurationName,
27
+ }, ctExecutorContext);
28
+ buildTarget = ctExecutorOptions.devServerTarget;
29
+ }
22
30
  let buildAssets = [];
23
31
  let buildFileReplacements = [];
24
32
  let buildOuputPath = `dist/${ctProjectName}/.next`;
@@ -31,6 +39,13 @@ function nxComponentTestingPreset(pathToConfig, options) {
31
39
  projectGraph: graph,
32
40
  });
33
41
  const buildProjectConfig = graph.nodes[parsedBuildTarget.project]?.data;
42
+ if (buildProjectConfig?.targets?.[parsedBuildTarget.target]?.executor !==
43
+ '@nx/next:build') {
44
+ throw new Error(`The '${parsedBuildTarget.target}' target of the '${[
45
+ parsedBuildTarget.project,
46
+ ]}' project is not using the '@nx/next:build' executor. ` +
47
+ `Please make sure to use '@nx/next:build' executor in that target to use Cypress Component Testing.`);
48
+ }
34
49
  const buildExecutorContext = (0, ct_helpers_1.createExecutorContext)(graph, buildProjectConfig.targets, parsedBuildTarget.project, parsedBuildTarget.target, parsedBuildTarget.configuration);
35
50
  const buildExecutorOptions = (0, devkit_1.readTargetOptions)({
36
51
  project: parsedBuildTarget.project,
@@ -70,7 +85,7 @@ Able to find CT project, ${!!ctProjectConfig}.`);
70
85
  context: ctExecutorContext,
71
86
  });
72
87
  return {
73
- ...(0, cypress_preset_1.nxBaseCypressPreset)(__filename),
88
+ ...(0, cypress_preset_1.nxBaseCypressPreset)(pathToConfig),
74
89
  specPattern: '**/*.cy.{js,jsx,ts,tsx}',
75
90
  devServer: {
76
91
  ...{ framework: 'react', bundler: 'webpack' },
@@ -268,7 +268,7 @@ function getNxEnvironmentVariables() {
268
268
  }, {});
269
269
  }
270
270
  /**
271
- * TODO(v18)
271
+ * TODO(v19)
272
272
  * @deprecated Use Next.js 9.4+ built-in support for environment variables. Reference https://nextjs.org/docs/pages/api-reference/next-config-js/env
273
273
  */
274
274
  function addNxEnvVariables(config) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withStylus = void 0;
4
- // TODO(v18): Remove file, it is here until users migrate over to SASS manually.
4
+ // TODO(v19): Remove file, it is here until users migrate over to SASS manually.
5
5
  function withStylus(configOrFn) {
6
6
  return async (phase) => {
7
7
  throw new Error(`Stylus support has been removed and you should use the built-in SASS support. Remove the "withStylus" plugin from your Next.js config, and rename your files from .styl to .scss.`);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 2,
3
3
  "outputCapture": "pipe",
4
- "$schema": "http://json-schema.org/schema",
4
+ "$schema": "https://json-schema.org/schema",
5
5
  "cli": "nx",
6
6
  "title": "Next Build",
7
7
  "description": "Build a Next.js app.",
@@ -18,8 +18,10 @@ const custom_server_1 = require("../custom-server/custom-server");
18
18
  const update_cypress_tsconfig_1 = require("./lib/update-cypress-tsconfig");
19
19
  const show_possible_warnings_1 = require("./lib/show-possible-warnings");
20
20
  const versions_2 = require("../../utils/versions");
21
+ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
21
22
  async function applicationGenerator(host, schema) {
22
23
  return await applicationGeneratorInternal(host, {
24
+ addPlugin: false,
23
25
  projectNameAndRootFormat: 'derived',
24
26
  ...schema,
25
27
  });
@@ -75,6 +77,9 @@ async function applicationGeneratorInternal(host, schema) {
75
77
  if (!options.skipFormat) {
76
78
  await (0, devkit_1.formatFiles)(host);
77
79
  }
80
+ tasks.push(() => {
81
+ (0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
82
+ });
78
83
  return (0, devkit_1.runTasksInSerial)(...tasks);
79
84
  }
80
85
  exports.applicationGeneratorInternal = applicationGeneratorInternal;
@@ -47,6 +47,7 @@ async function addE2e(host, options) {
47
47
  setParserOptionsProject: options.setParserOptionsProject,
48
48
  webServerAddress: `http://127.0.0.1:${hasPlugin ? '3000' : '4200'}`,
49
49
  webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${hasPlugin ? 'start' : 'serve'} ${options.projectName}`,
50
+ addPlugin: options.addPlugin,
50
51
  });
51
52
  }
52
53
  return () => { };
@@ -18,6 +18,7 @@ async function addLinting(host, options) {
18
18
  skipFormat: true,
19
19
  rootProject: options.rootProject,
20
20
  setParserOptionsProject: options.setParserOptionsProject,
21
+ addPlugin: options.addPlugin,
21
22
  }));
22
23
  if (options.linter === eslint_1.Linter.EsLint && (0, eslint_file_1.isEslintConfigSupported)(host)) {
23
24
  (0, eslint_file_1.addExtendsToLintConfig)(host, options.appProjectRoot, [
@@ -364,6 +364,25 @@ function createAppJsx(name) {
364
364
  nx g @nx/next:component ui/src/lib/button
365
365
  </pre>
366
366
  </details>
367
+ <details>
368
+ <summary>
369
+ <svg
370
+ fill="none"
371
+ stroke="currentColor"
372
+ viewBox="0 0 24 24"
373
+ xmlns="http://www.w3.org/2000/svg"
374
+ >
375
+ <path
376
+ strokeLinecap="round"
377
+ strokeLinejoin="round"
378
+ strokeWidth="2"
379
+ d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
380
+ />
381
+ </svg>
382
+ View project details
383
+ </summary>
384
+ <pre>nx show project ${name} --web</pre>
385
+ </details>
367
386
  <details>
368
387
  <summary>
369
388
  <svg
@@ -16,6 +16,7 @@ async function normalizeOptions(host, options) {
16
16
  });
17
17
  options.rootProject = appProjectRoot === '.';
18
18
  options.projectNameAndRootFormat = projectNameAndRootFormat;
19
+ options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
19
20
  const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
20
21
  const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
21
22
  const name = (0, devkit_1.names)(options.name).fileName;
@@ -20,4 +20,5 @@ export interface Schema {
20
20
  appDir?: boolean;
21
21
  src?: boolean;
22
22
  rootProject?: boolean;
23
+ addPlugin?: boolean;
23
24
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxNextApp",
5
5
  "title": "Create a Next.js Application for Nx",
@@ -40,11 +40,11 @@
40
40
  { "value": "css", "label": "CSS" },
41
41
  {
42
42
  "value": "scss",
43
- "label": "SASS(.scss) [ http://sass-lang.com ]"
43
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
44
44
  },
45
45
  {
46
46
  "value": "less",
47
- "label": "LESS [ http://lesscss.org ]"
47
+ "label": "LESS [ https://lesscss.org ]"
48
48
  },
49
49
  {
50
50
  "value": "styled-components",
@@ -3,21 +3,21 @@ import type { SupportedStyles } from '@nx/react';
3
3
  interface Schema {
4
4
  name: string;
5
5
  /**
6
- * @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.
6
+ * @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.
7
7
  */
8
8
  project?: string;
9
9
  style: SupportedStyles;
10
10
  directory?: string;
11
11
  /**
12
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v18.
12
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v19.
13
13
  */
14
14
  flat?: boolean;
15
15
  /**
16
- * @deprecated Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx v18.
16
+ * @deprecated Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19.
17
17
  */
18
18
  pascalCaseFiles?: boolean;
19
19
  /**
20
- * @deprecated Provide the `directory` in pascal-case and use the `as-provided` format. This option will be removed in Nx v18.
20
+ * @deprecated Provide the `directory` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19.
21
21
  */
22
22
  pascalCaseDirectory?: boolean;
23
23
  nameAndDirectoryFormat?: 'as-provided' | 'derived';
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
5
5
  const react_1 = require("@nx/react");
6
6
  const styles_1 = require("../../utils/styles");
7
7
  const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
8
- // TODO(v18): Remove this logic once we no longer derive directory.
8
+ // TODO(v19): Remove this logic once we no longer derive directory.
9
9
  function maybeGetDerivedDirectory(host, options) {
10
10
  if (!options.project)
11
11
  return options.directory;
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxNextReactComponent",
5
5
  "title": "Create a React Component for Next",
@@ -13,7 +13,7 @@
13
13
  "$default": {
14
14
  "$source": "projectName"
15
15
  },
16
- "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."
16
+ "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."
17
17
  },
18
18
  "name": {
19
19
  "type": "string",
@@ -40,11 +40,11 @@
40
40
  },
41
41
  {
42
42
  "value": "scss",
43
- "label": "SASS(.scss) [ http://sass-lang.com ]"
43
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
44
44
  },
45
45
  {
46
46
  "value": "less",
47
- "label": "LESS [ http://lesscss.org ]"
47
+ "label": "LESS [ https://lesscss.org ]"
48
48
  },
49
49
  {
50
50
  "value": "styled-components",
@@ -97,21 +97,21 @@
97
97
  "type": "boolean",
98
98
  "description": "Create component at the source root rather than its own directory.",
99
99
  "default": false,
100
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v18."
100
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v19."
101
101
  },
102
102
  "pascalCaseFiles": {
103
103
  "type": "boolean",
104
104
  "description": "Use pascal case component file name (e.g. `App.tsx`).",
105
105
  "alias": "P",
106
106
  "default": false,
107
- "x-deprecated": "Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx v18."
107
+ "x-deprecated": "Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19."
108
108
  },
109
109
  "pascalCaseDirectory": {
110
110
  "type": "boolean",
111
111
  "description": "Use pascal case directory name (e.g. `App/App.tsx`).",
112
112
  "alias": "R",
113
113
  "default": false,
114
- "x-deprecated": "Provide the `directory` in pascal-case and use the `as-provided` format. This option will be removed in Nx v18."
114
+ "x-deprecated": "Provide the `directory` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19."
115
115
  },
116
116
  "skipFormat": {
117
117
  "description": "Skip formatting files.",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxNextCustomServer",
5
5
  "title": "Add custom server",
@@ -1,4 +1,5 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { CypressComponentConfigurationGeneratorSchema } from './schema';
3
3
  export declare function cypressComponentConfiguration(tree: Tree, options: CypressComponentConfigurationGeneratorSchema): Promise<GeneratorCallback>;
4
+ export declare function cypressComponentConfigurationInternal(tree: Tree, options: CypressComponentConfigurationGeneratorSchema): Promise<GeneratorCallback>;
4
5
  export default cypressComponentConfiguration;
@@ -1,36 +1,50 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cypressComponentConfiguration = void 0;
3
+ exports.cypressComponentConfigurationInternal = exports.cypressComponentConfiguration = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const ct_utils_1 = require("@nx/react/src/utils/ct-utils");
6
6
  const versions_1 = require("../../utils/versions");
7
7
  const react_1 = require("@nx/react");
8
8
  const path_1 = require("path");
9
- async function cypressComponentConfiguration(tree, options) {
9
+ function cypressComponentConfiguration(tree, options) {
10
+ return cypressComponentConfigurationInternal(tree, {
11
+ addPlugin: false,
12
+ ...options,
13
+ });
14
+ }
15
+ exports.cypressComponentConfiguration = cypressComponentConfiguration;
16
+ async function cypressComponentConfigurationInternal(tree, options) {
10
17
  const tasks = [];
11
18
  const { componentConfigurationGenerator: baseCyCtConfig } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
12
19
  tasks.push(await baseCyCtConfig(tree, {
13
20
  project: options.project,
14
21
  skipFormat: true,
15
22
  jsx: true,
23
+ addPlugin: options.addPlugin,
16
24
  }));
17
25
  const { webpackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/webpack', versions_1.nxVersion);
18
- tasks.push(await webpackInitGenerator(tree, { skipFormat: true }));
26
+ tasks.push(await webpackInitGenerator(tree, {
27
+ skipFormat: true,
28
+ addPlugin: options.addPlugin,
29
+ }));
19
30
  const { ensureDependencies } = await Promise.resolve().then(() => require('@nx/webpack/src/utils/ensure-dependencies'));
20
31
  tasks.push(ensureDependencies(tree, { compiler: 'swc', uiFramework: 'react' }));
21
32
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
22
- projectConfig.targets['component-test'].options = {
23
- ...projectConfig.targets['component-test'].options,
24
- skipServe: true,
25
- };
26
- (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
33
+ if (projectConfig.targets?.['component-test']?.executor ===
34
+ '@nx/cypress:cypress') {
35
+ projectConfig.targets['component-test'].options = {
36
+ ...projectConfig.targets['component-test'].options,
37
+ skipServe: true,
38
+ };
39
+ (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
40
+ }
27
41
  await addFiles(tree, projectConfig, options);
28
42
  if (!options.skipFormat) {
29
43
  await (0, devkit_1.formatFiles)(tree);
30
44
  }
31
45
  return (0, devkit_1.runTasksInSerial)(...tasks);
32
46
  }
33
- exports.cypressComponentConfiguration = cypressComponentConfiguration;
47
+ exports.cypressComponentConfigurationInternal = cypressComponentConfigurationInternal;
34
48
  async function addFiles(tree, projectConfig, opts) {
35
49
  const { addMountDefinition, addDefaultCTConfig } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/config'));
36
50
  const ctFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress', 'support', 'component.ts');
@@ -2,4 +2,5 @@ export interface CypressComponentConfigurationGeneratorSchema {
2
2
  project: string;
3
3
  generateTests: boolean;
4
4
  skipFormat?: boolean;
5
+ addPlugin?: boolean;
5
6
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "CypressComponentConfiguration",
5
5
  "title": "NextJS Component Testing Configuration",
@@ -1,4 +1,5 @@
1
1
  import { type GeneratorCallback, type Tree } from '@nx/devkit';
2
2
  import type { InitSchema } from './schema';
3
- export declare function nextInitGenerator(host: Tree, schema: InitSchema): Promise<GeneratorCallback>;
3
+ export declare function nextInitGenerator(tree: Tree, schema: InitSchema): Promise<GeneratorCallback>;
4
+ export declare function nextInitGeneratorInternal(host: Tree, schema: InitSchema): Promise<GeneratorCallback>;
4
5
  export default nextInitGenerator;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nextInitGenerator = void 0;
3
+ exports.nextInitGeneratorInternal = exports.nextInitGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const update_package_scripts_1 = require("@nx/devkit/src/utils/update-package-scripts");
6
6
  const versions_1 = require("@nx/react/src/utils/versions");
7
- const plugin_1 = require("../../plugins/plugin");
8
7
  const add_gitignore_entry_1 = require("../../utils/add-gitignore-entry");
9
8
  const versions_2 = require("../../utils/versions");
10
9
  const add_plugin_1 = require("./lib/add-plugin");
@@ -20,8 +19,13 @@ function updateDependencies(host, schema) {
20
19
  }, undefined, schema.keepExistingVersions));
21
20
  return (0, devkit_1.runTasksInSerial)(...tasks);
22
21
  }
23
- async function nextInitGenerator(host, schema) {
24
- if (process.env.NX_PCV3 === 'true') {
22
+ function nextInitGenerator(tree, schema) {
23
+ return nextInitGeneratorInternal(tree, { addPlugin: false, ...schema });
24
+ }
25
+ exports.nextInitGenerator = nextInitGenerator;
26
+ async function nextInitGeneratorInternal(host, schema) {
27
+ schema.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
28
+ if (schema.addPlugin) {
25
29
  (0, add_plugin_1.addPlugin)(host);
26
30
  }
27
31
  (0, add_gitignore_entry_1.addGitIgnoreEntry)(host);
@@ -30,9 +34,10 @@ async function nextInitGenerator(host, schema) {
30
34
  installTask = updateDependencies(host, schema);
31
35
  }
32
36
  if (schema.updatePackageScripts) {
33
- await (0, update_package_scripts_1.updatePackageScripts)(host, plugin_1.createNodes);
37
+ const { createNodes } = await Promise.resolve().then(() => require('../../plugins/plugin'));
38
+ await (0, update_package_scripts_1.updatePackageScripts)(host, createNodes);
34
39
  }
35
40
  return installTask;
36
41
  }
37
- exports.nextInitGenerator = nextInitGenerator;
42
+ exports.nextInitGeneratorInternal = nextInitGeneratorInternal;
38
43
  exports.default = nextInitGenerator;
@@ -3,4 +3,5 @@ export interface InitSchema {
3
3
  skipPackageJson?: boolean;
4
4
  keepExistingVersions?: boolean;
5
5
  updatePackageScripts?: boolean;
6
+ addPlugin?: boolean;
6
7
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxNextNgInit",
5
5
  "title": "Init Next Plugin",
@@ -12,6 +12,7 @@ async function normalizeOptions(host, options) {
12
12
  callingGenerator: '@nx/next:library',
13
13
  });
14
14
  options.projectNameAndRootFormat = projectNameAndRootFormat;
15
+ options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
15
16
  return {
16
17
  ...options,
17
18
  importPath,
@@ -10,6 +10,7 @@ const normalize_options_1 = require("./lib/normalize-options");
10
10
  const versions_2 = require("../../utils/versions");
11
11
  async function libraryGenerator(host, rawOptions) {
12
12
  return await libraryGeneratorInternal(host, {
13
+ addPlugin: false,
13
14
  projectNameAndRootFormat: 'derived',
14
15
  ...rawOptions,
15
16
  });
@@ -24,4 +24,5 @@ export interface Schema {
24
24
  strict?: boolean;
25
25
  setParserOptionsProject?: boolean;
26
26
  skipPackageJson?: boolean;
27
+ addPlugin?: boolean;
27
28
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxReactLibrary",
5
5
  "title": "Create a React Library for Nx",
@@ -40,11 +40,11 @@
40
40
  { "value": "css", "label": "CSS" },
41
41
  {
42
42
  "value": "scss",
43
- "label": "SASS(.scss) [ http://sass-lang.com ]"
43
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
44
44
  },
45
45
  {
46
46
  "value": "less",
47
- "label": "LESS [ http://lesscss.org ]"
47
+ "label": "LESS [ https://lesscss.org ]"
48
48
  },
49
49
  {
50
50
  "value": "styled-components",
@@ -46,7 +46,7 @@ async function normalizeOptions(host, options) {
46
46
  let routerDirectory;
47
47
  if (options.project) {
48
48
  // Legacy behavior, detect app vs page router from specified project.
49
- // TODO(v18): remove this logic
49
+ // TODO(v19): remove this logic
50
50
  const project = (0, devkit_1.readProjectConfiguration)(host, options.project);
51
51
  // app/ is a reserved folder in nextjs so it is safe to check it's existence
52
52
  isAppRouter =
@@ -3,7 +3,7 @@ import { SupportedStyles } from '@nx/react';
3
3
  export interface Schema {
4
4
  name: string;
5
5
  /**
6
- * @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.
6
+ * @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.
7
7
  */
8
8
  project?: string;
9
9
  style: SupportedStyles;
@@ -12,7 +12,7 @@ export interface Schema {
12
12
  withTests?: boolean;
13
13
  js?: boolean;
14
14
  /**
15
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v18.
15
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v19.
16
16
  */
17
17
  flat?: boolean;
18
18
  skipFormat?: boolean;
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxNextReactPage",
5
5
  "title": "Create a Page for Next",
@@ -13,7 +13,7 @@
13
13
  "$default": {
14
14
  "$source": "projectName"
15
15
  },
16
- "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."
16
+ "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."
17
17
  },
18
18
  "name": {
19
19
  "type": "string",
@@ -51,11 +51,11 @@
51
51
  },
52
52
  {
53
53
  "value": "scss",
54
- "label": "SASS(.scss) [ http://sass-lang.com ]"
54
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
55
55
  },
56
56
  {
57
57
  "value": "less",
58
- "label": "LESS [ http://lesscss.org ]"
58
+ "label": "LESS [ https://lesscss.org ]"
59
59
  },
60
60
  {
61
61
  "value": "styled-components",
@@ -97,7 +97,7 @@
97
97
  "type": "boolean",
98
98
  "description": "Create component at the source root rather than its own directory.",
99
99
  "default": false,
100
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18."
100
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
101
101
  },
102
102
  "skipFormat": {
103
103
  "description": "Skip formatting files.",