@nx/next 22.0.2 → 22.0.4

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": "22.0.2",
3
+ "version": "22.0.4",
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": "22.0.2",
38
+ "@nx/devkit": "22.0.4",
39
39
  "@babel/plugin-proposal-decorators": "^7.22.7",
40
40
  "@svgr/webpack": "^8.1.0",
41
41
  "copy-webpack-plugin": "^10.2.4",
@@ -44,17 +44,17 @@
44
44
  "semver": "^7.6.3",
45
45
  "tslib": "^2.3.0",
46
46
  "webpack-merge": "^5.8.0",
47
- "@nx/js": "22.0.2",
48
- "@nx/eslint": "22.0.2",
49
- "@nx/react": "22.0.2",
50
- "@nx/web": "22.0.2",
51
- "@nx/webpack": "22.0.2",
47
+ "@nx/js": "22.0.4",
48
+ "@nx/eslint": "22.0.4",
49
+ "@nx/react": "22.0.4",
50
+ "@nx/web": "22.0.4",
51
+ "@nx/webpack": "22.0.4",
52
52
  "@phenomnomnominal/tsquery": "~5.0.1"
53
53
  },
54
54
  "devDependencies": {
55
- "@nx/cypress": "22.0.2",
56
- "@nx/playwright": "22.0.2",
57
- "nx": "22.0.2"
55
+ "@nx/cypress": "22.0.4",
56
+ "@nx/playwright": "22.0.4",
57
+ "nx": "22.0.4"
58
58
  },
59
59
  "publishConfig": {
60
60
  "access": "public"
@@ -32,5 +32,5 @@
32
32
  <% } %>
33
33
  "next-env.d.ts"
34
34
  ],
35
- "exclude": ["node_modules", "jest.config.ts", "<%= rootPath %>**/*.spec.ts", "<%= rootPath %>**/*.test.ts"]
35
+ "exclude": ["node_modules", "jest.config.ts", "jest.config.cts", "<%= rootPath %>**/*.spec.ts", "<%= rootPath %>**/*.test.ts"]
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"add-jest.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-jest.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAEJ,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAyD5B"}
1
+ {"version":3,"file":"add-jest.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-jest.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAEJ,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CA2D5B"}
@@ -27,10 +27,10 @@ async function addJest(host, options) {
27
27
  });
28
28
  (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.spec.json'), (json) => {
29
29
  json.compilerOptions.jsx = 'react';
30
- // have to override exclude otherwise lint will fail with setParserOptionsProject and jest.config.ts
30
+ // have to override exclude otherwise lint will fail with setParserOptionsProject and jest.config.ts/jest.config.cts
31
31
  if (options.setParserOptionsProject) {
32
32
  const tsConfig = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json'));
33
- json.exclude = tsConfig.exclude.filter((e) => e !== 'jest.config.ts');
33
+ json.exclude = tsConfig.exclude.filter((e) => e !== 'jest.config.ts' && e !== 'jest.config.cts');
34
34
  }
35
35
  return json;
36
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"add-linting.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-linting.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAGjB,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAWvD,wBAAsB,UAAU,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAuF5B"}
1
+ {"version":3,"file":"add-linting.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-linting.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAGjB,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAWvD,wBAAsB,UAAU,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CA0F5B"}
@@ -5,7 +5,7 @@ const eslint_1 = require("@nx/eslint");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const lint_1 = require("@nx/react/src/utils/lint");
7
7
  const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
8
- const versions_1 = require("../../../utils/versions");
8
+ const version_utils_1 = require("../../../utils/version-utils");
9
9
  const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
10
10
  async function addLinting(host, options) {
11
11
  if (options.linter !== 'eslint')
@@ -61,10 +61,11 @@ async function addLinting(host, options) {
61
61
  ]);
62
62
  }
63
63
  if (!options.skipPackageJson) {
64
+ const eslintConfigNextVersion = await (0, version_utils_1.getEslintConfigNextDependenciesVersionsToInstall)(host);
64
65
  tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, {
65
66
  ...lint_1.extraEslintDependencies.devDependencies,
66
- 'eslint-config-next': versions_1.eslintConfigNextVersion,
67
- '@next/eslint-plugin-next': versions_1.eslintConfigNextVersion,
67
+ 'eslint-config-next': eslintConfigNextVersion,
68
+ '@next/eslint-plugin-next': eslintConfigNextVersion,
68
69
  }));
69
70
  }
70
71
  return (0, devkit_1.runTasksInSerial)(...tasks);
