@nx/next 19.5.6 → 19.6.0-beta.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/next",
3
- "version": "19.5.6",
3
+ "version": "19.6.0-beta.0",
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, Playwright, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "next": ">=14.0.0"
36
36
  },
37
37
  "dependencies": {
38
- "@nx/devkit": "19.5.6",
38
+ "@nx/devkit": "19.6.0-beta.0",
39
39
  "@babel/plugin-proposal-decorators": "^7.22.7",
40
40
  "@svgr/webpack": "^8.0.1",
41
41
  "chalk": "^4.1.0",
@@ -46,14 +46,14 @@
46
46
  "semver": "^7.5.3",
47
47
  "tslib": "^2.3.0",
48
48
  "webpack-merge": "^5.8.0",
49
- "@nx/js": "19.5.6",
50
- "@nx/eslint": "19.5.6",
51
- "@nx/react": "19.5.6",
52
- "@nx/web": "19.5.6",
53
- "@nx/webpack": "19.5.6",
54
- "@nx/workspace": "19.5.6",
49
+ "@nx/js": "19.6.0-beta.0",
50
+ "@nx/eslint": "19.6.0-beta.0",
51
+ "@nx/react": "19.6.0-beta.0",
52
+ "@nx/web": "19.6.0-beta.0",
53
+ "@nx/webpack": "19.6.0-beta.0",
54
+ "@nx/workspace": "19.6.0-beta.0",
55
55
  "@phenomnomnominal/tsquery": "~5.0.1",
56
- "@nrwl/next": "19.5.6"
56
+ "@nrwl/next": "19.6.0-beta.0"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public"
@@ -5,6 +5,8 @@ const devkit_1 = require("@nx/devkit");
5
5
  const eslint_1 = require("@nx/eslint");
6
6
  const versions_1 = require("../../../utils/versions");
7
7
  const web_1 = require("@nx/web");
8
+ const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
9
+ const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
8
10
  async function addE2e(host, options) {
9
11
  const nxJson = (0, devkit_1.readNxJson)(host);
10
12
  const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
@@ -27,7 +29,7 @@ async function addE2e(host, options) {
27
29
  tags: [],
28
30
  implicitDependencies: [options.projectName],
29
31
  });
30
- return configurationGenerator(host, {
32
+ const e2eTask = await configurationGenerator(host, {
31
33
  ...options,
32
34
  linter: eslint_1.Linter.EsLint,
33
35
  project: options.e2eProjectName,
@@ -45,6 +47,20 @@ async function addE2e(host, options) {
45
47
  ? `nx run ${options.projectName}:serve-static`
46
48
  : undefined,
47
49
  });
50
+ if (options.addPlugin ||
51
+ (0, devkit_1.readNxJson)(host).plugins?.find((p) => typeof p === 'string'
52
+ ? p === '@nx/cypress/plugin'
53
+ : p.plugin === '@nx/cypress/plugin')) {
54
+ let buildTarget = '^build';
55
+ if (hasPlugin) {
56
+ const matchingPlugin = await (0, find_plugin_for_config_file_1.findPluginForConfigFile)(host, '@nx/next/plugin', (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'next.config.js'));
57
+ if (matchingPlugin && typeof matchingPlugin !== 'string') {
58
+ buildTarget = `^${matchingPlugin.options?.buildTargetName ?? 'build'}`;
59
+ }
60
+ }
61
+ await (0, target_defaults_utils_1.addE2eCiTargetDefaults)(host, '@nx/cypress/plugin', buildTarget, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, `cypress.config.${options.js ? 'js' : 'ts'}`));
62
+ }
63
+ return e2eTask;
48
64
  }
49
65
  else if (options.e2eTestRunner === 'playwright') {
50
66
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
@@ -55,7 +71,7 @@ async function addE2e(host, options) {
55
71
  tags: [],
56
72
  implicitDependencies: [options.projectName],
57
73
  });
58
- return configurationGenerator(host, {
74
+ const e2eTask = await configurationGenerator(host, {
59
75
  rootProject: options.rootProject,
60
76
  project: options.e2eProjectName,
61
77
  skipFormat: true,
@@ -68,6 +84,20 @@ async function addE2e(host, options) {
68
84
  webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.projectName}`,
69
85
  addPlugin: options.addPlugin,
70
86
  });
87
+ if (options.addPlugin ||
88
+ (0, devkit_1.readNxJson)(host).plugins?.find((p) => typeof p === 'string'
89
+ ? p === '@nx/playwright/plugin'
90
+ : p.plugin === '@nx/playwright/plugin')) {
91
+ let buildTarget = '^build';
92
+ if (hasPlugin) {
93
+ const matchingPlugin = await (0, find_plugin_for_config_file_1.findPluginForConfigFile)(host, '@nx/next/plugin', (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'next.config.js'));
94
+ if (matchingPlugin && typeof matchingPlugin !== 'string') {
95
+ buildTarget = `^${matchingPlugin.options?.buildTargetName ?? 'build'}`;
96
+ }
97
+ }
98
+ await (0, target_defaults_utils_1.addE2eCiTargetDefaults)(host, '@nx/playwright/plugin', buildTarget, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, `playwright.config.ts`));
99
+ }
100
+ return e2eTask;
71
101
  }
72
102
  return () => { };
73
103
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addProject = addProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
5
+ const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
6
6
  function addProject(host, options) {
7
7
  const targets = {};
8
8
  // Check if plugin exists in nx.json and if it doesn't then we can continue
@@ -12,7 +12,7 @@ function addProject(host, options) {
12
12
  ? p === '@nx/next/plugin'
13
13
  : p.plugin === '@nx/next/plugin');
14
14
  if (!hasPlugin) {
15
- (0, add_build_target_defaults_1.addBuildTargetDefaults)(host, '@nx/next:build');
15
+ (0, target_defaults_utils_1.addBuildTargetDefaults)(host, '@nx/next:build');
16
16
  targets.build = {
17
17
  executor: '@nx/next:build',
18
18
  outputs: ['{options.outputPath}'],