@nx/js 17.3.0-beta.3 → 17.3.0-beta.5
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/js",
|
|
3
|
-
"version": "17.3.0-beta.
|
|
3
|
+
"version": "17.3.0-beta.5",
|
|
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": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"semver": "7.5.3",
|
|
58
58
|
"source-map-support": "0.5.19",
|
|
59
59
|
"tslib": "^2.3.0",
|
|
60
|
-
"@nx/devkit": "17.3.0-beta.
|
|
61
|
-
"@nx/workspace": "17.3.0-beta.
|
|
62
|
-
"@nrwl/js": "17.3.0-beta.
|
|
60
|
+
"@nx/devkit": "17.3.0-beta.5",
|
|
61
|
+
"@nx/workspace": "17.3.0-beta.5",
|
|
62
|
+
"@nrwl/js": "17.3.0-beta.5"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|
|
@@ -25,6 +25,10 @@ async function releaseVersionGenerator(tree, options) {
|
|
|
25
25
|
// The node semver library classes a leading `v` as valid, but we want to ensure it is not present in the final version
|
|
26
26
|
options.specifier = options.specifier.replace(/^v/, '');
|
|
27
27
|
}
|
|
28
|
+
if (options.firstRelease) {
|
|
29
|
+
// always use disk as a fallback for the first release
|
|
30
|
+
options.fallbackCurrentVersionResolver = 'disk';
|
|
31
|
+
}
|
|
28
32
|
const projects = options.projects;
|
|
29
33
|
const createResolvePackageRoot = (customPackageRoot) => (projectNode) => {
|
|
30
34
|
// Default to the project root if no custom packageRoot
|
|
@@ -44,6 +48,7 @@ async function releaseVersionGenerator(tree, options) {
|
|
|
44
48
|
projectNameToPackageRootMap.set(project.name, resolvePackageRoot(project));
|
|
45
49
|
}
|
|
46
50
|
let currentVersion;
|
|
51
|
+
let currentVersionResolvedFromFallback = false;
|
|
47
52
|
// only used for options.currentVersionResolver === 'git-tag', but
|
|
48
53
|
// must be declared here in order to reuse it for additional projects
|
|
49
54
|
let latestMatchingGitTag;
|
|
@@ -85,23 +90,41 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
85
90
|
spinner.color =
|
|
86
91
|
color.spinnerColor;
|
|
87
92
|
spinner.start();
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
try {
|
|
94
|
+
// Must be non-blocking async to allow spinner to render
|
|
95
|
+
currentVersion = await new Promise((resolve, reject) => {
|
|
96
|
+
(0, child_process_1.exec)(`npm view ${packageName} version --registry=${registry} --tag=${tag}`, (error, stdout, stderr) => {
|
|
97
|
+
if (error) {
|
|
98
|
+
return reject(error);
|
|
99
|
+
}
|
|
100
|
+
if (stderr) {
|
|
101
|
+
return reject(stderr);
|
|
102
|
+
}
|
|
103
|
+
return resolve(stdout.trim());
|
|
104
|
+
});
|
|
98
105
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
spinner.stop();
|
|
107
|
+
log(`📄 Resolved the current version as ${currentVersion} for tag "${tag}" from registry ${registry}`);
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
spinner.stop();
|
|
111
|
+
if (options.fallbackCurrentVersionResolver === 'disk') {
|
|
112
|
+
log(`📄 Unable to resolve the current version from the registry ${registry}. Falling back to the version on disk of ${currentVersionFromDisk}`);
|
|
113
|
+
currentVersion = currentVersionFromDisk;
|
|
114
|
+
currentVersionResolvedFromFallback = true;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
throw new Error(`Unable to resolve the current version from the registry ${registry}. Please ensure that the package exists in the registry in order to use the "registry" currentVersionResolver. Alternatively, you can set the "version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when the registry lookup fails.`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
102
120
|
}
|
|
103
121
|
else {
|
|
104
|
-
|
|
122
|
+
if (currentVersionResolvedFromFallback) {
|
|
123
|
+
log(`📄 Using the current version ${currentVersion} already resolved from disk fallback.`);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
log(`📄 Using the current version ${currentVersion} already resolved from the registry ${registry}`);
|
|
127
|
+
}
|
|
105
128
|
}
|
|
106
129
|
break;
|
|
107
130
|
}
|
|
@@ -118,13 +141,27 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
118
141
|
projectName: project.name,
|
|
119
142
|
});
|
|
120
143
|
if (!latestMatchingGitTag) {
|
|
121
|
-
|
|
144
|
+
if (options.fallbackCurrentVersionResolver === 'disk') {
|
|
145
|
+
log(`📄 Unable to resolve the current version from git tag using pattern "${releaseTagPattern}". Falling back to the version on disk of ${currentVersionFromDisk}`);
|
|
146
|
+
currentVersion = currentVersionFromDisk;
|
|
147
|
+
currentVersionResolvedFromFallback = true;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
throw new Error(`No git tags matching pattern "${releaseTagPattern}" for project "${project.name}" were found. You will need to create an initial matching tag to use as a base for determining the next version. Alternatively, you can set the "version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when no matching git tags are found.`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
currentVersion = latestMatchingGitTag.extractedVersion;
|
|
155
|
+
log(`📄 Resolved the current version as ${currentVersion} from git tag "${latestMatchingGitTag.tag}".`);
|
|
122
156
|
}
|
|
123
|
-
currentVersion = latestMatchingGitTag.extractedVersion;
|
|
124
|
-
log(`📄 Resolved the current version as ${currentVersion} from git tag "${latestMatchingGitTag.tag}".`);
|
|
125
157
|
}
|
|
126
158
|
else {
|
|
127
|
-
|
|
159
|
+
if (currentVersionResolvedFromFallback) {
|
|
160
|
+
log(`📄 Using the current version ${currentVersion} already resolved from disk fallback.`);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
log(`📄 Using the current version ${currentVersion} already resolved from git tag "${latestMatchingGitTag.tag}".`);
|
|
164
|
+
}
|
|
128
165
|
}
|
|
129
166
|
break;
|
|
130
167
|
}
|