@@ -1 +1 @@
1
- {"version":3,"file":"jest-config-util.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/jest-config-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAC;AAElD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,QAwDF"}
1
+ {"version":3,"file":"jest-config-util.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/jest-config-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAC;AAelD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,QAwDF"}
@@ -2,16 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateJestConfig = updateJestConfig;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ function findProjectJestConfig(host, projectRoot) {
6
+ const extensions = ['js', 'ts', 'cts'];
7
+ for (const ext of extensions) {
8
+ const configPath = `${projectRoot}/jest.config.${ext}`;
9
+ if (host.exists(configPath)) {
10
+ return configPath;
11
+ }
12
+ }
13
+ return null;
14
+ }
5
15
  function updateJestConfig(host, options) {
6
16
  if (options.unitTestRunner !== 'jest') {
7
17
  return;
8
18
  }
9
- const configPath = `${options.projectRoot}/jest.config.${options.js ? 'js' : 'ts'}`;
10
- if (!host.exists(configPath))
19
+ const configPath = findProjectJestConfig(host, options.projectRoot);
20
+ if (!configPath)
11
21
  return;
12
22
  const offset = (0, devkit_1.offsetFromRoot)(options.projectRoot);
23
+ const isCommonJS = configPath.endsWith('.js') || configPath.endsWith('.cts');
13
24
  // Easier to override the whole file rather than replace content since the structure has changed with `next/jest.js` being used.
14
- const newContent = options.js
25
+ const newContent = isCommonJS
15
26
  ? `const nextJest = require('next/jest.js');
16
27
 
17
28
  const createJestConfig = nextJest({
@@ -2,7 +2,9 @@ import { type Tree } from '@nx/devkit';
2
2
  type NextDependenciesVersions = {
3
3
  next: string;
4
4
  };
5
+ type EslintConfigNextVersion = string;
5
6
  export declare function getNextDependenciesVersionsToInstall(tree: Tree, isReact18?: boolean): Promise<NextDependenciesVersions>;
7
+ export declare function getEslintConfigNextDependenciesVersionsToInstall(tree: Tree): Promise<EslintConfigNextVersion>;
6
8
  export declare function isNext14(tree: Tree): Promise<boolean>;
7
9
  export declare function getInstalledNextVersion(tree: Tree): string;
8
10
  export declare function getInstalledNextVersionFromGraph(): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"version-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/version-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AAIpB,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAsB,oCAAoC,CACxD,IAAI,EAAE,IAAI,EACV,SAAS,UAAQ,GAChB,OAAO,CAAC,wBAAwB,CAAC,CAUnC;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,IAAI,oBAMxC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAe1D;AAED,wBAAsB,gCAAgC,oBAOrD"}
1
+ {"version":3,"file":"version-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/version-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AASpB,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,uBAAuB,GAAG,MAAM,CAAC;AAEtC,wBAAsB,oCAAoC,CACxD,IAAI,EAAE,IAAI,EACV,SAAS,UAAQ,GAChB,OAAO,CAAC,wBAAwB,CAAC,CAUnC;AAED,wBAAsB,gDAAgD,CACpE,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,uBAAuB,CAAC,CAMlC;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,IAAI,oBAMxC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAe1D;AAED,wBAAsB,gCAAgC,oBAOrD"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNextDependenciesVersionsToInstall = getNextDependenciesVersionsToInstall;
4
+ exports.getEslintConfigNextDependenciesVersionsToInstall = getEslintConfigNextDependenciesVersionsToInstall;
4
5
  exports.isNext14 = isNext14;
5
6
  exports.getInstalledNextVersion = getInstalledNextVersion;
6
7
  exports.getInstalledNextVersionFromGraph = getInstalledNextVersionFromGraph;
@@ -19,6 +20,14 @@ async function getNextDependenciesVersionsToInstall(tree, isReact18 = false) {
19
20
  };
20
21
  }
21
22
  }
23
+ async function getEslintConfigNextDependenciesVersionsToInstall(tree) {
24
+ if (await isNext14(tree)) {
25
+ return versions_1.eslintConfigNext14Version;
26
+ }
27
+ else {
28
+ return versions_1.eslintConfigNextVersion;
29
+ }
30
+ }
22
31
  async function isNext14(tree) {
23
32
  let installedNextVersion = await getInstalledNextVersionFromGraph();
24
33
  if (!installedNextVersion) {
@@ -2,6 +2,7 @@ export declare const nxVersion: any;
2
2
  export declare const nextVersion = "~15.2.4";
3
3
  export declare const next14Version = "~14.2.26";
4
4
  export declare const eslintConfigNextVersion = "^15.2.4";
5
+ export declare const eslintConfigNext14Version = "~14.2.26";
5
6
  export declare const sassVersion = "1.62.1";
6
7
  export declare const lessLoader = "11.1.0";
7
8
  export declare const emotionServerVersion = "11.11.0";
@@ -1 +1 @@
1
- {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,eAAO,MAAM,uBAAuB,YAAY,CAAC;AACjD,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAC3D,eAAO,MAAM,YAAY,WAAW,CAAC"}
1
+ {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,eAAO,MAAM,uBAAuB,YAAY,CAAC;AACjD,eAAO,MAAM,yBAAyB,aAAa,CAAC;AACpD,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAC3D,eAAO,MAAM,YAAY,WAAW,CAAC"}
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.emotionServerVersion = exports.lessLoader = exports.sassVersion = exports.eslintConfigNextVersion = exports.next14Version = exports.nextVersion = exports.nxVersion = void 0;
3
+ exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.emotionServerVersion = exports.lessLoader = exports.sassVersion = exports.eslintConfigNext14Version = exports.eslintConfigNextVersion = exports.next14Version = exports.nextVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
5
  exports.nextVersion = '~15.2.4';
6
6
  exports.next14Version = '~14.2.26';
7
7
  exports.eslintConfigNextVersion = '^15.2.4';
8
+ exports.eslintConfigNext14Version = '~14.2.26';
8
9
  exports.sassVersion = '1.62.1';
9
10
  exports.lessLoader = '11.1.0';
10
11
  exports.emotionServerVersion = '11.11.0';