@nx/next 20.0.5 → 20.0.7
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/executors.json +0 -6
- package/package.json +7 -8
- package/plugins/with-nx.d.ts +5 -0
- package/plugins/with-nx.js +5 -1
- package/src/generators/application/application.js +1 -1
- package/src/generators/application/lib/add-project.js +0 -6
- package/src/generators/application/lib/create-application-files.js +1 -1
- package/src/executors/export/export.impl.d.ts +0 -17
- package/src/executors/export/export.impl.js +0 -58
- package/src/executors/export/schema.json +0 -30
package/executors.json
CHANGED
|
@@ -9,12 +9,6 @@
|
|
|
9
9
|
"implementation": "./src/executors/server/server.impl",
|
|
10
10
|
"schema": "./src/executors/server/schema.json",
|
|
11
11
|
"description": "Serve a Next.js application."
|
|
12
|
-
},
|
|
13
|
-
"export": {
|
|
14
|
-
"implementation": "./src/executors/export/export.impl",
|
|
15
|
-
"schema": "./src/executors/export/schema.json",
|
|
16
|
-
"description": "Export a Next.js application. The exported application is located at `dist/$outputPath/exported`.",
|
|
17
|
-
"x-deprecated": "Use static exports in next.config.js instead. See: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports."
|
|
18
12
|
}
|
|
19
13
|
}
|
|
20
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.0.7",
|
|
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,21 +35,20 @@
|
|
|
35
35
|
"next": ">=14.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@nx/devkit": "20.0.
|
|
38
|
+
"@nx/devkit": "20.0.7",
|
|
39
39
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
40
40
|
"@svgr/webpack": "^8.0.1",
|
|
41
41
|
"copy-webpack-plugin": "^10.2.4",
|
|
42
42
|
"file-loader": "^6.2.0",
|
|
43
43
|
"ignore": "^5.0.4",
|
|
44
|
-
"picocolors": "^1.1.0",
|
|
45
44
|
"semver": "^7.5.3",
|
|
46
45
|
"tslib": "^2.3.0",
|
|
47
46
|
"webpack-merge": "^5.8.0",
|
|
48
|
-
"@nx/js": "20.0.
|
|
49
|
-
"@nx/eslint": "20.0.
|
|
50
|
-
"@nx/react": "20.0.
|
|
51
|
-
"@nx/web": "20.0.
|
|
52
|
-
"@nx/webpack": "20.0.
|
|
47
|
+
"@nx/js": "20.0.7",
|
|
48
|
+
"@nx/eslint": "20.0.7",
|
|
49
|
+
"@nx/react": "20.0.7",
|
|
50
|
+
"@nx/web": "20.0.7",
|
|
51
|
+
"@nx/webpack": "20.0.7",
|
|
53
52
|
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
54
53
|
},
|
|
55
54
|
"publishConfig": {
|
package/plugins/with-nx.d.ts
CHANGED
|
@@ -13,6 +13,11 @@ export interface SvgrOptions {
|
|
|
13
13
|
}
|
|
14
14
|
export interface WithNxOptions extends NextConfig {
|
|
15
15
|
nx?: {
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Next.js via turbo conflicts with how webpack handles the import of SVGs.
|
|
18
|
+
* It is best to configure SVGR manually with the `@svgr/webpack` loader.
|
|
19
|
+
* We will remove this option in Nx 21.
|
|
20
|
+
* */
|
|
16
21
|
svgr?: boolean | SvgrOptions;
|
|
17
22
|
babelUpwardRootMode?: boolean;
|
|
18
23
|
fileReplacements?: {
|
package/plugins/with-nx.js
CHANGED
|
@@ -43,7 +43,7 @@ function getNxContext(graph, target) {
|
|
|
43
43
|
return getNxContext(graph, parseTargetString(targetOptions.devServerTarget, partialExecutorContext));
|
|
44
44
|
}
|
|
45
45
|
else if (targetOptions.buildTarget) {
|
|
46
|
-
// Executors such as @nx/next:server
|
|
46
|
+
// Executors such as @nx/next:server define the buildTarget option.
|
|
47
47
|
return getNxContext(graph, parseTargetString(targetOptions.buildTarget, partialExecutorContext));
|
|
48
48
|
}
|
|
49
49
|
// Default case, return info for current target.
|
|
@@ -231,6 +231,10 @@ function getNextConfig(nextConfig = {}, context = getWithNxContext()) {
|
|
|
231
231
|
*/
|
|
232
232
|
// Default SVGR support to be on for projects.
|
|
233
233
|
if (nx?.svgr !== false || typeof nx?.svgr === 'object') {
|
|
234
|
+
forNextVersion('>=15.0.0', () => {
|
|
235
|
+
// Since Next.js 15, turbopack could be enabled by default.
|
|
236
|
+
console.warn(`NX: Next.js SVGR support is deprecated. If used with turbopack, it may not work as expected and is not recommended. Please configure SVGR manually.`);
|
|
237
|
+
});
|
|
234
238
|
const defaultSvgrOptions = {
|
|
235
239
|
svgo: false,
|
|
236
240
|
titleProp: true,
|
|
@@ -77,7 +77,7 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
77
77
|
'@types/react': versions_1.typesReactVersion,
|
|
78
78
|
'@types/react-dom': versions_1.typesReactDomVersion,
|
|
79
79
|
};
|
|
80
|
-
if (
|
|
80
|
+
if (options.unitTestRunner && options.unitTestRunner !== 'none') {
|
|
81
81
|
devDependencies['@testing-library/react'] = versions_1.testingLibraryReactVersion;
|
|
82
82
|
}
|
|
83
83
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, { tslib: versions_2.tsLibVersion }, devDependencies));
|
|
@@ -45,12 +45,6 @@ function addProject(host, options) {
|
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
};
|
|
48
|
-
targets.export = {
|
|
49
|
-
executor: '@nx/next:export',
|
|
50
|
-
options: {
|
|
51
|
-
buildTarget: `${options.projectName}:build:production`,
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
48
|
}
|
|
55
49
|
const project = {
|
|
56
50
|
root: options.appProjectRoot,
|
|
@@ -62,7 +62,7 @@ function createApplicationFiles(host, options) {
|
|
|
62
62
|
// It'll be generated as needed when a lib is first added.
|
|
63
63
|
delete json.compilerOptions.paths;
|
|
64
64
|
updatedJson = {
|
|
65
|
-
...
|
|
65
|
+
...updatedJson,
|
|
66
66
|
compilerOptions: {
|
|
67
67
|
...updatedJson.compilerOptions,
|
|
68
68
|
...appJSON.compilerOptions,
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import { NextExportBuilderOptions } from '../../utils/types';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated use output inside of your next.config.js
|
|
5
|
-
* Example
|
|
6
|
-
* const nextConfig = {
|
|
7
|
-
nx: {
|
|
8
|
-
svgr: false,
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
output: 'export'
|
|
12
|
-
};
|
|
13
|
-
* Read https://nextjs.org/docs/pages/building-your-application/deploying/static-exports
|
|
14
|
-
**/
|
|
15
|
-
export default function exportExecutor(options: NextExportBuilderOptions, context: ExecutorContext): Promise<{
|
|
16
|
-
success: boolean;
|
|
17
|
-
}>;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = exportExecutor;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const export_1 = require("next/dist/export");
|
|
6
|
-
const nextTrace = require("next/dist/trace");
|
|
7
|
-
const os_1 = require("os");
|
|
8
|
-
const child_process_1 = require("child_process");
|
|
9
|
-
const pc = require("picocolors");
|
|
10
|
-
const semver_1 = require("semver");
|
|
11
|
-
// platform specific command name
|
|
12
|
-
const pmCmd = (0, os_1.platform)() === 'win32' ? `npx.cmd` : 'npx';
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated use output inside of your next.config.js
|
|
15
|
-
* Example
|
|
16
|
-
* const nextConfig = {
|
|
17
|
-
nx: {
|
|
18
|
-
svgr: false,
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
output: 'export'
|
|
22
|
-
};
|
|
23
|
-
* Read https://nextjs.org/docs/pages/building-your-application/deploying/static-exports
|
|
24
|
-
**/
|
|
25
|
-
async function exportExecutor(options, context) {
|
|
26
|
-
const nextJsVersion = require('next/package.json').version;
|
|
27
|
-
if ((0, semver_1.satisfies)(nextJsVersion, '>=14.0.0')) {
|
|
28
|
-
throw new Error('The export command has been removed in Next.js 14. Please update your Next config to use the output property. Read more: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports');
|
|
29
|
-
}
|
|
30
|
-
// Returns { project: ProjectGraphNode; target: string; configuration?: string;}
|
|
31
|
-
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context);
|
|
32
|
-
try {
|
|
33
|
-
const buildTargetName = (0, devkit_1.targetToTargetString)(buildTarget);
|
|
34
|
-
const args = getBuildTargetCommand(buildTargetName);
|
|
35
|
-
(0, child_process_1.execFileSync)(pmCmd, args, {
|
|
36
|
-
stdio: [0, 1, 2],
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
throw new Error(`Build target failed: ${pc.bold(options.buildTarget)}`);
|
|
41
|
-
}
|
|
42
|
-
const buildOptions = (0, devkit_1.readTargetOptions)(buildTarget, context);
|
|
43
|
-
const projectRoot = context.projectGraph.nodes[context.projectName].data.root;
|
|
44
|
-
// Taken from:
|
|
45
|
-
// https://github.com/vercel/next.js/blob/ead56eaab68409e96c19f7d9139747bac1197aa9/packages/next/cli/next-export.ts#L13
|
|
46
|
-
const nextExportCliSpan = nextTrace.trace('next-export-cli');
|
|
47
|
-
await (0, export_1.default)(projectRoot, {
|
|
48
|
-
statusMessage: 'Exporting',
|
|
49
|
-
silent: options.silent,
|
|
50
|
-
threads: options.threads,
|
|
51
|
-
outdir: `${buildOptions.outputPath}/exported`,
|
|
52
|
-
}, nextExportCliSpan);
|
|
53
|
-
return { success: true };
|
|
54
|
-
}
|
|
55
|
-
function getBuildTargetCommand(buildTarget) {
|
|
56
|
-
const cmd = ['nx', 'run', buildTarget];
|
|
57
|
-
return cmd;
|
|
58
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 2,
|
|
3
|
-
"outputCapture": "pipe",
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"title": "Next Export",
|
|
6
|
-
"description": "Export a Next.js application. The exported application is located at `dist/$outputPath/exported`.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"buildTarget": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"description": "Target which builds the application",
|
|
12
|
-
"x-priority": "important"
|
|
13
|
-
},
|
|
14
|
-
"silent": {
|
|
15
|
-
"type": "boolean",
|
|
16
|
-
"description": "Hide progress or not (default is `false`)",
|
|
17
|
-
"default": false
|
|
18
|
-
},
|
|
19
|
-
"threads": {
|
|
20
|
-
"type": "number",
|
|
21
|
-
"description": "Number of worker threads to utilize (defaults to the number of CPUs)"
|
|
22
|
-
},
|
|
23
|
-
"buildLibsFromSource": {
|
|
24
|
-
"type": "boolean",
|
|
25
|
-
"description": "Read buildable libraries from source instead of building them separately.",
|
|
26
|
-
"default": true
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"required": []
|
|
30
|
-
}
|