nx 20.0.0-beta.2 → 20.0.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.json +9 -1
- package/package.json +14 -13
- package/schemas/nx-schema.json +26 -21
- package/src/command-line/graph/graph.js +9 -9
- package/src/command-line/init/implementation/add-nx-to-nest.js +5 -5
- package/src/command-line/init/implementation/react/clean-up-files.js +7 -7
- package/src/command-line/init/implementation/react/index.js +19 -12
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +3 -3
- package/src/command-line/release/changelog.js +1 -2
- package/src/command-line/release/config/version-plans.js +6 -7
- package/src/command-line/release/plan.js +6 -5
- package/src/command-line/release/release.js +2 -2
- package/src/command-line/release/version.js +5 -3
- package/src/command-line/reset/reset.js +4 -4
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/cache.d.ts +1 -2
- package/src/daemon/cache.js +12 -21
- package/src/daemon/client/client.js +9 -8
- package/src/daemon/tmp-dir.js +6 -7
- package/src/generators/tree.d.ts +1 -1
- package/src/generators/tree.js +11 -11
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/js/index.js +1 -2
- package/src/project-graph/nx-deps-cache.js +5 -6
- package/src/tasks-runner/cache.js +17 -16
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +5 -0
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +7 -0
- package/src/tasks-runner/remove-old-cache-records.js +2 -3
- package/src/utils/fileutils.d.ts +9 -1
- package/src/utils/fileutils.js +29 -12
- package/src/utils/ignore.js +2 -2
- package/src/utils/package-manager.js +2 -2
- package/src/utils/plugins/core-plugins.js +4 -0
package/.eslintrc.json
CHANGED
@@ -5,7 +5,15 @@
|
|
5
5
|
"overrides": [
|
6
6
|
{
|
7
7
|
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
8
|
-
"rules": {
|
8
|
+
"rules": {
|
9
|
+
"no-restricted-imports": [
|
10
|
+
"error",
|
11
|
+
{
|
12
|
+
"name": "fs-extra",
|
13
|
+
"message": "Please use equivalent utilities from `node:fs` instead."
|
14
|
+
}
|
15
|
+
]
|
16
|
+
}
|
9
17
|
},
|
10
18
|
{
|
11
19
|
"files": ["*.ts"],
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "20.0.0-beta.
|
3
|
+
"version": "20.0.0-beta.3",
|
4
4
|
"private": false,
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
6
6
|
"repository": {
|
@@ -49,7 +49,6 @@
|
|
49
49
|
"figures": "3.2.0",
|
50
50
|
"flat": "^5.0.2",
|
51
51
|
"front-matter": "^4.0.2",
|
52
|
-
"fs-extra": "^11.1.0",
|
53
52
|
"ignore": "^5.0.4",
|
54
53
|
"jest-diff": "^29.4.1",
|
55
54
|
"jsonc-parser": "3.2.0",
|
@@ -68,7 +67,7 @@
|
|
68
67
|
"yargs-parser": "21.1.1",
|
69
68
|
"node-machine-id": "1.1.12",
|
70
69
|
"ora": "5.3.0",
|
71
|
-
"@nrwl/tao": "20.0.0-beta.
|
70
|
+
"@nrwl/tao": "20.0.0-beta.3"
|
72
71
|
},
|
73
72
|
"peerDependencies": {
|
74
73
|
"@swc-node/register": "^1.8.0",
|
@@ -83,16 +82,16 @@
|
|
83
82
|
}
|
84
83
|
},
|
85
84
|
"optionalDependencies": {
|
86
|
-
"@nx/nx-darwin-x64": "20.0.0-beta.
|
87
|
-
"@nx/nx-darwin-arm64": "20.0.0-beta.
|
88
|
-
"@nx/nx-linux-x64-gnu": "20.0.0-beta.
|
89
|
-
"@nx/nx-linux-x64-musl": "20.0.0-beta.
|
90
|
-
"@nx/nx-win32-x64-msvc": "20.0.0-beta.
|
91
|
-
"@nx/nx-linux-arm64-gnu": "20.0.0-beta.
|
92
|
-
"@nx/nx-linux-arm64-musl": "20.0.0-beta.
|
93
|
-
"@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "20.0.0-beta.
|
95
|
-
"@nx/nx-freebsd-x64": "20.0.0-beta.
|
85
|
+
"@nx/nx-darwin-x64": "20.0.0-beta.3",
|
86
|
+
"@nx/nx-darwin-arm64": "20.0.0-beta.3",
|
87
|
+
"@nx/nx-linux-x64-gnu": "20.0.0-beta.3",
|
88
|
+
"@nx/nx-linux-x64-musl": "20.0.0-beta.3",
|
89
|
+
"@nx/nx-win32-x64-msvc": "20.0.0-beta.3",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "20.0.0-beta.3",
|
91
|
+
"@nx/nx-linux-arm64-musl": "20.0.0-beta.3",
|
92
|
+
"@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.3",
|
93
|
+
"@nx/nx-win32-arm64-msvc": "20.0.0-beta.3",
|
94
|
+
"@nx/nx-freebsd-x64": "20.0.0-beta.3"
|
96
95
|
},
|
97
96
|
"nx-migrations": {
|
98
97
|
"migrations": "./migrations.json",
|
@@ -141,6 +140,8 @@
|
|
141
140
|
"@nrwl/rollup",
|
142
141
|
"@nx/remix",
|
143
142
|
"@nrwl/remix",
|
143
|
+
"@nx/rspack",
|
144
|
+
"@nrwl/rspack",
|
144
145
|
"@nx/storybook",
|
145
146
|
"@nrwl/storybook",
|
146
147
|
"@nrwl/tao",
|
package/schemas/nx-schema.json
CHANGED
@@ -152,25 +152,7 @@
|
|
152
152
|
]
|
153
153
|
},
|
154
154
|
"version": {
|
155
|
-
"
|
156
|
-
{
|
157
|
-
"$ref": "#/definitions/NxReleaseVersionConfiguration"
|
158
|
-
},
|
159
|
-
{
|
160
|
-
"allOf": [
|
161
|
-
{
|
162
|
-
"not": {
|
163
|
-
"required": ["git"]
|
164
|
-
}
|
165
|
-
},
|
166
|
-
{
|
167
|
-
"not": {
|
168
|
-
"required": ["preVersionCommand"]
|
169
|
-
}
|
170
|
-
}
|
171
|
-
]
|
172
|
-
}
|
173
|
-
]
|
155
|
+
"$ref": "#/definitions/NxReleaseGroupVersionConfiguration"
|
174
156
|
},
|
175
157
|
"changelog": {
|
176
158
|
"oneOf": [
|
@@ -675,9 +657,32 @@
|
|
675
657
|
},
|
676
658
|
"preVersionCommand": {
|
677
659
|
"type": "string",
|
678
|
-
"description": "A command to run after validation of nx release configuration, but before versioning begins.
|
660
|
+
"description": "A command to run after validation of nx release configuration, but before versioning begins. Useful for preparing build artifacts. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
|
679
661
|
}
|
680
|
-
}
|
662
|
+
},
|
663
|
+
"additionalProperties": false
|
664
|
+
},
|
665
|
+
"NxReleaseGroupVersionConfiguration": {
|
666
|
+
"type": "object",
|
667
|
+
"properties": {
|
668
|
+
"conventionalCommits": {
|
669
|
+
"type": "boolean",
|
670
|
+
"description": "Shorthand for enabling the current version of projects to be resolved from git tags, and the next version to be determined by analyzing commit messages according to the Conventional Commits specification.",
|
671
|
+
"default": false
|
672
|
+
},
|
673
|
+
"generator": {
|
674
|
+
"type": "string"
|
675
|
+
},
|
676
|
+
"generatorOptions": {
|
677
|
+
"type": "object",
|
678
|
+
"additionalProperties": true
|
679
|
+
},
|
680
|
+
"groupPreVersionCommand": {
|
681
|
+
"type": "string",
|
682
|
+
"description": "A command to run after validation of nx release configuration AND after the release.version.preVersionCommand (if any), but before versioning begins for this specific group. Useful for preparing build artifacts for the group. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
|
683
|
+
}
|
684
|
+
},
|
685
|
+
"additionalProperties": false
|
681
686
|
},
|
682
687
|
"NxReleaseChangelogConfiguration": {
|
683
688
|
"type": "object",
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateGraph = generateGraph;
|
4
4
|
const crypto_1 = require("crypto");
|
5
5
|
const node_child_process_1 = require("node:child_process");
|
6
|
-
const
|
7
|
-
const fs_extra_1 = require("fs-extra");
|
6
|
+
const node_fs_1 = require("node:fs");
|
8
7
|
const http = require("http");
|
9
8
|
const minimatch_1 = require("minimatch");
|
10
9
|
const node_url_1 = require("node:url");
|
@@ -225,7 +224,7 @@ async function generateGraph(args, affectedProjects) {
|
|
225
224
|
process.exit(1);
|
226
225
|
}
|
227
226
|
}
|
228
|
-
let html = (0,
|
227
|
+
let html = (0, node_fs_1.readFileSync)((0, path_1.join)(__dirname, '../../core/graph/index.html'), 'utf-8');
|
229
228
|
prunedGraph = filterGraph(prunedGraph, args.focus || null, args.exclude || []);
|
230
229
|
if (args.file) {
|
231
230
|
// stdout is a magical constant that doesn't actually write a file
|
@@ -243,7 +242,7 @@ async function generateGraph(args, affectedProjects) {
|
|
243
242
|
if (ext === '.html') {
|
244
243
|
const assetsFolder = (0, path_1.join)(fileFolderPath, 'static');
|
245
244
|
const assets = [];
|
246
|
-
(0,
|
245
|
+
(0, node_fs_1.cpSync)((0, path_1.join)(__dirname, '../../core/graph'), assetsFolder, {
|
247
246
|
filter: (_src, dest) => {
|
248
247
|
const isntHtml = !/index\.html/.test(dest);
|
249
248
|
if (isntHtml && dest.includes('.')) {
|
@@ -251,6 +250,7 @@ async function generateGraph(args, affectedProjects) {
|
|
251
250
|
}
|
252
251
|
return isntHtml;
|
253
252
|
},
|
253
|
+
recursive: true,
|
254
254
|
});
|
255
255
|
const { projectGraphClientResponse } = await createProjectGraphAndSourceMapClientResponse(affectedProjects);
|
256
256
|
const taskGraphClientResponse = await createTaskGraphClientResponse();
|
@@ -260,15 +260,15 @@ async function generateGraph(args, affectedProjects) {
|
|
260
260
|
html = html.replace(/href="styles/g, 'href="static/styles');
|
261
261
|
html = html.replace(/<base href="\/".*>/g, '');
|
262
262
|
html = html.replace(/type="module"/g, '');
|
263
|
-
(0,
|
264
|
-
(0,
|
263
|
+
(0, node_fs_1.writeFileSync)(fullFilePath, html);
|
264
|
+
(0, node_fs_1.writeFileSync)((0, path_1.join)(assetsFolder, 'environment.js'), environmentJs);
|
265
265
|
output_1.output.success({
|
266
266
|
title: `HTML output created in ${fileFolderPath}`,
|
267
267
|
bodyLines: [fileFolderPath, ...assets],
|
268
268
|
});
|
269
269
|
}
|
270
270
|
else if (ext === '.json') {
|
271
|
-
(0,
|
271
|
+
(0, node_fs_1.mkdirSync)((0, path_1.dirname)(fullFilePath), { recursive: true });
|
272
272
|
const json = await createJsonOutput(prunedGraph, rawGraph, args.projects, args.targets);
|
273
273
|
(0, fileutils_1.writeJsonFile)(fullFilePath, json);
|
274
274
|
output_1.output.success({
|
@@ -394,13 +394,13 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
|
|
394
394
|
}
|
395
395
|
let pathname = (0, path_1.join)(__dirname, '../../core/graph/', sanitizePath);
|
396
396
|
// if the file is not found or is a directory, return index.html
|
397
|
-
if (!(0,
|
397
|
+
if (!(0, node_fs_1.existsSync)(pathname) || (0, node_fs_1.statSync)(pathname).isDirectory()) {
|
398
398
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
399
399
|
res.end(html);
|
400
400
|
return;
|
401
401
|
}
|
402
402
|
try {
|
403
|
-
const data = (0,
|
403
|
+
const data = (0, node_fs_1.readFileSync)(pathname);
|
404
404
|
const ext = (0, path_1.parse)(pathname).ext;
|
405
405
|
res.setHeader('Content-type', mimeType[ext] || 'text/plain');
|
406
406
|
res.end(data);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.addNxToNest = addNxToNest;
|
4
4
|
const enquirer = require("enquirer");
|
5
|
-
const
|
5
|
+
const node_fs_1 = require("node:fs");
|
6
6
|
const path_1 = require("path");
|
7
7
|
const fileutils_1 = require("../../../utils/fileutils");
|
8
8
|
const output_1 = require("../../../utils/output");
|
@@ -214,7 +214,7 @@ function getJestOptions(isE2E, repoRoot, packageName, existingOptions) {
|
|
214
214
|
function tryCreateJestPreset(repoRoot) {
|
215
215
|
const jestPresetPath = (0, path_1.join)(repoRoot, 'jest.preset.js');
|
216
216
|
if (!(0, fileutils_1.fileExists)(jestPresetPath)) {
|
217
|
-
(0,
|
217
|
+
(0, node_fs_1.writeFileSync)(jestPresetPath, `
|
218
218
|
const nxPreset = require('@nx/jest/preset').default;
|
219
219
|
module.exports = {...nxPreset};
|
220
220
|
`, 'utf8');
|
@@ -231,8 +231,8 @@ function addJestTargets(repoRoot, packageName, projectJson, packageJson) {
|
|
231
231
|
if (isPresetCreated) {
|
232
232
|
unitTestOptions['preset'] = e2eTestOptions['preset'] = './jest.preset.js';
|
233
233
|
}
|
234
|
-
(0,
|
235
|
-
(0,
|
234
|
+
(0, node_fs_1.writeFileSync)(unitTestConfigPath, `export default ${JSON.stringify(unitTestOptions, null, 2)}`, 'utf8');
|
235
|
+
(0, node_fs_1.writeFileSync)(e2eTestConfigPath, `export default ${JSON.stringify(e2eTestOptions, null, 2)}`, 'utf8');
|
236
236
|
projectJson.targets['test'] = {
|
237
237
|
executor: '@nx/jest:jest',
|
238
238
|
outputs: [`{workspaceRoot}/coverage/${packageName}`],
|
@@ -312,7 +312,7 @@ function updateTsConfig(repoRoot, sourceRoot) {
|
|
312
312
|
}
|
313
313
|
function removeFile(repoRoot, file) {
|
314
314
|
const path = (0, path_1.join)(repoRoot, file);
|
315
|
-
(0,
|
315
|
+
(0, node_fs_1.unlinkSync)(path);
|
316
316
|
}
|
317
317
|
function mergeWithDefaultConfig(config) {
|
318
318
|
const defaultNestCliConfigurations = {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.cleanUpFiles = cleanUpFiles;
|
4
|
-
const
|
4
|
+
const node_fs_1 = require("node:fs");
|
5
5
|
const fileutils_1 = require("../../../../utils/fileutils");
|
6
6
|
function cleanUpFiles(appName, isStandalone) {
|
7
7
|
// Delete targets from project since we delegate to npm scripts.
|
@@ -19,12 +19,12 @@ function cleanUpFiles(appName, isStandalone) {
|
|
19
19
|
}
|
20
20
|
}
|
21
21
|
(0, fileutils_1.writeJsonFile)(projectJsonPath, json);
|
22
|
-
(0,
|
22
|
+
(0, node_fs_1.rmSync)('temp-workspace', { recursive: true, force: true });
|
23
23
|
if (isStandalone) {
|
24
|
-
(0,
|
25
|
-
(0,
|
26
|
-
(0,
|
27
|
-
(0,
|
28
|
-
(0,
|
24
|
+
(0, node_fs_1.rmSync)('babel.config.json', { recursive: true, force: true });
|
25
|
+
(0, node_fs_1.rmSync)('jest.preset.js', { recursive: true, force: true });
|
26
|
+
(0, node_fs_1.rmSync)('jest.config.ts', { recursive: true, force: true });
|
27
|
+
(0, node_fs_1.rmSync)('libs', { recursive: true, force: true });
|
28
|
+
(0, node_fs_1.rmSync)('tools', { recursive: true, force: true });
|
29
29
|
}
|
30
30
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.addNxToCraRepo = addNxToCraRepo;
|
4
4
|
const child_process_1 = require("child_process");
|
5
|
-
const
|
5
|
+
const node_fs_1 = require("node:fs");
|
6
6
|
const path_1 = require("path");
|
7
7
|
const fileutils_1 = require("../../../../utils/fileutils");
|
8
8
|
const output_1 = require("../../../../utils/output");
|
@@ -116,13 +116,16 @@ async function reorgnizeWorkspaceStructure(options) {
|
|
116
116
|
}
|
117
117
|
}
|
118
118
|
function createTempWorkspace(options) {
|
119
|
-
(0,
|
119
|
+
(0, node_fs_1.rmSync)('temp-workspace', { recursive: true, force: true });
|
120
120
|
(0, child_process_1.execSync)(`npx ${options.npxYesFlagNeeded ? '-y' : ''} create-nx-workspace@latest temp-workspace --appName=${options.reactAppName} --preset=react-monorepo --style=css --bundler=${options.isVite ? 'vite' : 'webpack'} --packageManager=${options.packageManager} ${options.nxCloud ? '--nxCloud=yes' : '--nxCloud=skip'} ${options.addE2e ? '--e2eTestRunner=playwright' : '--e2eTestRunner=none'}`, { stdio: [0, 1, 2], windowsHide: true });
|
121
121
|
output_1.output.log({ title: '👋 Welcome to Nx!' });
|
122
122
|
output_1.output.log({ title: '🧹 Clearing unused files' });
|
123
|
-
(0,
|
124
|
-
(0,
|
125
|
-
|
123
|
+
(0, node_fs_1.cpSync)((0, path_1.join)('temp-workspace', 'apps', options.reactAppName, 'project.json'), 'project.json', { recursive: true });
|
124
|
+
(0, node_fs_1.rmSync)((0, path_1.join)('temp-workspace', 'apps', options.reactAppName), {
|
125
|
+
recursive: true,
|
126
|
+
force: true,
|
127
|
+
});
|
128
|
+
(0, node_fs_1.rmSync)('node_modules', { recursive: true, force: true });
|
126
129
|
}
|
127
130
|
function copyPackageJsonDepsFromTempWorkspace() {
|
128
131
|
const repoRoot = process.cwd();
|
@@ -151,6 +154,12 @@ function overridePackageDeps(depConfigName, base, override) {
|
|
151
154
|
});
|
152
155
|
return base;
|
153
156
|
}
|
157
|
+
function moveSync(src, dest) {
|
158
|
+
const destParentDir = (0, path_1.dirname)(dest);
|
159
|
+
(0, node_fs_1.mkdirSync)(destParentDir, { recursive: true });
|
160
|
+
(0, node_fs_1.rmSync)(dest, { recursive: true, force: true });
|
161
|
+
return (0, node_fs_1.renameSync)(src, dest);
|
162
|
+
}
|
154
163
|
function moveFilesToTempWorkspace(options) {
|
155
164
|
output_1.output.log({ title: '🚚 Moving your React app in your new Nx workspace' });
|
156
165
|
copyPackageJsonDepsFromTempWorkspace();
|
@@ -169,11 +178,9 @@ function moveFilesToTempWorkspace(options) {
|
|
169
178
|
const filesToMove = [...requiredCraFiles, ...optionalCraFiles].filter(Boolean);
|
170
179
|
filesToMove.forEach((f) => {
|
171
180
|
try {
|
172
|
-
|
181
|
+
moveSync(f, options.isStandalone
|
173
182
|
? (0, path_1.join)('temp-workspace', f)
|
174
|
-
: (0, path_1.join)('temp-workspace', 'apps', options.reactAppName, f)
|
175
|
-
overwrite: true,
|
176
|
-
});
|
183
|
+
: (0, path_1.join)('temp-workspace', 'apps', options.reactAppName, f));
|
177
184
|
}
|
178
185
|
catch (error) {
|
179
186
|
if (requiredCraFiles.includes(f)) {
|
@@ -208,8 +215,8 @@ async function addBundler(options) {
|
|
208
215
|
}
|
209
216
|
function copyFromTempWorkspaceToRoot() {
|
210
217
|
output_1.output.log({ title: '🚚 Folder restructuring.' });
|
211
|
-
(0,
|
212
|
-
|
218
|
+
(0, node_fs_1.readdirSync)('temp-workspace').forEach((f) => {
|
219
|
+
moveSync((0, path_1.join)('temp-workspace', f), f);
|
213
220
|
});
|
214
221
|
}
|
215
222
|
function cleanUpUnusedFilesAndAddConfigFiles(options) {
|
@@ -218,6 +225,6 @@ function cleanUpUnusedFilesAndAddConfigFiles(options) {
|
|
218
225
|
output_1.output.log({ title: "📃 Extend the app's tsconfig.json from the base" });
|
219
226
|
(0, tsconfig_setup_1.setupTsConfig)(options.reactAppName, options.isStandalone);
|
220
227
|
if (options.isStandalone) {
|
221
|
-
(0,
|
228
|
+
(0, node_fs_1.rmSync)('apps', { recursive: true, force: true });
|
222
229
|
}
|
223
230
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.renameJsToJsx = renameJsToJsx;
|
4
|
-
const
|
4
|
+
const node_fs_1 = require("node:fs");
|
5
5
|
const workspace_context_1 = require("../../../../utils/workspace-context");
|
6
6
|
const fileutils_1 = require("../../../../utils/fileutils");
|
7
7
|
// Vite cannot process JSX like <div> or <Header> unless the file is named .jsx or .tsx
|
@@ -11,11 +11,11 @@ async function renameJsToJsx(appName, isStandalone) {
|
|
11
11
|
]);
|
12
12
|
files.forEach((file) => {
|
13
13
|
if ((0, fileutils_1.fileExists)(file)) {
|
14
|
-
const content = (0,
|
14
|
+
const content = (0, node_fs_1.readFileSync)(file).toString();
|
15
15
|
// Try to detect JSX before renaming to .jsx
|
16
16
|
// Files like setupTests.js from CRA should not be renamed
|
17
17
|
if (/<[a-zA-Z0-9]+/.test(content)) {
|
18
|
-
(0,
|
18
|
+
(0, node_fs_1.renameSync)(file, `${file}x`);
|
19
19
|
}
|
20
20
|
}
|
21
21
|
});
|
@@ -5,7 +5,6 @@ exports.createAPI = createAPI;
|
|
5
5
|
exports.shouldCreateGitHubRelease = shouldCreateGitHubRelease;
|
6
6
|
const chalk = require("chalk");
|
7
7
|
const enquirer_1 = require("enquirer");
|
8
|
-
const fs_extra_1 = require("fs-extra");
|
9
8
|
const node_fs_1 = require("node:fs");
|
10
9
|
const semver_1 = require("semver");
|
11
10
|
const tmp_1 = require("tmp");
|
@@ -620,7 +619,7 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
|
|
620
619
|
if (group.resolvedVersionPlans) {
|
621
620
|
group.resolvedVersionPlans.forEach((plan) => {
|
622
621
|
if (!args.dryRun) {
|
623
|
-
(0,
|
622
|
+
(0, node_fs_1.rmSync)(plan.absolutePath, { recursive: true, force: true });
|
624
623
|
if (args.verbose) {
|
625
624
|
console.log(`Removing ${plan.relativePath}`);
|
626
625
|
}
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readRawVersionPlans = readRawVersionPlans;
|
4
4
|
exports.setResolvedVersionPlansOnGroups = setResolvedVersionPlansOnGroups;
|
5
5
|
exports.getVersionPlansAbsolutePath = getVersionPlansAbsolutePath;
|
6
|
-
const fs_1 = require("fs");
|
7
|
-
const fs_extra_1 = require("fs-extra");
|
8
6
|
const node_child_process_1 = require("node:child_process");
|
7
|
+
const node_fs_1 = require("node:fs");
|
8
|
+
const promises_1 = require("node:fs/promises");
|
9
9
|
const path_1 = require("path");
|
10
10
|
const semver_1 = require("semver");
|
11
11
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
@@ -14,16 +14,15 @@ const fm = require('front-matter');
|
|
14
14
|
const versionPlansDirectory = (0, path_1.join)('.nx', 'version-plans');
|
15
15
|
async function readRawVersionPlans() {
|
16
16
|
const versionPlansPath = getVersionPlansAbsolutePath();
|
17
|
-
|
18
|
-
if (!versionPlansPathExists) {
|
17
|
+
if (!(0, node_fs_1.existsSync)(versionPlansPath)) {
|
19
18
|
return [];
|
20
19
|
}
|
21
20
|
const versionPlans = [];
|
22
|
-
const versionPlanFiles = (0,
|
21
|
+
const versionPlanFiles = (0, node_fs_1.readdirSync)(versionPlansPath);
|
23
22
|
for (const versionPlanFile of versionPlanFiles) {
|
24
23
|
const filePath = (0, path_1.join)(versionPlansPath, versionPlanFile);
|
25
|
-
const versionPlanContent = (0,
|
26
|
-
const versionPlanStats = await (0,
|
24
|
+
const versionPlanContent = (0, node_fs_1.readFileSync)(filePath).toString();
|
25
|
+
const versionPlanStats = await (0, promises_1.stat)(filePath);
|
27
26
|
const parsedContent = fm(versionPlanContent);
|
28
27
|
versionPlans.push({
|
29
28
|
absolutePath: filePath,
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.releasePlanCLIHandler = void 0;
|
4
4
|
exports.createAPI = createAPI;
|
5
5
|
const enquirer_1 = require("enquirer");
|
6
|
-
const
|
6
|
+
const node_fs_1 = require("node:fs");
|
7
|
+
const promises_1 = require("node:fs/promises");
|
7
8
|
const node_path_1 = require("node:path");
|
8
9
|
const semver_1 = require("semver");
|
9
10
|
const tmp_1 = require("tmp");
|
@@ -193,8 +194,8 @@ async function createVersionPlanFileForBumps(args, versionPlanBumps) {
|
|
193
194
|
output_1.output.logSingleLine(`Creating version plan file "${versionPlanFileName}"`);
|
194
195
|
(0, print_changes_1.printDiff)('', versionPlanFileContent, 1);
|
195
196
|
const versionPlansAbsolutePath = (0, version_plans_1.getVersionPlansAbsolutePath)();
|
196
|
-
await (0,
|
197
|
-
await (0,
|
197
|
+
await (0, promises_1.mkdir)(versionPlansAbsolutePath, { recursive: true });
|
198
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(versionPlansAbsolutePath, versionPlanFileName), versionPlanFileContent);
|
198
199
|
}
|
199
200
|
}
|
200
201
|
async function promptForVersion(message) {
|
@@ -236,9 +237,9 @@ async function _promptForMessage(versionPlanName) {
|
|
236
237
|
if (!message.length) {
|
237
238
|
const tmpDir = (0, tmp_1.dirSync)().name;
|
238
239
|
const messageFilePath = (0, node_path_1.join)(tmpDir, `DRAFT_MESSAGE__${versionPlanName}.md`);
|
239
|
-
(0,
|
240
|
+
(0, node_fs_1.writeFileSync)(messageFilePath, '');
|
240
241
|
await (0, launch_editor_1.launchEditor)(messageFilePath);
|
241
|
-
message = (0,
|
242
|
+
message = (0, node_fs_1.readFileSync)(messageFilePath, 'utf-8');
|
242
243
|
}
|
243
244
|
message = message.trim();
|
244
245
|
if (!message) {
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.releaseCLIHandler = void 0;
|
4
4
|
exports.createAPI = createAPI;
|
5
5
|
const enquirer_1 = require("enquirer");
|
6
|
-
const
|
6
|
+
const node_fs_1 = require("node:fs");
|
7
7
|
const nx_json_1 = require("../../config/nx-json");
|
8
8
|
const file_map_utils_1 = require("../../project-graph/file-map-utils");
|
9
9
|
const project_graph_1 = require("../../project-graph/project-graph");
|
@@ -106,7 +106,7 @@ function createAPI(overrideReleaseConfig) {
|
|
106
106
|
}
|
107
107
|
group.resolvedVersionPlans.forEach((plan) => {
|
108
108
|
if (!args.dryRun) {
|
109
|
-
(0,
|
109
|
+
(0, node_fs_1.rmSync)(plan.absolutePath, { recursive: true, force: true });
|
110
110
|
if (args.verbose) {
|
111
111
|
console.log(`Removing ${plan.relativePath}`);
|
112
112
|
}
|
@@ -210,7 +210,7 @@ function createAPI(overrideReleaseConfig) {
|
|
210
210
|
runPreVersionCommand(releaseGroup.version.groupPreVersionCommand, {
|
211
211
|
dryRun: args.dryRun,
|
212
212
|
verbose: args.verbose,
|
213
|
-
});
|
213
|
+
}, releaseGroup);
|
214
214
|
const projectBatches = (0, batch_projects_by_generator_config_1.batchProjectsByGeneratorConfig)(projectGraph, releaseGroup,
|
215
215
|
// Batch based on all projects within the release group
|
216
216
|
releaseGroup.projects);
|
@@ -412,11 +412,13 @@ function resolveGeneratorData({ collectionName, generatorName, configGeneratorOp
|
|
412
412
|
throw err;
|
413
413
|
}
|
414
414
|
}
|
415
|
-
function runPreVersionCommand(preVersionCommand, { dryRun, verbose }) {
|
415
|
+
function runPreVersionCommand(preVersionCommand, { dryRun, verbose }, releaseGroup) {
|
416
416
|
if (!preVersionCommand) {
|
417
417
|
return;
|
418
418
|
}
|
419
|
-
output_1.output.logSingleLine(
|
419
|
+
output_1.output.logSingleLine(releaseGroup
|
420
|
+
? `Executing release group pre-version command for "${releaseGroup.name}"`
|
421
|
+
: `Executing pre-version command`);
|
420
422
|
if (verbose) {
|
421
423
|
console.log(`Executing the following pre-version command:`);
|
422
424
|
console.log(preVersionCommand);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.resetHandler = resetHandler;
|
4
|
-
const
|
4
|
+
const node_fs_1 = require("node:fs");
|
5
5
|
const client_1 = require("../../daemon/client/client");
|
6
6
|
const cache_directory_1 = require("../../utils/cache-directory");
|
7
7
|
const output_1 = require("../../utils/output");
|
@@ -92,17 +92,17 @@ async function resetCloudClient() {
|
|
92
92
|
}
|
93
93
|
function cleanupCacheEntries() {
|
94
94
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
95
|
-
(0,
|
95
|
+
(0, node_fs_1.rmSync)(cache_directory_1.cacheDir, { recursive: true, force: true });
|
96
96
|
});
|
97
97
|
}
|
98
98
|
function cleanupNativeFileCache() {
|
99
99
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
100
|
-
(0,
|
100
|
+
(0, node_fs_1.rmSync)((0, native_file_cache_location_1.getNativeFileCacheLocation)(), { recursive: true, force: true });
|
101
101
|
});
|
102
102
|
}
|
103
103
|
function cleanupWorkspaceData() {
|
104
104
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
105
|
-
(0,
|
105
|
+
(0, node_fs_1.rmSync)(cache_directory_1.workspaceDataDirectory, { recursive: true, force: true });
|
106
106
|
});
|
107
107
|
}
|
108
108
|
async function incrementalBackoff(ms, maxDuration, callback) {
|