@nx/next 20.5.0 → 20.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 +7 -7
- package/src/generators/application/application.js +2 -1
- package/src/generators/application/lib/add-e2e.js +28 -23
- package/src/generators/application/lib/add-project.js +14 -13
- package/src/generators/application/lib/normalize-options.js +1 -0
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/application/schema.json +4 -0
- package/src/generators/library/lib/normalize-options.js +3 -1
- package/src/generators/library/library.js +2 -1
- package/src/generators/library/schema.d.ts +1 -0
- package/src/generators/library/schema.json +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.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": "20.
|
|
38
|
+
"@nx/devkit": "20.6.0-beta.0",
|
|
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,11 +44,11 @@
|
|
|
44
44
|
"semver": "^7.5.3",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
46
|
"webpack-merge": "^5.8.0",
|
|
47
|
-
"@nx/js": "20.
|
|
48
|
-
"@nx/eslint": "20.
|
|
49
|
-
"@nx/react": "20.
|
|
50
|
-
"@nx/web": "20.
|
|
51
|
-
"@nx/webpack": "20.
|
|
47
|
+
"@nx/js": "20.6.0-beta.0",
|
|
48
|
+
"@nx/eslint": "20.6.0-beta.0",
|
|
49
|
+
"@nx/react": "20.6.0-beta.0",
|
|
50
|
+
"@nx/web": "20.6.0-beta.0",
|
|
51
|
+
"@nx/webpack": "20.6.0-beta.0",
|
|
52
52
|
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
@@ -28,6 +28,7 @@ const add_swc_to_custom_server_1 = require("../../utils/add-swc-to-custom-server
|
|
|
28
28
|
async function applicationGenerator(host, schema) {
|
|
29
29
|
return await applicationGeneratorInternal(host, {
|
|
30
30
|
addPlugin: false,
|
|
31
|
+
useProjectJson: true,
|
|
31
32
|
...schema,
|
|
32
33
|
});
|
|
33
34
|
}
|
|
@@ -54,7 +55,7 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
54
55
|
// If we are using the new TS solution
|
|
55
56
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
56
57
|
if (options.isTsSolutionSetup) {
|
|
57
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
58
|
+
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
58
59
|
}
|
|
59
60
|
const e2eTask = await (0, add_e2e_1.addE2e)(host, options);
|
|
60
61
|
tasks.push(e2eTask);
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addE2e = addE2e;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
6
|
+
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
7
|
+
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
5
8
|
const eslint_1 = require("@nx/eslint");
|
|
6
|
-
const versions_1 = require("../../../utils/versions");
|
|
7
9
|
const web_1 = require("@nx/web");
|
|
8
|
-
const
|
|
9
|
-
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
10
|
-
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
11
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
|
+
const versions_1 = require("../../../utils/versions");
|
|
12
11
|
async function addE2e(host, options) {
|
|
13
12
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
14
13
|
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
@@ -25,15 +24,15 @@ async function addE2e(host, options) {
|
|
|
25
24
|
spa: true,
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
27
|
+
const packageJson = {
|
|
28
|
+
name: options.e2eProjectName,
|
|
29
|
+
version: '0.0.1',
|
|
30
|
+
private: true,
|
|
31
|
+
};
|
|
32
|
+
if (!options.useProjectJson) {
|
|
33
|
+
packageJson.nx = {
|
|
34
|
+
implicitDependencies: [options.projectName],
|
|
35
|
+
};
|
|
37
36
|
}
|
|
38
37
|
else {
|
|
39
38
|
(0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
|
|
@@ -45,6 +44,9 @@ async function addE2e(host, options) {
|
|
|
45
44
|
implicitDependencies: [options.projectName],
|
|
46
45
|
});
|
|
47
46
|
}
|
|
47
|
+
if (!options.useProjectJson || options.isTsSolutionSetup) {
|
|
48
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
|
|
49
|
+
}
|
|
48
50
|
const e2eTask = await configurationGenerator(host, {
|
|
49
51
|
...options,
|
|
50
52
|
linter: eslint_1.Linter.EsLint,
|
|
@@ -79,15 +81,15 @@ async function addE2e(host, options) {
|
|
|
79
81
|
}
|
|
80
82
|
else if (options.e2eTestRunner === 'playwright') {
|
|
81
83
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
84
|
+
const packageJson = {
|
|
85
|
+
name: options.e2eProjectName,
|
|
86
|
+
version: '0.0.1',
|
|
87
|
+
private: true,
|
|
88
|
+
};
|
|
89
|
+
if (!options.useProjectJson) {
|
|
90
|
+
packageJson.nx = {
|
|
91
|
+
implicitDependencies: [options.projectName],
|
|
92
|
+
};
|
|
91
93
|
}
|
|
92
94
|
else {
|
|
93
95
|
(0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
|
|
@@ -99,6 +101,9 @@ async function addE2e(host, options) {
|
|
|
99
101
|
implicitDependencies: [options.projectName],
|
|
100
102
|
});
|
|
101
103
|
}
|
|
104
|
+
if (!options.useProjectJson || options.isTsSolutionSetup) {
|
|
105
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
|
|
106
|
+
}
|
|
102
107
|
const e2eTask = await configurationGenerator(host, {
|
|
103
108
|
rootProject: options.rootProject,
|
|
104
109
|
project: options.e2eProjectName,
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addProject = addProject;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
6
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
6
|
const versions_1 = require("../../../utils/versions");
|
|
8
7
|
const react_1 = require("@nx/react");
|
|
9
8
|
function addProject(host, options) {
|
|
@@ -56,17 +55,17 @@ function addProject(host, options) {
|
|
|
56
55
|
targets,
|
|
57
56
|
tags: options.parsedTags,
|
|
58
57
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
const packageJson = {
|
|
59
|
+
name: options.importPath,
|
|
60
|
+
version: '0.0.1',
|
|
61
|
+
private: true,
|
|
62
|
+
dependencies: {
|
|
63
|
+
next: versions_1.nextVersion,
|
|
64
|
+
react: react_1.reactVersion,
|
|
65
|
+
'react-dom': react_1.reactDomVersion,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
if (!options.useProjectJson) {
|
|
70
69
|
if (options.projectName !== options.importPath) {
|
|
71
70
|
packageJson.nx = { name: options.projectName };
|
|
72
71
|
}
|
|
@@ -74,11 +73,13 @@ function addProject(host, options) {
|
|
|
74
73
|
packageJson.nx ??= {};
|
|
75
74
|
packageJson.nx.tags = options.parsedTags;
|
|
76
75
|
}
|
|
77
|
-
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
|
|
78
76
|
}
|
|
79
77
|
else {
|
|
80
78
|
(0, devkit_1.addProjectConfiguration)(host, options.projectName, {
|
|
81
79
|
...project,
|
|
82
80
|
});
|
|
83
81
|
}
|
|
82
|
+
if (!options.useProjectJson || options.isTsSolutionSetup) {
|
|
83
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
|
|
84
|
+
}
|
|
84
85
|
}
|
|
@@ -144,6 +144,10 @@
|
|
|
144
144
|
"default": false,
|
|
145
145
|
"hidden": true,
|
|
146
146
|
"x-priority": "internal"
|
|
147
|
+
},
|
|
148
|
+
"useProjectJson": {
|
|
149
|
+
"type": "boolean",
|
|
150
|
+
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
147
151
|
}
|
|
148
152
|
},
|
|
149
153
|
"required": ["directory"],
|
|
@@ -16,10 +16,12 @@ async function normalizeOptions(host, options) {
|
|
|
16
16
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
17
17
|
nxJson.useInferencePlugins !== false;
|
|
18
18
|
options.addPlugin ??= addPlugin;
|
|
19
|
+
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
19
20
|
return {
|
|
20
21
|
...options,
|
|
21
22
|
importPath,
|
|
22
23
|
projectRoot,
|
|
23
|
-
isUsingTsSolutionConfig
|
|
24
|
+
isUsingTsSolutionConfig,
|
|
25
|
+
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
24
26
|
};
|
|
25
27
|
}
|
|
@@ -14,6 +14,7 @@ const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
|
14
14
|
async function libraryGenerator(host, rawOptions) {
|
|
15
15
|
return await libraryGeneratorInternal(host, {
|
|
16
16
|
addPlugin: false,
|
|
17
|
+
useProjectJson: true,
|
|
17
18
|
...rawOptions,
|
|
18
19
|
});
|
|
19
20
|
}
|
|
@@ -96,7 +97,7 @@ async function libraryGeneratorInternal(host, rawOptions) {
|
|
|
96
97
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
97
98
|
: undefined);
|
|
98
99
|
if (options.isUsingTsSolutionConfig) {
|
|
99
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
100
|
+
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
100
101
|
}
|
|
101
102
|
(0, sort_fields_1.sortPackageJsonFields)(host, options.projectRoot);
|
|
102
103
|
if (!options.skipFormat) {
|
|
@@ -158,6 +158,10 @@
|
|
|
158
158
|
"default": false,
|
|
159
159
|
"description": "Do not add dependencies to `package.json`.",
|
|
160
160
|
"x-priority": "internal"
|
|
161
|
+
},
|
|
162
|
+
"useProjectJson": {
|
|
163
|
+
"type": "boolean",
|
|
164
|
+
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
161
165
|
}
|
|
162
166
|
},
|
|
163
167
|
"required": ["directory"],
|