@nx/js 17.2.6 → 17.2.8
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.
|
|
3
|
+
"version": "17.2.8",
|
|
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.
|
|
61
|
-
"@nx/workspace": "17.2.
|
|
62
|
-
"@nrwl/js": "17.2.
|
|
60
|
+
"@nx/devkit": "17.2.8",
|
|
61
|
+
"@nx/workspace": "17.2.8",
|
|
62
|
+
"@nrwl/js": "17.2.8"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|
|
@@ -17,6 +17,11 @@ function processEnv(color) {
|
|
|
17
17
|
return env;
|
|
18
18
|
}
|
|
19
19
|
async function runExecutor(options, context) {
|
|
20
|
+
/**
|
|
21
|
+
* We need to check both the env var and the option because the executor may have been triggered
|
|
22
|
+
* indirectly via dependsOn, in which case the env var will be set, but the option will not.
|
|
23
|
+
*/
|
|
24
|
+
const isDryRun = process.env.NX_DRY_RUN === 'true' || options.dryRun || false;
|
|
20
25
|
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
21
26
|
const packageRoot = (0, devkit_1.joinPathFragments)(context.root, options.packageRoot ?? projectConfig.root);
|
|
22
27
|
const packageJsonPath = (0, devkit_1.joinPathFragments)(packageRoot, 'package.json');
|
|
@@ -46,7 +51,7 @@ async function runExecutor(options, context) {
|
|
|
46
51
|
if (options.otp) {
|
|
47
52
|
npmPublishCommandSegments.push(`--otp=${options.otp}`);
|
|
48
53
|
}
|
|
49
|
-
if (
|
|
54
|
+
if (isDryRun) {
|
|
50
55
|
npmPublishCommandSegments.push(`--dry-run`);
|
|
51
56
|
}
|
|
52
57
|
// Resolve values using the `npm config` command so that things like environment variables and `publishConfig`s are accounted for
|
|
@@ -60,7 +65,7 @@ async function runExecutor(options, context) {
|
|
|
60
65
|
* Therefore, so as to not produce misleading output in dry around dist-tags being altered, we do not
|
|
61
66
|
* perform the npm view step, and just show npm publish's dry-run output.
|
|
62
67
|
*/
|
|
63
|
-
if (!
|
|
68
|
+
if (!isDryRun) {
|
|
64
69
|
const currentVersion = projectPackageJson.version;
|
|
65
70
|
try {
|
|
66
71
|
const result = (0, child_process_1.execSync)(npmViewCommandSegments.join(' '), {
|
|
@@ -78,7 +83,7 @@ async function runExecutor(options, context) {
|
|
|
78
83
|
}
|
|
79
84
|
if (resultJson.versions.includes(currentVersion)) {
|
|
80
85
|
try {
|
|
81
|
-
if (!
|
|
86
|
+
if (!isDryRun) {
|
|
82
87
|
(0, child_process_1.execSync)(`npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry=${registry}`, {
|
|
83
88
|
env: processEnv(true),
|
|
84
89
|
cwd: packageRoot,
|
|
@@ -96,20 +101,26 @@ async function runExecutor(options, context) {
|
|
|
96
101
|
catch (err) {
|
|
97
102
|
try {
|
|
98
103
|
const stdoutData = JSON.parse(err.stdout?.toString() || '{}');
|
|
99
|
-
|
|
100
|
-
if (stdoutData.error
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
console.error(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
// 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
|
|
105
|
+
if (!(stdoutData.error?.code?.includes('E404') &&
|
|
106
|
+
stdoutData.error?.summary?.includes('no such package available')) &&
|
|
107
|
+
!(err.stderr?.toString().includes('E404') &&
|
|
108
|
+
err.stderr?.toString().includes('no such package available'))) {
|
|
109
|
+
console.error('npm dist-tag add error:');
|
|
110
|
+
if (stdoutData.error.summary) {
|
|
111
|
+
console.error(stdoutData.error.summary);
|
|
112
|
+
}
|
|
113
|
+
if (stdoutData.error.detail) {
|
|
114
|
+
console.error(stdoutData.error.detail);
|
|
115
|
+
}
|
|
116
|
+
if (context.isVerbose) {
|
|
117
|
+
console.error('npm dist-tag add stdout:');
|
|
118
|
+
console.error(JSON.stringify(stdoutData, null, 2));
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
success: false,
|
|
122
|
+
};
|
|
109
123
|
}
|
|
110
|
-
return {
|
|
111
|
-
success: false,
|
|
112
|
-
};
|
|
113
124
|
}
|
|
114
125
|
catch (err) {
|
|
115
126
|
console.error('Something unexpected went wrong when processing the npm dist-tag add output\n', err);
|
|
@@ -145,7 +156,7 @@ async function runExecutor(options, context) {
|
|
|
145
156
|
// If npm workspaces are in use, the publish output will nest the data under the package name, so we normalize it first
|
|
146
157
|
const normalizedStdoutData = stdoutData[packageName] ?? stdoutData;
|
|
147
158
|
(0, log_tar_1.logTar)(normalizedStdoutData);
|
|
148
|
-
if (
|
|
159
|
+
if (isDryRun) {
|
|
149
160
|
console.log(`Would publish to ${registry} with tag "${tag}", but ${chalk.keyword('orange')('[dry-run]')} was set`);
|
|
150
161
|
}
|
|
151
162
|
else {
|