@nx/js 21.0.0-beta.8 → 21.0.0-beta.9
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/migrations.json +1 -73
- package/package.json +3 -3
- package/src/generators/release-version/release-version.js +2 -1
- package/src/release/version-actions.d.ts +3 -3
- package/src/release/version-actions.js +58 -45
- package/src/utils/add-local-registry-scripts.js +1 -1
- package/src/migrations/update-17-0-0/remove-deprecated-build-options.d.ts +0 -6
- package/src/migrations/update-17-0-0/remove-deprecated-build-options.js +0 -30
package/migrations.json
CHANGED
|
@@ -1,78 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generators": {
|
|
3
|
-
"update-17-0-0-remove-deprecated-build-options": {
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"version": "17.0.2",
|
|
6
|
-
"description": "Remove deprecated build options",
|
|
7
|
-
"implementation": "./src/migrations/update-17-0-0/remove-deprecated-build-options"
|
|
8
|
-
}
|
|
9
|
-
},
|
|
2
|
+
"generators": {},
|
|
10
3
|
"packageJsonUpdates": {
|
|
11
|
-
"17.0.0": {
|
|
12
|
-
"version": "17.0.0-rc.2",
|
|
13
|
-
"packages": {
|
|
14
|
-
"esbuild": {
|
|
15
|
-
"version": "^0.19.2",
|
|
16
|
-
"alwaysAddToPackageJson": false
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"17.1.0": {
|
|
21
|
-
"version": "17.1.0-beta.4",
|
|
22
|
-
"x-prompt": "Do you want to update to TypeScript v5.2?",
|
|
23
|
-
"requires": {
|
|
24
|
-
"typescript": ">=5.1.0 <5.2.0"
|
|
25
|
-
},
|
|
26
|
-
"packages": {
|
|
27
|
-
"typescript": {
|
|
28
|
-
"version": "~5.2.2"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"17.3.0": {
|
|
33
|
-
"version": "17.3.0-beta.3",
|
|
34
|
-
"packages": {
|
|
35
|
-
"@types/node": {
|
|
36
|
-
"version": "^18.16.9",
|
|
37
|
-
"alwaysAddToPackageJson": false
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"17.3.0-beta.10": {
|
|
42
|
-
"version": "17.3.0-beta.10",
|
|
43
|
-
"x-prompt": "Do you want to update to TypeScript v5.3?",
|
|
44
|
-
"requires": {
|
|
45
|
-
"typescript": ">=5.2.0 <5.3.0"
|
|
46
|
-
},
|
|
47
|
-
"packages": {
|
|
48
|
-
"typescript": {
|
|
49
|
-
"version": "~5.3.2",
|
|
50
|
-
"alwaysAddToPackageJson": false
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"18.0.4": {
|
|
55
|
-
"version": "18.0.4-beta.0",
|
|
56
|
-
"packages": {
|
|
57
|
-
"@swc-node/register": {
|
|
58
|
-
"version": "~1.8.0",
|
|
59
|
-
"alwaysAddToPackageJson": false
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"18.2.0": {
|
|
64
|
-
"version": "18.2.0-beta.0",
|
|
65
|
-
"x-prompt": "Do you want to update to TypeScript v5.4?",
|
|
66
|
-
"requires": {
|
|
67
|
-
"typescript": ">=5.3.0 <5.4.0"
|
|
68
|
-
},
|
|
69
|
-
"packages": {
|
|
70
|
-
"typescript": {
|
|
71
|
-
"version": "~5.4.2",
|
|
72
|
-
"alwaysAddToPackageJson": false
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
4
|
"19.0.0": {
|
|
77
5
|
"version": "19.0.0-beta.0",
|
|
78
6
|
"packages": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "21.0.0-beta.
|
|
3
|
+
"version": "21.0.0-beta.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.23.2",
|
|
40
40
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
41
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nx/devkit": "21.0.0-beta.
|
|
43
|
-
"@nx/workspace": "21.0.0-beta.
|
|
42
|
+
"@nx/devkit": "21.0.0-beta.9",
|
|
43
|
+
"@nx/workspace": "21.0.0-beta.9",
|
|
44
44
|
"@zkochan/js-yaml": "0.0.7",
|
|
45
45
|
"babel-plugin-const-enum": "^1.0.1",
|
|
46
46
|
"babel-plugin-macros": "^3.1.0",
|
|
@@ -656,7 +656,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
656
656
|
// Return the version data so that it can be leveraged by the overall version command
|
|
657
657
|
return {
|
|
658
658
|
data: versionData,
|
|
659
|
-
callback: async (tree, opts) => {
|
|
659
|
+
callback: async (tree, { generatorOptions, ...opts }) => {
|
|
660
660
|
const changedFiles = [];
|
|
661
661
|
const deletedFiles = [];
|
|
662
662
|
for (const cb of deleteVersionPlanCallbacks) {
|
|
@@ -666,6 +666,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
666
666
|
changedFiles.push(...(await (0, update_lock_file_1.updateLockFile)(cwd, {
|
|
667
667
|
...opts,
|
|
668
668
|
useLegacyVersioning: true,
|
|
669
|
+
options: generatorOptions,
|
|
669
670
|
})));
|
|
670
671
|
return { changedFiles, deletedFiles };
|
|
671
672
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProjectGraph, Tree } from '@nx/devkit';
|
|
2
2
|
import { AfterAllProjectsVersioned, VersionActions } from 'nx/release';
|
|
3
|
-
import type {
|
|
3
|
+
import type { NxReleaseVersionConfiguration } from 'nx/src/config/nx-json';
|
|
4
4
|
export declare const afterAllProjectsVersioned: AfterAllProjectsVersioned;
|
|
5
5
|
export default class JsVersionActions extends VersionActions {
|
|
6
6
|
validManifestFilenames: string[];
|
|
@@ -8,7 +8,7 @@ export default class JsVersionActions extends VersionActions {
|
|
|
8
8
|
currentVersion: string;
|
|
9
9
|
manifestPath: string;
|
|
10
10
|
}>;
|
|
11
|
-
readCurrentVersionFromRegistry(tree: Tree, currentVersionResolverMetadata:
|
|
11
|
+
readCurrentVersionFromRegistry(tree: Tree, currentVersionResolverMetadata: NxReleaseVersionConfiguration['currentVersionResolverMetadata']): Promise<{
|
|
12
12
|
currentVersion: string;
|
|
13
13
|
logText: string;
|
|
14
14
|
}>;
|
|
@@ -16,7 +16,7 @@ export default class JsVersionActions extends VersionActions {
|
|
|
16
16
|
currentVersion: string | null;
|
|
17
17
|
dependencyCollection: string | null;
|
|
18
18
|
}>;
|
|
19
|
-
isLocalDependencyProtocol(versionSpecifier: string): Promise<boolean>;
|
|
20
19
|
updateProjectVersion(tree: Tree, newVersion: string): Promise<string[]>;
|
|
21
20
|
updateProjectDependencies(tree: Tree, projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string>): Promise<string[]>;
|
|
21
|
+
private isLocalDependencyProtocol;
|
|
22
22
|
}
|
|
@@ -8,11 +8,12 @@ const release_1 = require("nx/release");
|
|
|
8
8
|
const npm_config_1 = require("../utils/npm-config");
|
|
9
9
|
const update_lock_file_1 = require("./utils/update-lock-file");
|
|
10
10
|
const chalk = require("chalk");
|
|
11
|
-
const afterAllProjectsVersioned = async (cwd, opts) => {
|
|
11
|
+
const afterAllProjectsVersioned = async (cwd, { rootVersionActionsOptions, ...opts }) => {
|
|
12
12
|
return {
|
|
13
13
|
changedFiles: await (0, update_lock_file_1.updateLockFile)(cwd, {
|
|
14
14
|
...opts,
|
|
15
15
|
useLegacyVersioning: false,
|
|
16
|
+
options: rootVersionActionsOptions,
|
|
16
17
|
}),
|
|
17
18
|
deletedFiles: [],
|
|
18
19
|
};
|
|
@@ -104,61 +105,25 @@ class JsVersionActions extends release_1.VersionActions {
|
|
|
104
105
|
dependencyCollection,
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
|
-
// NOTE: The TODOs were carried over from the original implementation, they are not yet implemented
|
|
108
|
-
async isLocalDependencyProtocol(versionSpecifier) {
|
|
109
|
-
const localPackageProtocols = [
|
|
110
|
-
'file:', // all package managers
|
|
111
|
-
'workspace:', // not npm
|
|
112
|
-
// TODO: Support portal protocol at the project graph level before enabling here
|
|
113
|
-
// 'portal:', // modern yarn only
|
|
114
|
-
];
|
|
115
|
-
// Not using a supported local protocol
|
|
116
|
-
if (!localPackageProtocols.some((protocol) => versionSpecifier.startsWith(protocol))) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
// Supported by all package managers
|
|
120
|
-
if (versionSpecifier.startsWith('file:')) {
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
// Determine specific package manager in use
|
|
124
|
-
if (!pm) {
|
|
125
|
-
pm = (0, devkit_1.detectPackageManager)();
|
|
126
|
-
// pmVersion = getPackageManagerVersion(pm);
|
|
127
|
-
}
|
|
128
|
-
if (pm === 'npm' && versionSpecifier.startsWith('workspace:')) {
|
|
129
|
-
throw new Error(`The "workspace:" protocol is not yet supported by npm (https://github.com/npm/rfcs/issues/765). Please ensure you have a valid setup according to your package manager before attempting to release packages.`);
|
|
130
|
-
}
|
|
131
|
-
// TODO: Support portal protocol at the project graph level before enabling here
|
|
132
|
-
// if (
|
|
133
|
-
// version.startsWith('portal:') &&
|
|
134
|
-
// (pm !== 'yarn' || lt(pmVersion, '2.0.0'))
|
|
135
|
-
// ) {
|
|
136
|
-
// throw new Error(
|
|
137
|
-
// `The "portal:" protocol is only supported by yarn@2.0.0 and above. Please ensure you have a valid setup according to your package manager before attempting to release packages.`
|
|
138
|
-
// );
|
|
139
|
-
// }
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
108
|
async updateProjectVersion(tree, newVersion) {
|
|
143
109
|
const logMessages = [];
|
|
144
|
-
for (const
|
|
145
|
-
(0, devkit_1.updateJson)(tree, manifestPath, (json) => {
|
|
110
|
+
for (const manifestToUpdate of this.manifestsToUpdate) {
|
|
111
|
+
(0, devkit_1.updateJson)(tree, manifestToUpdate.manifestPath, (json) => {
|
|
146
112
|
json.version = newVersion;
|
|
147
113
|
return json;
|
|
148
114
|
});
|
|
149
|
-
logMessages.push(`✍️ New version ${newVersion} written to manifest: ${manifestPath}`);
|
|
115
|
+
logMessages.push(`✍️ New version ${newVersion} written to manifest: ${manifestToUpdate.manifestPath}`);
|
|
150
116
|
}
|
|
151
117
|
return logMessages;
|
|
152
118
|
}
|
|
153
119
|
async updateProjectDependencies(tree, projectGraph, dependenciesToUpdate) {
|
|
154
|
-
|
|
155
|
-
const depText = numDependenciesToUpdate === 1 ? 'dependency' : 'dependencies';
|
|
120
|
+
let numDependenciesToUpdate = Object.keys(dependenciesToUpdate).length;
|
|
156
121
|
if (numDependenciesToUpdate === 0) {
|
|
157
122
|
return [];
|
|
158
123
|
}
|
|
159
124
|
const logMessages = [];
|
|
160
|
-
for (const
|
|
161
|
-
(0, devkit_1.updateJson)(tree, manifestPath, (json) => {
|
|
125
|
+
for (const manifestToUpdate of this.manifestsToUpdate) {
|
|
126
|
+
(0, devkit_1.updateJson)(tree, manifestToUpdate.manifestPath, (json) => {
|
|
162
127
|
const dependencyTypes = [
|
|
163
128
|
'dependencies',
|
|
164
129
|
'devDependencies',
|
|
@@ -173,7 +138,15 @@ class JsVersionActions extends release_1.VersionActions {
|
|
|
173
138
|
if (!packageName) {
|
|
174
139
|
throw new Error(`Unable to determine the package name for project "${dep}" from the project graph metadata, please ensure that the "@nx/js" plugin is installed and the project graph has been built. If the issue persists, please report this issue on https://github.com/nrwl/nx/issues`);
|
|
175
140
|
}
|
|
176
|
-
|
|
141
|
+
const currentVersion = json[depType][packageName];
|
|
142
|
+
if (currentVersion) {
|
|
143
|
+
// Check if the local dependency protocol should be preserved or not
|
|
144
|
+
if (manifestToUpdate.preserveLocalDependencyProtocols &&
|
|
145
|
+
this.isLocalDependencyProtocol(currentVersion)) {
|
|
146
|
+
// Reduce the count appropriately to avoid confusing user-facing logs
|
|
147
|
+
numDependenciesToUpdate--;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
177
150
|
json[depType][packageName] = version;
|
|
178
151
|
}
|
|
179
152
|
}
|
|
@@ -181,9 +154,49 @@ class JsVersionActions extends release_1.VersionActions {
|
|
|
181
154
|
}
|
|
182
155
|
return json;
|
|
183
156
|
});
|
|
184
|
-
|
|
157
|
+
// If we ignored local dependecy protocols, then we could have dynamically ended up with zero here and we should not log anything related to dependencies
|
|
158
|
+
if (numDependenciesToUpdate === 0) {
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
const depText = numDependenciesToUpdate === 1 ? 'dependency' : 'dependencies';
|
|
162
|
+
logMessages.push(`✍️ Updated ${numDependenciesToUpdate} ${depText} in manifest: ${manifestToUpdate.manifestPath}`);
|
|
185
163
|
}
|
|
186
164
|
return logMessages;
|
|
187
165
|
}
|
|
166
|
+
// NOTE: The TODOs were carried over from the original implementation, they are not yet implemented
|
|
167
|
+
isLocalDependencyProtocol(versionSpecifier) {
|
|
168
|
+
const localPackageProtocols = [
|
|
169
|
+
'file:', // all package managers
|
|
170
|
+
'workspace:', // not npm
|
|
171
|
+
// TODO: Support portal protocol at the project graph level before enabling here
|
|
172
|
+
// 'portal:', // modern yarn only
|
|
173
|
+
];
|
|
174
|
+
// Not using a supported local protocol
|
|
175
|
+
if (!localPackageProtocols.some((protocol) => versionSpecifier.startsWith(protocol))) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
// Supported by all package managers
|
|
179
|
+
if (versionSpecifier.startsWith('file:')) {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
// Determine specific package manager in use
|
|
183
|
+
if (!pm) {
|
|
184
|
+
pm = (0, devkit_1.detectPackageManager)();
|
|
185
|
+
// pmVersion = getPackageManagerVersion(pm);
|
|
186
|
+
}
|
|
187
|
+
if (pm === 'npm' && versionSpecifier.startsWith('workspace:')) {
|
|
188
|
+
throw new Error(`The "workspace:" protocol is not yet supported by npm (https://github.com/npm/rfcs/issues/765). Please ensure you have a valid setup according to your package manager before attempting to release packages.`);
|
|
189
|
+
}
|
|
190
|
+
// TODO: Support portal protocol at the project graph level before enabling here
|
|
191
|
+
// if (
|
|
192
|
+
// version.startsWith('portal:') &&
|
|
193
|
+
// (pm !== 'yarn' || lt(pmVersion, '2.0.0'))
|
|
194
|
+
// ) {
|
|
195
|
+
// throw new Error(
|
|
196
|
+
// `The "portal:" protocol is only supported by yarn@2.0.0 and above. Please ensure you have a valid setup according to your package manager before attempting to release packages.`
|
|
197
|
+
// );
|
|
198
|
+
// }
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
188
201
|
}
|
|
189
202
|
exports.default = JsVersionActions;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
/**
|
|
6
|
-
* Removes deprecated
|
|
7
|
-
* @param tree
|
|
8
|
-
*/
|
|
9
|
-
async function default_1(tree) {
|
|
10
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
11
|
-
for (const [projectName, projectConfig] of projects) {
|
|
12
|
-
let shouldUpdate = false;
|
|
13
|
-
if (!projectConfig.targets)
|
|
14
|
-
continue;
|
|
15
|
-
for (const target of Object.values(projectConfig.targets)) {
|
|
16
|
-
if (target.executor?.startsWith('@nx/') &&
|
|
17
|
-
target.options &&
|
|
18
|
-
('buildableProjectDepsInPackageJsonType' in target.options ||
|
|
19
|
-
'updateBuildableProjectDepsInPackageJson' in target.options)) {
|
|
20
|
-
delete target.options['buildableProjectDepsInPackageJsonType'];
|
|
21
|
-
delete target.options['updateBuildableProjectDepsInPackageJson'];
|
|
22
|
-
shouldUpdate = true;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (shouldUpdate) {
|
|
26
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
30
|
-
}
|