@nx/next 19.6.2 → 19.6.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": "19.6.
|
|
3
|
+
"version": "19.6.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": "19.6.
|
|
38
|
+
"@nx/devkit": "19.6.4",
|
|
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.6.
|
|
50
|
-
"@nx/eslint": "19.6.
|
|
51
|
-
"@nx/react": "19.6.
|
|
52
|
-
"@nx/web": "19.6.
|
|
53
|
-
"@nx/webpack": "19.6.
|
|
54
|
-
"@nx/workspace": "19.6.
|
|
49
|
+
"@nx/js": "19.6.4",
|
|
50
|
+
"@nx/eslint": "19.6.4",
|
|
51
|
+
"@nx/react": "19.6.4",
|
|
52
|
+
"@nx/web": "19.6.4",
|
|
53
|
+
"@nx/webpack": "19.6.4",
|
|
54
|
+
"@nx/workspace": "19.6.4",
|
|
55
55
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
56
|
-
"@nrwl/next": "19.6.
|
|
56
|
+
"@nrwl/next": "19.6.4"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
@@ -7,11 +7,13 @@ const versions_1 = require("../../../utils/versions");
|
|
|
7
7
|
const web_1 = require("@nx/web");
|
|
8
8
|
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
9
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");
|
|
10
11
|
async function addE2e(host, options) {
|
|
11
12
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
12
13
|
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
13
14
|
? p === '@nx/next/plugin'
|
|
14
15
|
: p.plugin === '@nx/next/plugin');
|
|
16
|
+
const e2eWebServerInfo = await getNextE2EWebServerInfo(host, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'next.config.js'), options.addPlugin);
|
|
15
17
|
if (options.e2eTestRunner === 'cypress') {
|
|
16
18
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
17
19
|
if (!hasPlugin) {
|
|
@@ -35,17 +37,16 @@ async function addE2e(host, options) {
|
|
|
35
37
|
project: options.e2eProjectName,
|
|
36
38
|
directory: 'src',
|
|
37
39
|
skipFormat: true,
|
|
38
|
-
devServerTarget:
|
|
39
|
-
baseUrl:
|
|
40
|
+
devServerTarget: e2eWebServerInfo.e2eDevServerTarget,
|
|
41
|
+
baseUrl: e2eWebServerInfo.e2eWebServerAddress,
|
|
40
42
|
jsx: true,
|
|
41
43
|
webServerCommands: hasPlugin
|
|
42
44
|
? {
|
|
43
|
-
default:
|
|
45
|
+
default: e2eWebServerInfo.e2eWebServerCommand,
|
|
44
46
|
}
|
|
45
47
|
: undefined,
|
|
46
|
-
ciWebServerCommand:
|
|
47
|
-
|
|
48
|
-
: undefined,
|
|
48
|
+
ciWebServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
|
|
49
|
+
ciBaseUrl: e2eWebServerInfo.e2eCiBaseUrl,
|
|
49
50
|
});
|
|
50
51
|
if (options.addPlugin ||
|
|
51
52
|
(0, devkit_1.readNxJson)(host).plugins?.find((p) => typeof p === 'string'
|
|
@@ -80,8 +81,8 @@ async function addE2e(host, options) {
|
|
|
80
81
|
js: false,
|
|
81
82
|
linter: options.linter,
|
|
82
83
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
83
|
-
webServerAddress:
|
|
84
|
-
webServerCommand:
|
|
84
|
+
webServerAddress: e2eWebServerInfo.e2eCiBaseUrl,
|
|
85
|
+
webServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
|
|
85
86
|
addPlugin: options.addPlugin,
|
|
86
87
|
});
|
|
87
88
|
if (options.addPlugin ||
|
|
@@ -101,3 +102,24 @@ async function addE2e(host, options) {
|
|
|
101
102
|
}
|
|
102
103
|
return () => { };
|
|
103
104
|
}
|
|
105
|
+
async function getNextE2EWebServerInfo(tree, projectName, configFilePath, isPluginBeingAdded) {
|
|
106
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
107
|
+
let e2ePort = isPluginBeingAdded ? 3000 : 4200;
|
|
108
|
+
const defaultServeTarget = isPluginBeingAdded ? 'dev' : 'serve';
|
|
109
|
+
if (nxJson.targetDefaults?.[defaultServeTarget] &&
|
|
110
|
+
nxJson.targetDefaults?.[defaultServeTarget].options?.port) {
|
|
111
|
+
e2ePort = nxJson.targetDefaults?.[defaultServeTarget].options?.port;
|
|
112
|
+
}
|
|
113
|
+
return (0, e2e_web_server_info_utils_1.getE2EWebServerInfo)(tree, projectName, {
|
|
114
|
+
plugin: '@nx/next/plugin',
|
|
115
|
+
serveTargetName: 'devTargetName',
|
|
116
|
+
serveStaticTargetName: 'serveStaticTargetName',
|
|
117
|
+
configFilePath,
|
|
118
|
+
}, {
|
|
119
|
+
defaultServeTargetName: defaultServeTarget,
|
|
120
|
+
defaultServeStaticTargetName: 'serve-static',
|
|
121
|
+
defaultE2EWebServerAddress: `http://127.0.0.1:${e2ePort}`,
|
|
122
|
+
defaultE2ECiBaseUrl: `http://localhost:${e2ePort}`,
|
|
123
|
+
defaultE2EPort: e2ePort,
|
|
124
|
+
}, isPluginBeingAdded);
|
|
125
|
+
}
|
|
@@ -6,9 +6,6 @@ export interface NormalizedSchema extends Schema {
|
|
|
6
6
|
outputPath: string;
|
|
7
7
|
e2eProjectName: string;
|
|
8
8
|
e2eProjectRoot: string;
|
|
9
|
-
e2eWebServerAddress: string;
|
|
10
|
-
e2eWebServerTarget: string;
|
|
11
|
-
e2ePort: number;
|
|
12
9
|
parsedTags: string[];
|
|
13
10
|
fileName: string;
|
|
14
11
|
styledModule: null | string;
|
|
@@ -20,30 +20,8 @@ async function normalizeOptions(host, options) {
|
|
|
20
20
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
21
21
|
nxJson.useInferencePlugins !== false;
|
|
22
22
|
options.addPlugin ??= addPlugin;
|
|
23
|
-
let e2eWebServerTarget = options.addPlugin ? 'start' : 'serve';
|
|
24
|
-
if (options.addPlugin) {
|
|
25
|
-
if (nxJson.plugins) {
|
|
26
|
-
for (const plugin of nxJson.plugins) {
|
|
27
|
-
if (typeof plugin === 'object' &&
|
|
28
|
-
plugin.plugin === '@nx/next/plugin' &&
|
|
29
|
-
plugin.options.startTargetName) {
|
|
30
|
-
e2eWebServerTarget = plugin.options
|
|
31
|
-
.startTargetName;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
let e2ePort = options.addPlugin ? 3000 : 4200;
|
|
37
|
-
if (nxJson.targetDefaults?.[e2eWebServerTarget] &&
|
|
38
|
-
(nxJson.targetDefaults?.[e2eWebServerTarget].options?.port ||
|
|
39
|
-
nxJson.targetDefaults?.[e2eWebServerTarget].options?.env?.PORT)) {
|
|
40
|
-
e2ePort =
|
|
41
|
-
nxJson.targetDefaults?.[e2eWebServerTarget].options?.port ||
|
|
42
|
-
nxJson.targetDefaults?.[e2eWebServerTarget].options?.env?.PORT;
|
|
43
|
-
}
|
|
44
23
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
45
24
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
46
|
-
const e2eWebServerAddress = `http://localhost:${e2ePort}`;
|
|
47
25
|
const name = (0, devkit_1.names)(options.name).fileName;
|
|
48
26
|
const outputPath = (0, devkit_1.joinPathFragments)('dist', appProjectRoot, ...(options.rootProject ? [name] : []));
|
|
49
27
|
const parsedTags = options.tags
|
|
@@ -63,9 +41,6 @@ async function normalizeOptions(host, options) {
|
|
|
63
41
|
appProjectRoot,
|
|
64
42
|
e2eProjectName,
|
|
65
43
|
e2eProjectRoot,
|
|
66
|
-
e2eWebServerAddress,
|
|
67
|
-
e2eWebServerTarget,
|
|
68
|
-
e2ePort,
|
|
69
44
|
e2eTestRunner: options.e2eTestRunner || 'playwright',
|
|
70
45
|
fileName,
|
|
71
46
|
linter: options.linter || eslint_1.Linter.EsLint,
|