@nx/js 17.2.0-beta.8 → 17.2.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "17.2.0-beta.
|
|
3
|
+
"version": "17.2.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": {
|
|
@@ -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.2.0-beta.
|
|
61
|
-
"@nx/workspace": "17.2.0-beta.
|
|
62
|
-
"@nrwl/js": "17.2.0-beta.
|
|
60
|
+
"@nx/devkit": "17.2.0-beta.9",
|
|
61
|
+
"@nx/workspace": "17.2.0-beta.9",
|
|
62
|
+
"@nrwl/js": "17.2.0-beta.9"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|
|
@@ -52,74 +52,84 @@ async function runExecutor(options, context) {
|
|
|
52
52
|
// Resolve values using the `npm config` command so that things like environment variables and `publishConfig`s are accounted for
|
|
53
53
|
const registry = options.registry ?? (0, child_process_1.execSync)(`npm config get registry`).toString().trim();
|
|
54
54
|
const tag = options.tag ?? (0, child_process_1.execSync)(`npm config get tag`).toString().trim();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
cwd: packageRoot,
|
|
76
|
-
stdio: 'ignore',
|
|
77
|
-
});
|
|
78
|
-
console.log(`Added the dist-tag ${tag} to v${currentVersion} for registry ${registry}.\n`);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
console.log(`Would add the dist-tag ${tag} to v${currentVersion} for registry ${registry}, but ${chalk.keyword('orange')('[dry-run]')} was set.\n`);
|
|
82
|
-
}
|
|
55
|
+
/**
|
|
56
|
+
* In a dry-run scenario, it is most likely that all commands are being run with dry-run, therefore
|
|
57
|
+
* the most up to date/relevant version might not exist on disk for us to read and make the npm view
|
|
58
|
+
* request with.
|
|
59
|
+
*
|
|
60
|
+
* Therefore, so as to not produce misleading output in dry around dist-tags being altered, we do not
|
|
61
|
+
* perform the npm view step, and just show npm publish's dry-run output.
|
|
62
|
+
*/
|
|
63
|
+
if (!options.dryRun) {
|
|
64
|
+
const currentVersion = projectPackageJson.version;
|
|
65
|
+
try {
|
|
66
|
+
const result = (0, child_process_1.execSync)(npmViewCommandSegments.join(' '), {
|
|
67
|
+
env: processEnv(true),
|
|
68
|
+
cwd: packageRoot,
|
|
69
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
70
|
+
});
|
|
71
|
+
const resultJson = JSON.parse(result.toString());
|
|
72
|
+
const distTags = resultJson['dist-tags'] || {};
|
|
73
|
+
if (distTags[tag] === currentVersion) {
|
|
74
|
+
console.warn(`Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`);
|
|
83
75
|
return {
|
|
84
76
|
success: true,
|
|
85
77
|
};
|
|
86
78
|
}
|
|
87
|
-
|
|
79
|
+
if (resultJson.versions.includes(currentVersion)) {
|
|
88
80
|
try {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
console.
|
|
81
|
+
if (!options.dryRun) {
|
|
82
|
+
(0, child_process_1.execSync)(`npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry=${registry}`, {
|
|
83
|
+
env: processEnv(true),
|
|
84
|
+
cwd: packageRoot,
|
|
85
|
+
stdio: 'ignore',
|
|
86
|
+
});
|
|
87
|
+
console.log(`Added the dist-tag ${tag} to v${currentVersion} for registry ${registry}.\n`);
|
|
96
88
|
}
|
|
97
|
-
|
|
98
|
-
console.
|
|
99
|
-
console.error(JSON.stringify(stdoutData, null, 2));
|
|
89
|
+
else {
|
|
90
|
+
console.log(`Would add the dist-tag ${tag} to v${currentVersion} for registry ${registry}, but ${chalk.keyword('orange')('[dry-run]')} was set.\n`);
|
|
100
91
|
}
|
|
101
92
|
return {
|
|
102
|
-
success:
|
|
93
|
+
success: true,
|
|
103
94
|
};
|
|
104
95
|
}
|
|
105
96
|
catch (err) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
97
|
+
try {
|
|
98
|
+
const stdoutData = JSON.parse(err.stdout?.toString() || '{}');
|
|
99
|
+
console.error('npm dist-tag add error:');
|
|
100
|
+
if (stdoutData.error.summary) {
|
|
101
|
+
console.error(stdoutData.error.summary);
|
|
102
|
+
}
|
|
103
|
+
if (stdoutData.error.detail) {
|
|
104
|
+
console.error(stdoutData.error.detail);
|
|
105
|
+
}
|
|
106
|
+
if (context.isVerbose) {
|
|
107
|
+
console.error('npm dist-tag add stdout:');
|
|
108
|
+
console.error(JSON.stringify(stdoutData, null, 2));
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
console.error('Something unexpected went wrong when processing the npm dist-tag add output\n', err);
|
|
116
|
+
return {
|
|
117
|
+
success: false,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
110
120
|
}
|
|
111
121
|
}
|
|
112
122
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
const stdoutData = JSON.parse(err.stdout?.toString() || '{}');
|
|
125
|
+
// If the error is that the package doesn't exist, then we can ignore it because we will be publishing it for the first time in the next step
|
|
126
|
+
if (!(stdoutData.error?.code?.includes('E404') &&
|
|
127
|
+
stdoutData.error?.summary?.includes('no such package available'))) {
|
|
128
|
+
console.error(`Something unexpected went wrong when checking for existing dist-tags.\n`, err);
|
|
129
|
+
return {
|
|
130
|
+
success: false,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
123
133
|
}
|
|
124
134
|
}
|
|
125
135
|
try {
|