@nx/next 16.7.1 → 16.7.3
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.7.
|
|
3
|
+
"version": "16.7.3",
|
|
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,13 +35,13 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
38
|
-
"@nrwl/next": "16.7.
|
|
39
|
-
"@nx/devkit": "16.7.
|
|
40
|
-
"@nx/js": "16.7.
|
|
41
|
-
"@nx/linter": "16.7.
|
|
42
|
-
"@nx/react": "16.7.
|
|
43
|
-
"@nx/web": "16.7.
|
|
44
|
-
"@nx/workspace": "16.7.
|
|
38
|
+
"@nrwl/next": "16.7.3",
|
|
39
|
+
"@nx/devkit": "16.7.3",
|
|
40
|
+
"@nx/js": "16.7.3",
|
|
41
|
+
"@nx/linter": "16.7.3",
|
|
42
|
+
"@nx/react": "16.7.3",
|
|
43
|
+
"@nx/web": "16.7.3",
|
|
44
|
+
"@nx/workspace": "16.7.3",
|
|
45
45
|
"@svgr/webpack": "^8.0.1",
|
|
46
46
|
"chalk": "^4.1.0",
|
|
47
47
|
"copy-webpack-plugin": "^10.2.4",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"type": "commonjs",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "6ff5487c5f4ed9ed008df2af39e37d98fd289259"
|
|
61
61
|
}
|
|
@@ -14,12 +14,13 @@ const create_next_config_file_1 = require("./lib/create-next-config-file");
|
|
|
14
14
|
const check_project_1 = require("./lib/check-project");
|
|
15
15
|
const child_process_1 = require("child_process");
|
|
16
16
|
const create_cli_options_1 = require("../../utils/create-cli-options");
|
|
17
|
+
let childProcess;
|
|
17
18
|
function buildExecutor(options, context) {
|
|
18
|
-
var _a, _b, _c
|
|
19
|
-
var
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
var _d, _e;
|
|
20
21
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
22
|
// Cast to any to overwrite NODE_ENV
|
|
22
|
-
(
|
|
23
|
+
(_d = process.env).NODE_ENV || (_d.NODE_ENV = 'production');
|
|
23
24
|
const projectRoot = context.projectGraph.nodes[context.projectName].data.root;
|
|
24
25
|
(0, check_project_1.checkPublicDirectory)(projectRoot);
|
|
25
26
|
// Set `__NEXT_REACT_ROOT` based on installed ReactDOM version
|
|
@@ -32,32 +33,21 @@ function buildExecutor(options, context) {
|
|
|
32
33
|
const hasReact18 = reactDomVersion &&
|
|
33
34
|
(0, semver_1.gte)((0, semver_2.checkAndCleanWithSemver)('react-dom', reactDomVersion), '18.0.0');
|
|
34
35
|
if (hasReact18) {
|
|
35
|
-
(
|
|
36
|
+
(_e = process.env)['__NEXT_REACT_ROOT'] || (_e['__NEXT_REACT_ROOT'] = 'true');
|
|
36
37
|
}
|
|
37
|
-
const { experimentalAppOnly, profile, debug, outputPath } = options;
|
|
38
|
-
// Set output path here since it can also be set via CLI
|
|
39
|
-
// We can retrieve it inside plugins/with-nx
|
|
40
|
-
(_d = (_g = process.env).NX_NEXT_OUTPUT_PATH) !== null && _d !== void 0 ? _d : (_g.NX_NEXT_OUTPUT_PATH = outputPath);
|
|
41
|
-
const args = (0, create_cli_options_1.createCliOptions)({ experimentalAppOnly, profile, debug });
|
|
42
|
-
const isYarnBerry = (0, devkit_1.detectPackageManager)() === 'yarn' &&
|
|
43
|
-
(0, semver_1.gte)((0, devkit_1.getPackageManagerVersion)('yarn', devkit_1.workspaceRoot), '2.0.0');
|
|
44
|
-
const buildCommand = isYarnBerry
|
|
45
|
-
? `yarn next build ${projectRoot}`
|
|
46
|
-
: 'npx next build';
|
|
47
|
-
const command = `${buildCommand} ${args.join(' ')}`;
|
|
48
|
-
const execSyncOptions = {
|
|
49
|
-
stdio: 'inherit',
|
|
50
|
-
encoding: 'utf-8',
|
|
51
|
-
cwd: projectRoot,
|
|
52
|
-
};
|
|
53
38
|
try {
|
|
54
|
-
(
|
|
39
|
+
yield runCliBuild(devkit_1.workspaceRoot, projectRoot, options);
|
|
55
40
|
}
|
|
56
41
|
catch (error) {
|
|
57
|
-
devkit_1.logger.error(`Error occurred while trying to run the
|
|
42
|
+
devkit_1.logger.error(`Error occurred while trying to run the build command`);
|
|
58
43
|
devkit_1.logger.error(error);
|
|
59
44
|
return { success: false };
|
|
60
45
|
}
|
|
46
|
+
finally {
|
|
47
|
+
if (childProcess) {
|
|
48
|
+
childProcess.kill();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
61
51
|
if (!(0, fileutils_1.directoryExists)(options.outputPath)) {
|
|
62
52
|
(0, fs_extra_1.mkdir)(options.outputPath);
|
|
63
53
|
}
|
|
@@ -90,3 +80,33 @@ function buildExecutor(options, context) {
|
|
|
90
80
|
});
|
|
91
81
|
}
|
|
92
82
|
exports.default = buildExecutor;
|
|
83
|
+
function runCliBuild(workspaceRoot, projectRoot, options) {
|
|
84
|
+
var _a;
|
|
85
|
+
var _b;
|
|
86
|
+
const { experimentalAppOnly, profile, debug, outputPath } = options;
|
|
87
|
+
// Set output path here since it can also be set via CLI
|
|
88
|
+
// We can retrieve it inside plugins/with-nx
|
|
89
|
+
(_a = (_b = process.env).NX_NEXT_OUTPUT_PATH) !== null && _a !== void 0 ? _a : (_b.NX_NEXT_OUTPUT_PATH = outputPath);
|
|
90
|
+
const args = (0, create_cli_options_1.createCliOptions)({ experimentalAppOnly, profile, debug });
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
childProcess = (0, child_process_1.fork)(require.resolve('next/dist/bin/next'), ['build', ...args], {
|
|
93
|
+
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
94
|
+
stdio: 'inherit',
|
|
95
|
+
env: process.env,
|
|
96
|
+
});
|
|
97
|
+
// Ensure the child process is killed when the parent exits
|
|
98
|
+
process.on('exit', () => childProcess.kill());
|
|
99
|
+
process.on('SIGTERM', () => childProcess.kill());
|
|
100
|
+
childProcess.on('error', (err) => {
|
|
101
|
+
reject(err);
|
|
102
|
+
});
|
|
103
|
+
childProcess.on('exit', (code) => {
|
|
104
|
+
if (code === 0) {
|
|
105
|
+
resolve(code);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
reject(code);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|