@nx/next 16.9.0-beta.2 → 16.9.0-beta.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": "16.9.0-beta.
|
|
3
|
+
"version": "16.9.0-beta.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, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
|
|
6
6
|
"repository": {
|
|
@@ -35,26 +35,25 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
38
|
-
"@nrwl/next": "16.9.0-beta.2",
|
|
39
|
-
"@nx/devkit": "16.9.0-beta.2",
|
|
40
|
-
"@nx/js": "16.9.0-beta.2",
|
|
41
|
-
"@nx/linter": "16.9.0-beta.2",
|
|
42
|
-
"@nx/react": "16.9.0-beta.2",
|
|
43
|
-
"@nx/web": "16.9.0-beta.2",
|
|
44
|
-
"@nx/workspace": "16.9.0-beta.2",
|
|
45
38
|
"@svgr/webpack": "^8.0.1",
|
|
46
39
|
"chalk": "^4.1.0",
|
|
47
40
|
"copy-webpack-plugin": "^10.2.4",
|
|
48
41
|
"fs-extra": "^11.1.0",
|
|
49
42
|
"ignore": "^5.0.4",
|
|
50
43
|
"semver": "7.5.3",
|
|
51
|
-
"tslib": "^2.3.0",
|
|
52
44
|
"url-loader": "^4.1.1",
|
|
53
|
-
"
|
|
45
|
+
"tslib": "^2.3.0",
|
|
46
|
+
"webpack-merge": "^5.8.0",
|
|
47
|
+
"@nx/devkit": "16.9.0-beta.4",
|
|
48
|
+
"@nx/js": "16.9.0-beta.4",
|
|
49
|
+
"@nx/linter": "16.9.0-beta.4",
|
|
50
|
+
"@nx/react": "16.9.0-beta.4",
|
|
51
|
+
"@nx/web": "16.9.0-beta.4",
|
|
52
|
+
"@nx/workspace": "16.9.0-beta.4",
|
|
53
|
+
"@nrwl/next": "*"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"type": "commonjs"
|
|
59
|
-
"gitHead": "e11d538fa2c7266066d554d9405abab8e0a65040"
|
|
58
|
+
"type": "commonjs"
|
|
60
59
|
}
|
|
@@ -23,7 +23,13 @@ function nxComponentTestingPreset(pathToConfig, options) {
|
|
|
23
23
|
let buildFileReplacements = [];
|
|
24
24
|
let buildOuputPath = `dist/${ctProjectName}/.next`;
|
|
25
25
|
if (buildTarget) {
|
|
26
|
-
const parsedBuildTarget = (0, devkit_1.parseTargetString)(buildTarget,
|
|
26
|
+
const parsedBuildTarget = (0, devkit_1.parseTargetString)(buildTarget, {
|
|
27
|
+
cwd: process.cwd(),
|
|
28
|
+
root: devkit_1.workspaceRoot,
|
|
29
|
+
isVerbose: false,
|
|
30
|
+
projectName: ctProjectName,
|
|
31
|
+
projectGraph: graph,
|
|
32
|
+
});
|
|
27
33
|
const buildProjectConfig = graph.nodes[parsedBuildTarget.project]?.data;
|
|
28
34
|
const buildExecutorContext = (0, ct_helpers_1.createExecutorContext)(graph, buildProjectConfig.targets, parsedBuildTarget.project, parsedBuildTarget.target, parsedBuildTarget.configuration);
|
|
29
35
|
const buildExecutorOptions = (0, devkit_1.readTargetOptions)({
|
package/plugins/with-nx.js
CHANGED
|
@@ -11,6 +11,7 @@ const baseNXEnvironmentVariables = [
|
|
|
11
11
|
'NX_PERF_LOGGING',
|
|
12
12
|
'NX_PROFILE',
|
|
13
13
|
'NX_PROJECT_GRAPH_CACHE_DIRECTORY',
|
|
14
|
+
'NX_INVOKED_BY_RUNNER',
|
|
14
15
|
'NX_PROJECT_GRAPH_MAX_WORKERS',
|
|
15
16
|
'NX_RUNNER',
|
|
16
17
|
'NX_SKIP_NX_CACHE',
|
|
@@ -50,20 +51,27 @@ function getWithNxContext() {
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
function getNxContext(graph, target) {
|
|
53
|
-
const { parseTargetString } = require('@nx/devkit');
|
|
54
|
+
const { parseTargetString, workspaceRoot } = require('@nx/devkit');
|
|
54
55
|
const projectNode = graph.nodes[target.project];
|
|
55
56
|
const targetConfig = projectNode.data.targets[target.target];
|
|
56
57
|
const targetOptions = targetConfig.options;
|
|
57
58
|
if (target.configuration) {
|
|
58
59
|
Object.assign(targetOptions, targetConfig.configurations[target.configuration]);
|
|
59
60
|
}
|
|
61
|
+
const partialExecutorContext = {
|
|
62
|
+
projectName: target.project,
|
|
63
|
+
targetName: target.target,
|
|
64
|
+
projectGraph: graph,
|
|
65
|
+
configurationName: target.configuration,
|
|
66
|
+
root: workspaceRoot,
|
|
67
|
+
};
|
|
60
68
|
if (targetOptions.devServerTarget) {
|
|
61
69
|
// Executors such as @nx/cypress:cypress define the devServerTarget option.
|
|
62
|
-
return getNxContext(graph, parseTargetString(targetOptions.devServerTarget,
|
|
70
|
+
return getNxContext(graph, parseTargetString(targetOptions.devServerTarget, partialExecutorContext));
|
|
63
71
|
}
|
|
64
72
|
else if (targetOptions.buildTarget) {
|
|
65
73
|
// Executors such as @nx/next:server or @nx/next:export define the buildTarget option.
|
|
66
|
-
return getNxContext(graph, parseTargetString(targetOptions.buildTarget,
|
|
74
|
+
return getNxContext(graph, parseTargetString(targetOptions.buildTarget, partialExecutorContext));
|
|
67
75
|
}
|
|
68
76
|
// Default case, return info for current target.
|
|
69
77
|
// This could be a build using @nx/next:build or run-commands without using our executors.
|
|
@@ -288,6 +296,7 @@ function getNxEnvironmentVariables() {
|
|
|
288
296
|
return env;
|
|
289
297
|
}, {});
|
|
290
298
|
}
|
|
299
|
+
let hasWarnedAboutDeprecatedEnvVariables = false;
|
|
291
300
|
/**
|
|
292
301
|
* TODO(v18)
|
|
293
302
|
* @deprecated Use Next.js 9.4+ built-in support for environment variables. Reference https://nextjs.org/docs/pages/api-reference/next-config-js/env
|
|
@@ -303,7 +312,8 @@ function addNxEnvVariables(config) {
|
|
|
303
312
|
.filter(([name]) => !maybeDefinePlugin.definitions[name])
|
|
304
313
|
.forEach(([name, value]) => (maybeDefinePlugin.definitions[name] = value));
|
|
305
314
|
const vars = getNonBaseVariables(env);
|
|
306
|
-
if (vars.length > 0) {
|
|
315
|
+
if (vars.length > 0 && !hasWarnedAboutDeprecatedEnvVariables) {
|
|
316
|
+
hasWarnedAboutDeprecatedEnvVariables = true;
|
|
307
317
|
console.warn(`Warning, in Nx 18 environment variables starting with NX_ will not be available in the browser, and currently will not work with @nx/next:server executor.\nPlease rename the following environment variables: ${vars.join(', ')} using Next.js' built-in support for environment variables. Reference https://nextjs.org/docs/pages/api-reference/next-config-js/env`);
|
|
308
318
|
}
|
|
309
319
|
}
|
|
@@ -28,7 +28,7 @@ async function exportExecutor(options, context) {
|
|
|
28
28
|
context.configurationName);
|
|
29
29
|
dependencies = result.dependencies;
|
|
30
30
|
}
|
|
31
|
-
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context
|
|
31
|
+
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context);
|
|
32
32
|
try {
|
|
33
33
|
const args = getBuildTargetCommand(options);
|
|
34
34
|
(0, child_process_1.execFileSync)(pmCmd, args, {
|
|
@@ -19,7 +19,7 @@ async function* runCustomServer(root, options, context) {
|
|
|
19
19
|
process.env.NX_NEXT_DIR = root;
|
|
20
20
|
process.env.NX_NEXT_PUBLIC_DIR = (0, path_1.join)(root, 'public');
|
|
21
21
|
const baseUrl = `http://${options.hostname || 'localhost'}:${options.port}`;
|
|
22
|
-
const customServerBuild = await (0, devkit_1.runExecutor)((0, devkit_1.parseTargetString)(options.customServerTarget, context
|
|
22
|
+
const customServerBuild = await (0, devkit_1.runExecutor)((0, devkit_1.parseTargetString)(options.customServerTarget, context), {
|
|
23
23
|
watch: options.dev ? true : false,
|
|
24
24
|
}, context);
|
|
25
25
|
for await (const result of customServerBuild) {
|