@nx/next 17.3.0-beta.6 → 17.3.0-beta.8
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 +8 -8
- package/plugins/with-nx.js +0 -46
- package/src/executors/server/custom-server.impl.js +1 -1
- package/src/executors/server/server.impl.js +5 -5
- package/src/generators/application/files/pages/__fileName__.tsx__tmpl__ +1 -1
- package/src/generators/init/init.js +5 -0
- package/src/generators/init/schema.d.ts +1 -0
- package/src/generators/init/schema.json +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "17.3.0-beta.
|
|
3
|
+
"version": "17.3.0-beta.8",
|
|
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": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"next": ">=13.0.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nx/devkit": "17.3.0-beta.
|
|
37
|
+
"@nx/devkit": "17.3.0-beta.8",
|
|
38
38
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
39
39
|
"@svgr/webpack": "^8.0.1",
|
|
40
40
|
"chalk": "^4.1.0",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"url-loader": "^4.1.1",
|
|
46
46
|
"tslib": "^2.3.0",
|
|
47
47
|
"webpack-merge": "^5.8.0",
|
|
48
|
-
"@nx/js": "17.3.0-beta.
|
|
49
|
-
"@nx/eslint": "17.3.0-beta.
|
|
50
|
-
"@nx/react": "17.3.0-beta.
|
|
51
|
-
"@nx/web": "17.3.0-beta.
|
|
52
|
-
"@nx/workspace": "17.3.0-beta.
|
|
53
|
-
"@nrwl/next": "17.3.0-beta.
|
|
48
|
+
"@nx/js": "17.3.0-beta.8",
|
|
49
|
+
"@nx/eslint": "17.3.0-beta.8",
|
|
50
|
+
"@nx/react": "17.3.0-beta.8",
|
|
51
|
+
"@nx/web": "17.3.0-beta.8",
|
|
52
|
+
"@nx/workspace": "17.3.0-beta.8",
|
|
53
|
+
"@nrwl/next": "17.3.0-beta.8"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
package/plugins/with-nx.js
CHANGED
|
@@ -1,43 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withNx = exports.forNextVersion = exports.getAliasForProject = exports.getNextConfig = void 0;
|
|
4
|
-
const baseNXEnvironmentVariables = [
|
|
5
|
-
'NX_BASE',
|
|
6
|
-
'NX_CACHE_DIRECTORY',
|
|
7
|
-
'NX_CACHE_PROJECT_GRAPH',
|
|
8
|
-
'NX_DAEMON',
|
|
9
|
-
'NX_DEFAULT_PROJECT',
|
|
10
|
-
'NX_HEAD',
|
|
11
|
-
'NX_PERF_LOGGING',
|
|
12
|
-
'NX_PROFILE',
|
|
13
|
-
'NX_PROJECT_GRAPH_CACHE_DIRECTORY',
|
|
14
|
-
'NX_INVOKED_BY_RUNNER',
|
|
15
|
-
'NX_PROJECT_GRAPH_MAX_WORKERS',
|
|
16
|
-
'NX_RUNNER',
|
|
17
|
-
'NX_SKIP_NX_CACHE',
|
|
18
|
-
'NX_TASKS_RUNNER',
|
|
19
|
-
'NX_TASKS_RUNNER_DYNAMIC_OUTPUT',
|
|
20
|
-
'NX_VERBOSE_LOGGING',
|
|
21
|
-
'NX_DRY_RUN',
|
|
22
|
-
'NX_INTERACTIVE',
|
|
23
|
-
'NX_GENERATE_QUIET',
|
|
24
|
-
'NX_PREFER_TS_NODE',
|
|
25
|
-
'NX_TASK_TARGET_PROJECT',
|
|
26
|
-
'NX_TASK_TARGET_TARGET',
|
|
27
|
-
'NX_TASK_TARGET_CONFIGURATION',
|
|
28
|
-
'NX_CLI_SET',
|
|
29
|
-
'NX_LOAD_DOT_ENV_FILES',
|
|
30
|
-
'NX_WORKSPACE_ROOT',
|
|
31
|
-
'NX_TASK_HASH',
|
|
32
|
-
'NX_NEXT_DIR',
|
|
33
|
-
'NX_NEXT_OUTPUT_PATH',
|
|
34
|
-
'NX_E2E_RUN_E2E',
|
|
35
|
-
'NX_E2E_CI_CACHE_KEY',
|
|
36
|
-
'NX_MAPPINGS',
|
|
37
|
-
'NX_FILE_TO_RUN',
|
|
38
|
-
'NX_NEXT_PUBLIC_DIR',
|
|
39
|
-
'NX_CYPRESS_COMPONENT_TEST',
|
|
40
|
-
];
|
|
41
4
|
function regexEqual(x, y) {
|
|
42
5
|
return (x instanceof RegExp &&
|
|
43
6
|
y instanceof RegExp &&
|
|
@@ -296,9 +259,6 @@ function getNextConfig(nextConfig = {}, context = getWithNxContext()) {
|
|
|
296
259
|
};
|
|
297
260
|
}
|
|
298
261
|
exports.getNextConfig = getNextConfig;
|
|
299
|
-
function getNonBaseVariables(oldEnv) {
|
|
300
|
-
return Object.keys(oldEnv).filter((env) => !baseNXEnvironmentVariables.includes(env));
|
|
301
|
-
}
|
|
302
262
|
function getNxEnvironmentVariables() {
|
|
303
263
|
return Object.keys(process.env)
|
|
304
264
|
.filter((env) => /^NX_/i.test(env))
|
|
@@ -307,7 +267,6 @@ function getNxEnvironmentVariables() {
|
|
|
307
267
|
return env;
|
|
308
268
|
}, {});
|
|
309
269
|
}
|
|
310
|
-
let hasWarnedAboutDeprecatedEnvVariables = false;
|
|
311
270
|
/**
|
|
312
271
|
* TODO(v18)
|
|
313
272
|
* @deprecated Use Next.js 9.4+ built-in support for environment variables. Reference https://nextjs.org/docs/pages/api-reference/next-config-js/env
|
|
@@ -322,11 +281,6 @@ function addNxEnvVariables(config) {
|
|
|
322
281
|
.map(([name, value]) => [`process.env.${name}`, `"${value}"`])
|
|
323
282
|
.filter(([name]) => !maybeDefinePlugin.definitions[name])
|
|
324
283
|
.forEach(([name, value]) => (maybeDefinePlugin.definitions[name] = value));
|
|
325
|
-
const vars = getNonBaseVariables(env);
|
|
326
|
-
if (vars.length > 0 && !hasWarnedAboutDeprecatedEnvVariables) {
|
|
327
|
-
hasWarnedAboutDeprecatedEnvVariables = true;
|
|
328
|
-
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`);
|
|
329
|
-
}
|
|
330
284
|
}
|
|
331
285
|
}
|
|
332
286
|
function getAliasForProject(node, paths) {
|
|
@@ -17,7 +17,7 @@ async function* serveExecutor(options, context) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.default = serveExecutor;
|
|
19
19
|
async function* runCustomServer(root, options, context) {
|
|
20
|
-
process.env.NX_NEXT_DIR
|
|
20
|
+
process.env.NX_NEXT_DIR ??= root;
|
|
21
21
|
process.env.NX_NEXT_PUBLIC_DIR = (0, path_1.join)(root, 'public');
|
|
22
22
|
const baseUrl = `http://${options.hostname || 'localhost'}:${options.port}`;
|
|
23
23
|
const customServerBuild = await (0, devkit_1.runExecutor)((0, devkit_1.parseTargetString)(options.customServerTarget, context), {
|
|
@@ -8,14 +8,15 @@ const create_cli_options_1 = require("../../utils/create-cli-options");
|
|
|
8
8
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
9
9
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
10
10
|
async function* serveExecutor(options, context) {
|
|
11
|
+
const buildOptions = (0, devkit_1.readTargetOptions)((0, devkit_1.parseTargetString)(options.buildTarget, context), context);
|
|
12
|
+
const projectRoot = context.workspace.projects[context.projectName].root;
|
|
13
|
+
// This is required for the default custom server to work. See the @nx/next:app generator.
|
|
14
|
+
const nextDir = (0, path_1.resolve)(context.root, buildOptions.outputPath);
|
|
15
|
+
process.env.NX_NEXT_DIR ??= options.dev ? projectRoot : nextDir;
|
|
11
16
|
if (options.customServerTarget) {
|
|
12
17
|
return yield* (0, custom_server_impl_1.default)(options, context);
|
|
13
18
|
}
|
|
14
|
-
const buildOptions = (0, devkit_1.readTargetOptions)((0, devkit_1.parseTargetString)(options.buildTarget, context), context);
|
|
15
|
-
const projectRoot = context.workspace.projects[context.projectName].root;
|
|
16
19
|
const { keepAliveTimeout, hostname } = options;
|
|
17
|
-
// This is required for the default custom server to work. See the @nx/next:app generator.
|
|
18
|
-
process.env.NX_NEXT_DIR = projectRoot;
|
|
19
20
|
// Cast to any to overwrite NODE_ENV
|
|
20
21
|
process.env.NODE_ENV = process.env.NODE_ENV
|
|
21
22
|
? process.env.NODE_ENV
|
|
@@ -29,7 +30,6 @@ async function* serveExecutor(options, context) {
|
|
|
29
30
|
if (keepAliveTimeout && !options.dev) {
|
|
30
31
|
args.push(`--keepAliveTimeout=${keepAliveTimeout}`);
|
|
31
32
|
}
|
|
32
|
-
const nextDir = (0, path_1.resolve)(context.root, buildOptions.outputPath);
|
|
33
33
|
const mode = options.dev ? 'dev' : 'start';
|
|
34
34
|
const turbo = options.turbo && options.dev ? '--turbo' : '';
|
|
35
35
|
const experimentalHttps = options.experimentalHttps && options.dev ? '--experimental-https' : '';
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nextInitGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const update_package_scripts_1 = require("@nx/devkit/src/utils/update-package-scripts");
|
|
5
6
|
const versions_1 = require("@nx/react/src/utils/versions");
|
|
7
|
+
const plugin_1 = require("../../plugins/plugin");
|
|
6
8
|
const add_gitignore_entry_1 = require("../../utils/add-gitignore-entry");
|
|
7
9
|
const versions_2 = require("../../utils/versions");
|
|
8
10
|
const add_plugin_1 = require("./lib/add-plugin");
|
|
@@ -27,6 +29,9 @@ async function nextInitGenerator(host, schema) {
|
|
|
27
29
|
if (!schema.skipPackageJson) {
|
|
28
30
|
installTask = updateDependencies(host, schema);
|
|
29
31
|
}
|
|
32
|
+
if (schema.updatePackageScripts) {
|
|
33
|
+
await (0, update_package_scripts_1.updatePackageScripts)(host, plugin_1.createNodes);
|
|
34
|
+
}
|
|
30
35
|
return installTask;
|
|
31
36
|
}
|
|
32
37
|
exports.nextInitGenerator = nextInitGenerator;
|
|
@@ -22,6 +22,12 @@
|
|
|
22
22
|
"x-priority": "internal",
|
|
23
23
|
"description": "Keep existing dependencies versions",
|
|
24
24
|
"default": false
|
|
25
|
+
},
|
|
26
|
+
"updatePackageScripts": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"x-priority": "internal",
|
|
29
|
+
"description": "Update `package.json` scripts with inferred targets",
|
|
30
|
+
"default": false
|
|
25
31
|
}
|
|
26
32
|
},
|
|
27
33
|
"required": []
|