@storm-software/workspace-tools 1.296.102 → 1.296.103
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/README.md +1 -1
- package/dist/executors.js +3 -3
- package/dist/executors.mjs +3 -3
- package/dist/generators.js +3 -3
- package/dist/generators.mjs +3 -3
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/package.json +12 -12
- package/dist/chunk-CBTNZPVD.js +0 -318
- package/dist/chunk-XNPPL6DM.mjs +0 -318
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
package/dist/executors.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-P6HSE7LH.js');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var _chunkZWUGCEBZjs = require('./chunk-ZWUGCEBZ.js');
|
|
5
|
-
|
|
6
|
-
|
|
7
4
|
var _chunkSIU2RWSDjs = require('./chunk-SIU2RWSD.js');
|
|
8
5
|
|
|
9
6
|
|
|
@@ -16,6 +13,9 @@ var _chunkULONYXYFjs = require('./chunk-ULONYXYF.js');
|
|
|
16
13
|
var _chunkUEDAT7SJjs = require('./chunk-UEDAT7SJ.js');
|
|
17
14
|
|
|
18
15
|
|
|
16
|
+
var _chunkZWUGCEBZjs = require('./chunk-ZWUGCEBZ.js');
|
|
17
|
+
|
|
18
|
+
|
|
19
19
|
var _chunkRU4TNHFGjs = require('./chunk-RU4TNHFG.js');
|
|
20
20
|
|
|
21
21
|
|
package/dist/executors.mjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import "./chunk-GHQJKIMQ.mjs";
|
|
2
|
-
import {
|
|
3
|
-
unbuildExecutorFn
|
|
4
|
-
} from "./chunk-N2PEIA6H.mjs";
|
|
5
2
|
import {
|
|
6
3
|
LARGE_BUFFER
|
|
7
4
|
} from "./chunk-BJ4RLCNC.mjs";
|
|
@@ -14,6 +11,9 @@ import {
|
|
|
14
11
|
import {
|
|
15
12
|
typiaExecutorFn
|
|
16
13
|
} from "./chunk-B2MF67R6.mjs";
|
|
14
|
+
import {
|
|
15
|
+
unbuildExecutorFn
|
|
16
|
+
} from "./chunk-N2PEIA6H.mjs";
|
|
17
17
|
import {
|
|
18
18
|
getRegistryVersion
|
|
19
19
|
} from "./chunk-K6UOPTIZ.mjs";
|
package/dist/generators.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-C3TC7AUW.js');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var _chunkW4JSEGT2js = require('./chunk-W4JSEGT2.js');
|
|
5
|
-
|
|
6
|
-
|
|
7
4
|
var _chunkAETRB5I7js = require('./chunk-AETRB5I7.js');
|
|
8
5
|
|
|
9
6
|
|
|
@@ -17,6 +14,9 @@ var _chunk32MOOPKKjs = require('./chunk-32MOOPKK.js');
|
|
|
17
14
|
|
|
18
15
|
|
|
19
16
|
var _chunkOKSECMVKjs = require('./chunk-OKSECMVK.js');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkW4JSEGT2js = require('./chunk-W4JSEGT2.js');
|
|
20
20
|
require('./chunk-HN5UXNLM.js');
|
|
21
21
|
require('./chunk-ILSI74FW.js');
|
|
22
22
|
require('./chunk-3G7PNDZ5.js');
|
package/dist/generators.mjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import "./chunk-SAIDGUHG.mjs";
|
|
2
|
-
import {
|
|
3
|
-
neutralLibraryGeneratorFn
|
|
4
|
-
} from "./chunk-LKCN5IIO.mjs";
|
|
5
2
|
import {
|
|
6
3
|
nodeLibraryGeneratorFn
|
|
7
4
|
} from "./chunk-4TGI6IUX.mjs";
|
|
@@ -17,6 +14,9 @@ import {
|
|
|
17
14
|
import {
|
|
18
15
|
initGenerator
|
|
19
16
|
} from "./chunk-437WGH2M.mjs";
|
|
17
|
+
import {
|
|
18
|
+
neutralLibraryGeneratorFn
|
|
19
|
+
} from "./chunk-LKCN5IIO.mjs";
|
|
20
20
|
import "./chunk-VQYZG5YE.mjs";
|
|
21
21
|
import "./chunk-XSHN3XHD.mjs";
|
|
22
22
|
import "./chunk-DEHA5C77.mjs";
|
package/dist/index.js
CHANGED
|
@@ -45,9 +45,6 @@ var _chunkDIIMX7QFjs = require('./chunk-DIIMX7QF.js');
|
|
|
45
45
|
require('./chunk-P6HSE7LH.js');
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var _chunkZWUGCEBZjs = require('./chunk-ZWUGCEBZ.js');
|
|
49
|
-
|
|
50
|
-
|
|
51
48
|
var _chunkSIU2RWSDjs = require('./chunk-SIU2RWSD.js');
|
|
52
49
|
|
|
53
50
|
|
|
@@ -60,6 +57,9 @@ var _chunkULONYXYFjs = require('./chunk-ULONYXYF.js');
|
|
|
60
57
|
var _chunkUEDAT7SJjs = require('./chunk-UEDAT7SJ.js');
|
|
61
58
|
|
|
62
59
|
|
|
60
|
+
var _chunkZWUGCEBZjs = require('./chunk-ZWUGCEBZ.js');
|
|
61
|
+
|
|
62
|
+
|
|
63
63
|
var _chunkRU4TNHFGjs = require('./chunk-RU4TNHFG.js');
|
|
64
64
|
|
|
65
65
|
|
|
@@ -110,9 +110,6 @@ require('./chunk-N2365RCI.js');
|
|
|
110
110
|
require('./chunk-C3TC7AUW.js');
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
var _chunkW4JSEGT2js = require('./chunk-W4JSEGT2.js');
|
|
114
|
-
|
|
115
|
-
|
|
116
113
|
var _chunkAETRB5I7js = require('./chunk-AETRB5I7.js');
|
|
117
114
|
|
|
118
115
|
|
|
@@ -128,6 +125,9 @@ var _chunk32MOOPKKjs = require('./chunk-32MOOPKK.js');
|
|
|
128
125
|
var _chunkOKSECMVKjs = require('./chunk-OKSECMVK.js');
|
|
129
126
|
|
|
130
127
|
|
|
128
|
+
var _chunkW4JSEGT2js = require('./chunk-W4JSEGT2.js');
|
|
129
|
+
|
|
130
|
+
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
|
package/dist/index.mjs
CHANGED
|
@@ -43,9 +43,6 @@ import {
|
|
|
43
43
|
applyWorkspaceExecutorTokens
|
|
44
44
|
} from "./chunk-EDROFLKN.mjs";
|
|
45
45
|
import "./chunk-GHQJKIMQ.mjs";
|
|
46
|
-
import {
|
|
47
|
-
unbuildExecutorFn
|
|
48
|
-
} from "./chunk-N2PEIA6H.mjs";
|
|
49
46
|
import {
|
|
50
47
|
LARGE_BUFFER
|
|
51
48
|
} from "./chunk-BJ4RLCNC.mjs";
|
|
@@ -58,6 +55,9 @@ import {
|
|
|
58
55
|
import {
|
|
59
56
|
typiaExecutorFn
|
|
60
57
|
} from "./chunk-B2MF67R6.mjs";
|
|
58
|
+
import {
|
|
59
|
+
unbuildExecutorFn
|
|
60
|
+
} from "./chunk-N2PEIA6H.mjs";
|
|
61
61
|
import {
|
|
62
62
|
getRegistryVersion
|
|
63
63
|
} from "./chunk-K6UOPTIZ.mjs";
|
|
@@ -108,9 +108,6 @@ import {
|
|
|
108
108
|
} from "./chunk-IDSDBOWW.mjs";
|
|
109
109
|
import "./chunk-UA33NH5O.mjs";
|
|
110
110
|
import "./chunk-SAIDGUHG.mjs";
|
|
111
|
-
import {
|
|
112
|
-
neutralLibraryGeneratorFn
|
|
113
|
-
} from "./chunk-LKCN5IIO.mjs";
|
|
114
111
|
import {
|
|
115
112
|
nodeLibraryGeneratorFn
|
|
116
113
|
} from "./chunk-4TGI6IUX.mjs";
|
|
@@ -126,6 +123,9 @@ import {
|
|
|
126
123
|
import {
|
|
127
124
|
initGenerator
|
|
128
125
|
} from "./chunk-437WGH2M.mjs";
|
|
126
|
+
import {
|
|
127
|
+
neutralLibraryGeneratorFn
|
|
128
|
+
} from "./chunk-LKCN5IIO.mjs";
|
|
129
129
|
import {
|
|
130
130
|
BUN_LOCK_FILE,
|
|
131
131
|
BUN_LOCK_PATH,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/workspace-tools",
|
|
3
|
-
"version": "1.296.
|
|
3
|
+
"version": "1.296.103",
|
|
4
4
|
"description": "Tools for managing a Storm workspace, including various Nx generators and executors for common development tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"monorepo",
|
|
@@ -238,11 +238,11 @@
|
|
|
238
238
|
"@size-limit/esbuild": "^11.2.0",
|
|
239
239
|
"@size-limit/esbuild-why": "^11.2.0",
|
|
240
240
|
"@size-limit/file": "^11.2.0",
|
|
241
|
-
"@storm-software/config": "^1.138.
|
|
242
|
-
"@storm-software/config-tools": "^1.190.
|
|
243
|
-
"@storm-software/npm-tools": "^0.6.
|
|
244
|
-
"@storm-software/prettier": "^0.59.
|
|
245
|
-
"@storm-software/tsdown": "^0.45.
|
|
241
|
+
"@storm-software/config": "^1.138.59",
|
|
242
|
+
"@storm-software/config-tools": "^1.190.122",
|
|
243
|
+
"@storm-software/npm-tools": "^0.6.240",
|
|
244
|
+
"@storm-software/prettier": "^0.59.175",
|
|
245
|
+
"@storm-software/tsdown": "^0.45.283",
|
|
246
246
|
"defu": "^6.1.7",
|
|
247
247
|
"esbuild": "^0.25.12",
|
|
248
248
|
"fs-extra": "^11.4.0",
|
|
@@ -261,11 +261,11 @@
|
|
|
261
261
|
},
|
|
262
262
|
"devDependencies": {
|
|
263
263
|
"@napi-rs/cli": "^3.8.2",
|
|
264
|
-
"@storm-software/bun-tools": "^0.0.
|
|
265
|
-
"@storm-software/esbuild": "^0.53.
|
|
266
|
-
"@storm-software/package-constants": "^0.1.
|
|
267
|
-
"@storm-software/pnpm-tools": "^0.7.
|
|
268
|
-
"@storm-software/unbuild": "^0.57.
|
|
264
|
+
"@storm-software/bun-tools": "^0.0.32",
|
|
265
|
+
"@storm-software/esbuild": "^0.53.283",
|
|
266
|
+
"@storm-software/package-constants": "^0.1.135",
|
|
267
|
+
"@storm-software/pnpm-tools": "^0.7.133",
|
|
268
|
+
"@storm-software/unbuild": "^0.57.283",
|
|
269
269
|
"@types/micromatch": "^4.0.10",
|
|
270
270
|
"@types/node": "^25.9.5",
|
|
271
271
|
"@types/semver": "^7.8.0",
|
|
@@ -294,5 +294,5 @@
|
|
|
294
294
|
"publishConfig": { "access": "public" },
|
|
295
295
|
"executors": "./executors.json",
|
|
296
296
|
"generators": "./generators.json",
|
|
297
|
-
"gitHead": "
|
|
297
|
+
"gitHead": "0be9a37f594450158c976638a8d496232ba3178a"
|
|
298
298
|
}
|
package/dist/chunk-CBTNZPVD.js
DELETED
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
var _chunkMKJITWLNjs = require('./chunk-MKJITWLN.js');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunk46OIJVV3js = require('./chunk-46OIJVV3.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunk3MXZ2RJFjs = require('./chunk-3MXZ2RJF.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chunkIMY2BU43js = require('./chunk-IMY2BU43.js');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkCQDBLKPFjs = require('./chunk-CQDBLKPF.js');
|
|
16
|
-
|
|
17
|
-
// src/executors/npm-publish/executor.ts
|
|
18
|
-
var _jiti = require('jiti');
|
|
19
|
-
var _child_process = require('child_process');
|
|
20
|
-
var _promises = require('fs/promises');
|
|
21
|
-
var _prettier = require('prettier');
|
|
22
|
-
var LARGE_BUFFER = 1024 * 1e6;
|
|
23
|
-
async function replaceDepsAliases(jiti, packageRoot, workspaceRoot, packageManager) {
|
|
24
|
-
if (packageManager === "bun") {
|
|
25
|
-
const { replaceDepsAliases: replaceBunDepsAliases } = await jiti.import(jiti.esmResolve("@storm-software/bun-tools"));
|
|
26
|
-
return replaceBunDepsAliases(packageRoot, workspaceRoot);
|
|
27
|
-
}
|
|
28
|
-
if (packageManager === "pnpm") {
|
|
29
|
-
const { replaceDepsAliases: replacePnpmDepsAliases } = await jiti.import(jiti.esmResolve("@storm-software/pnpm-tools"));
|
|
30
|
-
return replacePnpmDepsAliases(packageRoot, workspaceRoot);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async function npmPublishExecutorFn(options, context) {
|
|
34
|
-
const workspaceConfig = await _chunkIMY2BU43js.getConfig.call(void 0, context.root);
|
|
35
|
-
const packageManager = await _chunk3MXZ2RJFjs.getWorkspacePackageManager.call(void 0,
|
|
36
|
-
context.root,
|
|
37
|
-
workspaceConfig
|
|
38
|
-
);
|
|
39
|
-
const github = await _chunkMKJITWLNjs.getGitHubTools.call(void 0, workspaceConfig);
|
|
40
|
-
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
41
|
-
if (!context.projectName) {
|
|
42
|
-
github.error("The `npm-publish` executor requires a `projectName`.");
|
|
43
|
-
return { success: false };
|
|
44
|
-
}
|
|
45
|
-
const projectConfig = _optionalChain([context, 'access', _ => _.projectsConfigurations, 'optionalAccess', _2 => _2.projects, 'optionalAccess', _3 => _3[context.projectName]]);
|
|
46
|
-
if (!projectConfig) {
|
|
47
|
-
github.error(
|
|
48
|
-
`Could not find project configuration for \`${context.projectName}\``
|
|
49
|
-
);
|
|
50
|
-
return { success: false };
|
|
51
|
-
}
|
|
52
|
-
const packageRoot = _chunkCQDBLKPFjs.joinPaths.call(void 0,
|
|
53
|
-
context.root,
|
|
54
|
-
options.packageRoot || _chunkCQDBLKPFjs.joinPaths.call(void 0, "dist", projectConfig.root)
|
|
55
|
-
);
|
|
56
|
-
const projectRoot = _optionalChain([context, 'access', _4 => _4.projectsConfigurations, 'access', _5 => _5.projects, 'access', _6 => _6[context.projectName], 'optionalAccess', _7 => _7.root]) ? _chunkCQDBLKPFjs.joinPaths.call(void 0,
|
|
57
|
-
context.root,
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
59
|
-
context.projectsConfigurations.projects[context.projectName].root
|
|
60
|
-
) : packageRoot;
|
|
61
|
-
const jiti = _jiti.createJiti.call(void 0, context.root, {
|
|
62
|
-
fsCache: _chunkCQDBLKPFjs.joinPaths.call(void 0, context.root, "node_modules/.cache/storm", "jiti"),
|
|
63
|
-
interopDefault: true
|
|
64
|
-
});
|
|
65
|
-
const { getNpmRegistry, getRegistry } = await jiti.import(jiti.esmResolve("@storm-software/npm-tools/helpers"));
|
|
66
|
-
const packageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, packageRoot, "package.json");
|
|
67
|
-
const packageJsonFile = await _promises.readFile.call(void 0, packageJsonPath, "utf8");
|
|
68
|
-
if (!packageJsonFile) {
|
|
69
|
-
github.error(`Could not find \`package.json\` at ${packageJsonPath}`);
|
|
70
|
-
return { success: false };
|
|
71
|
-
}
|
|
72
|
-
const packageJson = JSON.parse(packageJsonFile);
|
|
73
|
-
const projectPackageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, projectRoot, "package.json");
|
|
74
|
-
const projectPackageJsonFile = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
|
|
75
|
-
if (!projectPackageJsonFile) {
|
|
76
|
-
github.error(
|
|
77
|
-
`Could not find \`package.json\` at ${projectPackageJsonPath}`
|
|
78
|
-
);
|
|
79
|
-
return { success: false };
|
|
80
|
-
}
|
|
81
|
-
const projectPackageJson = JSON.parse(projectPackageJsonFile);
|
|
82
|
-
if (packageJson.version !== projectPackageJson.version) {
|
|
83
|
-
console.warn(
|
|
84
|
-
`The version in the package.json file at ${packageJsonPath} (current: ${packageJson.version}) does not match the version in the package.json file at ${projectPackageJsonPath} (current: ${projectPackageJson.version}). This file will be updated to match the version in the project package.json file.`
|
|
85
|
-
);
|
|
86
|
-
if (projectPackageJson.version) {
|
|
87
|
-
packageJson.version = projectPackageJson.version;
|
|
88
|
-
await _promises.writeFile.call(void 0,
|
|
89
|
-
packageJsonPath,
|
|
90
|
-
await _prettier.format.call(void 0, JSON.stringify(packageJson), {
|
|
91
|
-
parser: "json",
|
|
92
|
-
proseWrap: "preserve",
|
|
93
|
-
trailingComma: "none",
|
|
94
|
-
tabWidth: 2,
|
|
95
|
-
semi: true,
|
|
96
|
-
singleQuote: false,
|
|
97
|
-
quoteProps: "as-needed",
|
|
98
|
-
insertPragma: false,
|
|
99
|
-
bracketSameLine: true,
|
|
100
|
-
printWidth: 80,
|
|
101
|
-
bracketSpacing: true,
|
|
102
|
-
arrowParens: "avoid",
|
|
103
|
-
endOfLine: "lf",
|
|
104
|
-
plugins: ["prettier-plugin-packagejson"]
|
|
105
|
-
})
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
const packageName = packageJson.name;
|
|
110
|
-
console.info(
|
|
111
|
-
`\u{1F680} Running Storm NPM Publish executor on the ${packageName} package`
|
|
112
|
-
);
|
|
113
|
-
const packageTxt = packageName === context.projectName ? `package "${packageName}"` : `package "${packageName}" from project "${context.projectName}"`;
|
|
114
|
-
if (packageJson.private === true) {
|
|
115
|
-
console.warn(
|
|
116
|
-
`Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`
|
|
117
|
-
);
|
|
118
|
-
return { success: true };
|
|
119
|
-
}
|
|
120
|
-
await replaceDepsAliases(jiti, packageRoot, context.root, packageManager);
|
|
121
|
-
await _chunk46OIJVV3js.addPackageJsonGitHead.call(void 0, packageRoot);
|
|
122
|
-
const npmPublishCommandSegments = [`npm publish --json`];
|
|
123
|
-
const npmViewCommandSegments = [
|
|
124
|
-
`npm view ${packageName} versions dist-tags --json`
|
|
125
|
-
];
|
|
126
|
-
const registry = await Promise.resolve(
|
|
127
|
-
await _asyncNullishCoalesce(options.registry, async () => ( (await getRegistry() || getNpmRegistry())))
|
|
128
|
-
);
|
|
129
|
-
if (registry) {
|
|
130
|
-
npmPublishCommandSegments.push(`--registry="${registry}" `);
|
|
131
|
-
npmViewCommandSegments.push(`--registry="${registry}" `);
|
|
132
|
-
}
|
|
133
|
-
if (options.otp) {
|
|
134
|
-
npmPublishCommandSegments.push(`--otp="${options.otp}" `);
|
|
135
|
-
}
|
|
136
|
-
let token;
|
|
137
|
-
if (!options.otp && registry) {
|
|
138
|
-
token = await github.getIDToken(
|
|
139
|
-
`npm:${registry.replace(/^https?:\/\//, "")}`
|
|
140
|
-
);
|
|
141
|
-
if (!token) {
|
|
142
|
-
github.warning(
|
|
143
|
-
`Either a One time password (OTP) or an OpenID Connect (OIDC) token is generally required to publish ${packageTxt} to NPM. Usually the OIDC token should be provided automatically via GitHub Actions (see: https://github.com/actions/toolkit/tree/main/packages/core#oidc-token); however, the release process was unable to retrieve it. Please provide a \`otp\` executor option, or investigate why the OIDC token could not be retrieved.`
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
npmPublishCommandSegments.push("--provenance --access=public ");
|
|
148
|
-
if (isDryRun) {
|
|
149
|
-
npmPublishCommandSegments.push("--dry-run");
|
|
150
|
-
}
|
|
151
|
-
const tag = options.tag || _child_process.execSync.call(void 0, "npm config get tag", {
|
|
152
|
-
cwd: packageRoot,
|
|
153
|
-
env: {
|
|
154
|
-
NPM_ID_TOKEN: token,
|
|
155
|
-
...process.env,
|
|
156
|
-
FORCE_COLOR: "true"
|
|
157
|
-
},
|
|
158
|
-
maxBuffer: LARGE_BUFFER,
|
|
159
|
-
killSignal: "SIGTERM"
|
|
160
|
-
}).toString().trim();
|
|
161
|
-
if (tag) {
|
|
162
|
-
npmPublishCommandSegments.push(`--tag="${tag}" `);
|
|
163
|
-
}
|
|
164
|
-
if (!isDryRun) {
|
|
165
|
-
const currentVersion = options.version || packageJson.version;
|
|
166
|
-
try {
|
|
167
|
-
try {
|
|
168
|
-
const result = _child_process.execSync.call(void 0, npmViewCommandSegments.join(" "), {
|
|
169
|
-
cwd: packageRoot,
|
|
170
|
-
env: {
|
|
171
|
-
NPM_ID_TOKEN: token,
|
|
172
|
-
...process.env,
|
|
173
|
-
FORCE_COLOR: "true"
|
|
174
|
-
},
|
|
175
|
-
maxBuffer: LARGE_BUFFER,
|
|
176
|
-
killSignal: "SIGTERM"
|
|
177
|
-
});
|
|
178
|
-
const resultJson = JSON.parse(result.toString());
|
|
179
|
-
const distTags = resultJson["dist-tags"] || {};
|
|
180
|
-
if (distTags[tag] === currentVersion) {
|
|
181
|
-
console.warn(
|
|
182
|
-
`Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`
|
|
183
|
-
);
|
|
184
|
-
return { success: true };
|
|
185
|
-
}
|
|
186
|
-
} catch (err) {
|
|
187
|
-
console.debug(
|
|
188
|
-
`An error occurred while checking for existing dist-tags. Please note: if this is the first time this package has been published to npm, this can be ignored.
|
|
189
|
-
|
|
190
|
-
Error: ${JSON.stringify(
|
|
191
|
-
err,
|
|
192
|
-
null,
|
|
193
|
-
2
|
|
194
|
-
)}`
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
try {
|
|
198
|
-
if (!isDryRun) {
|
|
199
|
-
const command = `npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry="${registry}" `;
|
|
200
|
-
console.debug(
|
|
201
|
-
`Adding the dist-tag ${tag} - preparing to run the following: ${command}`
|
|
202
|
-
);
|
|
203
|
-
const result = _child_process.execSync.call(void 0, command, {
|
|
204
|
-
cwd: packageRoot,
|
|
205
|
-
env: {
|
|
206
|
-
NPM_ID_TOKEN: token,
|
|
207
|
-
...process.env,
|
|
208
|
-
FORCE_COLOR: "true"
|
|
209
|
-
},
|
|
210
|
-
maxBuffer: LARGE_BUFFER,
|
|
211
|
-
killSignal: "SIGTERM"
|
|
212
|
-
});
|
|
213
|
-
console.info(
|
|
214
|
-
`Added the dist-tag ${tag} to v${currentVersion} for registry "${registry}".
|
|
215
|
-
|
|
216
|
-
Execution response: ${result.toString()}`
|
|
217
|
-
);
|
|
218
|
-
} else {
|
|
219
|
-
console.info(
|
|
220
|
-
`Would have added the dist-tag ${tag} to v${currentVersion} for registry "${registry}", but [dry-run] was set.
|
|
221
|
-
`
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
return { success: true };
|
|
225
|
-
} catch (err) {
|
|
226
|
-
try {
|
|
227
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access', _8 => _8.stdout, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]) || "{}");
|
|
228
|
-
if (_optionalChain([stdoutData, 'optionalAccess', _11 => _11.error]) && !(_optionalChain([stdoutData, 'access', _12 => _12.error, 'optionalAccess', _13 => _13.code, 'optionalAccess', _14 => _14.includes, 'call', _15 => _15("E404")]) && _optionalChain([stdoutData, 'access', _16 => _16.error, 'optionalAccess', _17 => _17.summary, 'optionalAccess', _18 => _18.includes, 'call', _19 => _19("no such package available")])) && !(_optionalChain([err, 'access', _20 => _20.stderr, 'optionalAccess', _21 => _21.toString, 'call', _22 => _22(), 'access', _23 => _23.includes, 'call', _24 => _24("E404")]) && _optionalChain([err, 'access', _25 => _25.stderr, 'optionalAccess', _26 => _26.toString, 'call', _27 => _27(), 'access', _28 => _28.includes, 'call', _29 => _29("no such package available")]))) {
|
|
229
|
-
const errorMessage = `An unexpected error occured while running the npm dist-tag add command:
|
|
230
|
-
|
|
231
|
-
${_optionalChain([stdoutData, 'optionalAccess', _30 => _30.error, 'optionalAccess', _31 => _31.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _32 => _32.error, 'optionalAccess', _33 => _33.summary])}${_optionalChain([stdoutData, 'optionalAccess', _34 => _34.error, 'optionalAccess', _35 => _35.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _36 => _36.error, 'optionalAccess', _37 => _37.code])})` : ""}
|
|
232
|
-
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _38 => _38.error, 'optionalAccess', _39 => _39.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _40 => _40.error, 'optionalAccess', _41 => _41.detail])}
|
|
233
|
-
` : ""}`;
|
|
234
|
-
github.error(errorMessage);
|
|
235
|
-
return { success: false };
|
|
236
|
-
}
|
|
237
|
-
} catch (err2) {
|
|
238
|
-
const stdoutData = JSON.parse(_optionalChain([err2, 'access', _42 => _42.stdout, 'optionalAccess', _43 => _43.toString, 'call', _44 => _44()]) || "{}");
|
|
239
|
-
const errorMessage = `An unexpected error occured while processing the npm dist-tag add output:
|
|
240
|
-
|
|
241
|
-
${_optionalChain([stdoutData, 'optionalAccess', _45 => _45.error, 'optionalAccess', _46 => _46.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _47 => _47.error, 'optionalAccess', _48 => _48.summary])}${_optionalChain([stdoutData, 'optionalAccess', _49 => _49.error, 'optionalAccess', _50 => _50.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _51 => _51.error, 'optionalAccess', _52 => _52.code])})` : ""}
|
|
242
|
-
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _53 => _53.error, 'optionalAccess', _54 => _54.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _55 => _55.error, 'optionalAccess', _56 => _56.detail])}
|
|
243
|
-
` : ""}`;
|
|
244
|
-
github.error(errorMessage);
|
|
245
|
-
return { success: false };
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
} catch (err) {
|
|
249
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access', _57 => _57.stdout, 'optionalAccess', _58 => _58.toString, 'call', _59 => _59()]) || "{}");
|
|
250
|
-
if (!(_optionalChain([stdoutData, 'access', _60 => _60.error, 'optionalAccess', _61 => _61.code, 'optionalAccess', _62 => _62.includes, 'call', _63 => _63("E404")]) && _optionalChain([stdoutData, 'access', _64 => _64.error, 'optionalAccess', _65 => _65.summary, 'optionalAccess', _66 => _66.toLowerCase, 'call', _67 => _67(), 'access', _68 => _68.includes, 'call', _69 => _69("not found")])) && !(_optionalChain([err, 'access', _70 => _70.stderr, 'optionalAccess', _71 => _71.toString, 'call', _72 => _72(), 'access', _73 => _73.includes, 'call', _74 => _74("E404")]) && _optionalChain([err, 'access', _75 => _75.stderr, 'optionalAccess', _76 => _76.toString, 'call', _77 => _77(), 'access', _78 => _78.toLowerCase, 'call', _79 => _79(), 'access', _80 => _80.includes, 'call', _81 => _81("not found")]))) {
|
|
251
|
-
const errorMessage = `An unexpected error occured while checking for existing dist-tags:
|
|
252
|
-
|
|
253
|
-
${_optionalChain([stdoutData, 'optionalAccess', _82 => _82.error, 'optionalAccess', _83 => _83.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _84 => _84.error, 'optionalAccess', _85 => _85.summary])}${_optionalChain([stdoutData, 'optionalAccess', _86 => _86.error, 'optionalAccess', _87 => _87.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _88 => _88.error, 'optionalAccess', _89 => _89.code])})` : ""}
|
|
254
|
-
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _90 => _90.error, 'optionalAccess', _91 => _91.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _92 => _92.error, 'optionalAccess', _93 => _93.detail])}
|
|
255
|
-
` : ""}`;
|
|
256
|
-
github.error(errorMessage);
|
|
257
|
-
return { success: false };
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
try {
|
|
262
|
-
const cwd = packageRoot;
|
|
263
|
-
const command = npmPublishCommandSegments.join(" ");
|
|
264
|
-
console.info(
|
|
265
|
-
`Running publish command "${command}" in current working directory: "${cwd}" `
|
|
266
|
-
);
|
|
267
|
-
const result = _child_process.execSync.call(void 0, command, {
|
|
268
|
-
cwd,
|
|
269
|
-
env: {
|
|
270
|
-
NPM_ID_TOKEN: token,
|
|
271
|
-
...process.env,
|
|
272
|
-
FORCE_COLOR: "true"
|
|
273
|
-
},
|
|
274
|
-
maxBuffer: LARGE_BUFFER,
|
|
275
|
-
killSignal: "SIGTERM"
|
|
276
|
-
});
|
|
277
|
-
if (isDryRun) {
|
|
278
|
-
console.info(
|
|
279
|
-
`Would publish tag "${tag}" to ${registry}, but [dry-run] was set. ${result ? `
|
|
280
|
-
|
|
281
|
-
Execution response: ${result.toString()}` : ""}`
|
|
282
|
-
);
|
|
283
|
-
} else {
|
|
284
|
-
console.info(
|
|
285
|
-
`Published tag "${tag}" to ${registry}. ${result ? `
|
|
286
|
-
|
|
287
|
-
Execution response: ${result.toString()}` : ""}`
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
return { success: true };
|
|
291
|
-
} catch (err) {
|
|
292
|
-
try {
|
|
293
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access', _94 => _94.stdout, 'optionalAccess', _95 => _95.toString, 'call', _96 => _96()]) || "{}");
|
|
294
|
-
const errorMessage = `An error occurred while publishing the npm package:
|
|
295
|
-
|
|
296
|
-
${_optionalChain([stdoutData, 'optionalAccess', _97 => _97.error, 'optionalAccess', _98 => _98.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _99 => _99.error, 'optionalAccess', _100 => _100.summary])}${_optionalChain([stdoutData, 'optionalAccess', _101 => _101.error, 'optionalAccess', _102 => _102.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _103 => _103.error, 'optionalAccess', _104 => _104.code])})` : ""}
|
|
297
|
-
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _105 => _105.error, 'optionalAccess', _106 => _106.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _107 => _107.error, 'optionalAccess', _108 => _108.detail])}
|
|
298
|
-
` : ""}`;
|
|
299
|
-
github.error(errorMessage);
|
|
300
|
-
return { success: false };
|
|
301
|
-
} catch (err2) {
|
|
302
|
-
const errorMessage = `Something unexpected went wrong when processing the npm publish output.
|
|
303
|
-
|
|
304
|
-
Error: ${JSON.stringify(
|
|
305
|
-
Buffer.isBuffer(err2) ? err2.toString() : err2,
|
|
306
|
-
null,
|
|
307
|
-
2
|
|
308
|
-
)}`;
|
|
309
|
-
github.error(errorMessage);
|
|
310
|
-
return { success: false };
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
exports.LARGE_BUFFER = LARGE_BUFFER; exports.npmPublishExecutorFn = npmPublishExecutorFn;
|
package/dist/chunk-XNPPL6DM.mjs
DELETED
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getGitHubTools
|
|
3
|
-
} from "./chunk-54BBSJHK.mjs";
|
|
4
|
-
import {
|
|
5
|
-
addPackageJsonGitHead
|
|
6
|
-
} from "./chunk-IDSDBOWW.mjs";
|
|
7
|
-
import {
|
|
8
|
-
getWorkspacePackageManager
|
|
9
|
-
} from "./chunk-EXRSULNO.mjs";
|
|
10
|
-
import {
|
|
11
|
-
getConfig
|
|
12
|
-
} from "./chunk-I4KVL3GR.mjs";
|
|
13
|
-
import {
|
|
14
|
-
joinPaths
|
|
15
|
-
} from "./chunk-TBW5MCN6.mjs";
|
|
16
|
-
|
|
17
|
-
// src/executors/npm-publish/executor.ts
|
|
18
|
-
import { createJiti } from "jiti";
|
|
19
|
-
import { execSync } from "node:child_process";
|
|
20
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
21
|
-
import { format } from "prettier";
|
|
22
|
-
var LARGE_BUFFER = 1024 * 1e6;
|
|
23
|
-
async function replaceDepsAliases(jiti, packageRoot, workspaceRoot, packageManager) {
|
|
24
|
-
if (packageManager === "bun") {
|
|
25
|
-
const { replaceDepsAliases: replaceBunDepsAliases } = await jiti.import(jiti.esmResolve("@storm-software/bun-tools"));
|
|
26
|
-
return replaceBunDepsAliases(packageRoot, workspaceRoot);
|
|
27
|
-
}
|
|
28
|
-
if (packageManager === "pnpm") {
|
|
29
|
-
const { replaceDepsAliases: replacePnpmDepsAliases } = await jiti.import(jiti.esmResolve("@storm-software/pnpm-tools"));
|
|
30
|
-
return replacePnpmDepsAliases(packageRoot, workspaceRoot);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async function npmPublishExecutorFn(options, context) {
|
|
34
|
-
const workspaceConfig = await getConfig(context.root);
|
|
35
|
-
const packageManager = await getWorkspacePackageManager(
|
|
36
|
-
context.root,
|
|
37
|
-
workspaceConfig
|
|
38
|
-
);
|
|
39
|
-
const github = await getGitHubTools(workspaceConfig);
|
|
40
|
-
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
41
|
-
if (!context.projectName) {
|
|
42
|
-
github.error("The `npm-publish` executor requires a `projectName`.");
|
|
43
|
-
return { success: false };
|
|
44
|
-
}
|
|
45
|
-
const projectConfig = context.projectsConfigurations?.projects?.[context.projectName];
|
|
46
|
-
if (!projectConfig) {
|
|
47
|
-
github.error(
|
|
48
|
-
`Could not find project configuration for \`${context.projectName}\``
|
|
49
|
-
);
|
|
50
|
-
return { success: false };
|
|
51
|
-
}
|
|
52
|
-
const packageRoot = joinPaths(
|
|
53
|
-
context.root,
|
|
54
|
-
options.packageRoot || joinPaths("dist", projectConfig.root)
|
|
55
|
-
);
|
|
56
|
-
const projectRoot = context.projectsConfigurations.projects[context.projectName]?.root ? joinPaths(
|
|
57
|
-
context.root,
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
59
|
-
context.projectsConfigurations.projects[context.projectName].root
|
|
60
|
-
) : packageRoot;
|
|
61
|
-
const jiti = createJiti(context.root, {
|
|
62
|
-
fsCache: joinPaths(context.root, "node_modules/.cache/storm", "jiti"),
|
|
63
|
-
interopDefault: true
|
|
64
|
-
});
|
|
65
|
-
const { getNpmRegistry, getRegistry } = await jiti.import(jiti.esmResolve("@storm-software/npm-tools/helpers"));
|
|
66
|
-
const packageJsonPath = joinPaths(packageRoot, "package.json");
|
|
67
|
-
const packageJsonFile = await readFile(packageJsonPath, "utf8");
|
|
68
|
-
if (!packageJsonFile) {
|
|
69
|
-
github.error(`Could not find \`package.json\` at ${packageJsonPath}`);
|
|
70
|
-
return { success: false };
|
|
71
|
-
}
|
|
72
|
-
const packageJson = JSON.parse(packageJsonFile);
|
|
73
|
-
const projectPackageJsonPath = joinPaths(projectRoot, "package.json");
|
|
74
|
-
const projectPackageJsonFile = await readFile(projectPackageJsonPath, "utf8");
|
|
75
|
-
if (!projectPackageJsonFile) {
|
|
76
|
-
github.error(
|
|
77
|
-
`Could not find \`package.json\` at ${projectPackageJsonPath}`
|
|
78
|
-
);
|
|
79
|
-
return { success: false };
|
|
80
|
-
}
|
|
81
|
-
const projectPackageJson = JSON.parse(projectPackageJsonFile);
|
|
82
|
-
if (packageJson.version !== projectPackageJson.version) {
|
|
83
|
-
console.warn(
|
|
84
|
-
`The version in the package.json file at ${packageJsonPath} (current: ${packageJson.version}) does not match the version in the package.json file at ${projectPackageJsonPath} (current: ${projectPackageJson.version}). This file will be updated to match the version in the project package.json file.`
|
|
85
|
-
);
|
|
86
|
-
if (projectPackageJson.version) {
|
|
87
|
-
packageJson.version = projectPackageJson.version;
|
|
88
|
-
await writeFile(
|
|
89
|
-
packageJsonPath,
|
|
90
|
-
await format(JSON.stringify(packageJson), {
|
|
91
|
-
parser: "json",
|
|
92
|
-
proseWrap: "preserve",
|
|
93
|
-
trailingComma: "none",
|
|
94
|
-
tabWidth: 2,
|
|
95
|
-
semi: true,
|
|
96
|
-
singleQuote: false,
|
|
97
|
-
quoteProps: "as-needed",
|
|
98
|
-
insertPragma: false,
|
|
99
|
-
bracketSameLine: true,
|
|
100
|
-
printWidth: 80,
|
|
101
|
-
bracketSpacing: true,
|
|
102
|
-
arrowParens: "avoid",
|
|
103
|
-
endOfLine: "lf",
|
|
104
|
-
plugins: ["prettier-plugin-packagejson"]
|
|
105
|
-
})
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
const packageName = packageJson.name;
|
|
110
|
-
console.info(
|
|
111
|
-
`\u{1F680} Running Storm NPM Publish executor on the ${packageName} package`
|
|
112
|
-
);
|
|
113
|
-
const packageTxt = packageName === context.projectName ? `package "${packageName}"` : `package "${packageName}" from project "${context.projectName}"`;
|
|
114
|
-
if (packageJson.private === true) {
|
|
115
|
-
console.warn(
|
|
116
|
-
`Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`
|
|
117
|
-
);
|
|
118
|
-
return { success: true };
|
|
119
|
-
}
|
|
120
|
-
await replaceDepsAliases(jiti, packageRoot, context.root, packageManager);
|
|
121
|
-
await addPackageJsonGitHead(packageRoot);
|
|
122
|
-
const npmPublishCommandSegments = [`npm publish --json`];
|
|
123
|
-
const npmViewCommandSegments = [
|
|
124
|
-
`npm view ${packageName} versions dist-tags --json`
|
|
125
|
-
];
|
|
126
|
-
const registry = await Promise.resolve(
|
|
127
|
-
options.registry ?? (await getRegistry() || getNpmRegistry())
|
|
128
|
-
);
|
|
129
|
-
if (registry) {
|
|
130
|
-
npmPublishCommandSegments.push(`--registry="${registry}" `);
|
|
131
|
-
npmViewCommandSegments.push(`--registry="${registry}" `);
|
|
132
|
-
}
|
|
133
|
-
if (options.otp) {
|
|
134
|
-
npmPublishCommandSegments.push(`--otp="${options.otp}" `);
|
|
135
|
-
}
|
|
136
|
-
let token;
|
|
137
|
-
if (!options.otp && registry) {
|
|
138
|
-
token = await github.getIDToken(
|
|
139
|
-
`npm:${registry.replace(/^https?:\/\//, "")}`
|
|
140
|
-
);
|
|
141
|
-
if (!token) {
|
|
142
|
-
github.warning(
|
|
143
|
-
`Either a One time password (OTP) or an OpenID Connect (OIDC) token is generally required to publish ${packageTxt} to NPM. Usually the OIDC token should be provided automatically via GitHub Actions (see: https://github.com/actions/toolkit/tree/main/packages/core#oidc-token); however, the release process was unable to retrieve it. Please provide a \`otp\` executor option, or investigate why the OIDC token could not be retrieved.`
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
npmPublishCommandSegments.push("--provenance --access=public ");
|
|
148
|
-
if (isDryRun) {
|
|
149
|
-
npmPublishCommandSegments.push("--dry-run");
|
|
150
|
-
}
|
|
151
|
-
const tag = options.tag || execSync("npm config get tag", {
|
|
152
|
-
cwd: packageRoot,
|
|
153
|
-
env: {
|
|
154
|
-
NPM_ID_TOKEN: token,
|
|
155
|
-
...process.env,
|
|
156
|
-
FORCE_COLOR: "true"
|
|
157
|
-
},
|
|
158
|
-
maxBuffer: LARGE_BUFFER,
|
|
159
|
-
killSignal: "SIGTERM"
|
|
160
|
-
}).toString().trim();
|
|
161
|
-
if (tag) {
|
|
162
|
-
npmPublishCommandSegments.push(`--tag="${tag}" `);
|
|
163
|
-
}
|
|
164
|
-
if (!isDryRun) {
|
|
165
|
-
const currentVersion = options.version || packageJson.version;
|
|
166
|
-
try {
|
|
167
|
-
try {
|
|
168
|
-
const result = execSync(npmViewCommandSegments.join(" "), {
|
|
169
|
-
cwd: packageRoot,
|
|
170
|
-
env: {
|
|
171
|
-
NPM_ID_TOKEN: token,
|
|
172
|
-
...process.env,
|
|
173
|
-
FORCE_COLOR: "true"
|
|
174
|
-
},
|
|
175
|
-
maxBuffer: LARGE_BUFFER,
|
|
176
|
-
killSignal: "SIGTERM"
|
|
177
|
-
});
|
|
178
|
-
const resultJson = JSON.parse(result.toString());
|
|
179
|
-
const distTags = resultJson["dist-tags"] || {};
|
|
180
|
-
if (distTags[tag] === currentVersion) {
|
|
181
|
-
console.warn(
|
|
182
|
-
`Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`
|
|
183
|
-
);
|
|
184
|
-
return { success: true };
|
|
185
|
-
}
|
|
186
|
-
} catch (err) {
|
|
187
|
-
console.debug(
|
|
188
|
-
`An error occurred while checking for existing dist-tags. Please note: if this is the first time this package has been published to npm, this can be ignored.
|
|
189
|
-
|
|
190
|
-
Error: ${JSON.stringify(
|
|
191
|
-
err,
|
|
192
|
-
null,
|
|
193
|
-
2
|
|
194
|
-
)}`
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
try {
|
|
198
|
-
if (!isDryRun) {
|
|
199
|
-
const command = `npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry="${registry}" `;
|
|
200
|
-
console.debug(
|
|
201
|
-
`Adding the dist-tag ${tag} - preparing to run the following: ${command}`
|
|
202
|
-
);
|
|
203
|
-
const result = execSync(command, {
|
|
204
|
-
cwd: packageRoot,
|
|
205
|
-
env: {
|
|
206
|
-
NPM_ID_TOKEN: token,
|
|
207
|
-
...process.env,
|
|
208
|
-
FORCE_COLOR: "true"
|
|
209
|
-
},
|
|
210
|
-
maxBuffer: LARGE_BUFFER,
|
|
211
|
-
killSignal: "SIGTERM"
|
|
212
|
-
});
|
|
213
|
-
console.info(
|
|
214
|
-
`Added the dist-tag ${tag} to v${currentVersion} for registry "${registry}".
|
|
215
|
-
|
|
216
|
-
Execution response: ${result.toString()}`
|
|
217
|
-
);
|
|
218
|
-
} else {
|
|
219
|
-
console.info(
|
|
220
|
-
`Would have added the dist-tag ${tag} to v${currentVersion} for registry "${registry}", but [dry-run] was set.
|
|
221
|
-
`
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
return { success: true };
|
|
225
|
-
} catch (err) {
|
|
226
|
-
try {
|
|
227
|
-
const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
|
|
228
|
-
if (stdoutData?.error && !(stdoutData.error?.code?.includes("E404") && stdoutData.error?.summary?.includes("no such package available")) && !(err.stderr?.toString().includes("E404") && err.stderr?.toString().includes("no such package available"))) {
|
|
229
|
-
const errorMessage = `An unexpected error occured while running the npm dist-tag add command:
|
|
230
|
-
|
|
231
|
-
${stdoutData?.error?.summary ? `Summary: ${stdoutData?.error?.summary}${stdoutData?.error?.code ? ` (${stdoutData?.error?.code})` : ""}
|
|
232
|
-
` : ""}${stdoutData?.error?.detail ? `Detail: ${stdoutData?.error?.detail}
|
|
233
|
-
` : ""}`;
|
|
234
|
-
github.error(errorMessage);
|
|
235
|
-
return { success: false };
|
|
236
|
-
}
|
|
237
|
-
} catch (err2) {
|
|
238
|
-
const stdoutData = JSON.parse(err2.stdout?.toString() || "{}");
|
|
239
|
-
const errorMessage = `An unexpected error occured while processing the npm dist-tag add output:
|
|
240
|
-
|
|
241
|
-
${stdoutData?.error?.summary ? `Summary: ${stdoutData?.error?.summary}${stdoutData?.error?.code ? ` (${stdoutData?.error?.code})` : ""}
|
|
242
|
-
` : ""}${stdoutData?.error?.detail ? `Detail: ${stdoutData?.error?.detail}
|
|
243
|
-
` : ""}`;
|
|
244
|
-
github.error(errorMessage);
|
|
245
|
-
return { success: false };
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
} catch (err) {
|
|
249
|
-
const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
|
|
250
|
-
if (!(stdoutData.error?.code?.includes("E404") && stdoutData.error?.summary?.toLowerCase().includes("not found")) && !(err.stderr?.toString().includes("E404") && err.stderr?.toString().toLowerCase().includes("not found"))) {
|
|
251
|
-
const errorMessage = `An unexpected error occured while checking for existing dist-tags:
|
|
252
|
-
|
|
253
|
-
${stdoutData?.error?.summary ? `Summary: ${stdoutData?.error?.summary}${stdoutData?.error?.code ? ` (${stdoutData?.error?.code})` : ""}
|
|
254
|
-
` : ""}${stdoutData?.error?.detail ? `Detail: ${stdoutData?.error?.detail}
|
|
255
|
-
` : ""}`;
|
|
256
|
-
github.error(errorMessage);
|
|
257
|
-
return { success: false };
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
try {
|
|
262
|
-
const cwd = packageRoot;
|
|
263
|
-
const command = npmPublishCommandSegments.join(" ");
|
|
264
|
-
console.info(
|
|
265
|
-
`Running publish command "${command}" in current working directory: "${cwd}" `
|
|
266
|
-
);
|
|
267
|
-
const result = execSync(command, {
|
|
268
|
-
cwd,
|
|
269
|
-
env: {
|
|
270
|
-
NPM_ID_TOKEN: token,
|
|
271
|
-
...process.env,
|
|
272
|
-
FORCE_COLOR: "true"
|
|
273
|
-
},
|
|
274
|
-
maxBuffer: LARGE_BUFFER,
|
|
275
|
-
killSignal: "SIGTERM"
|
|
276
|
-
});
|
|
277
|
-
if (isDryRun) {
|
|
278
|
-
console.info(
|
|
279
|
-
`Would publish tag "${tag}" to ${registry}, but [dry-run] was set. ${result ? `
|
|
280
|
-
|
|
281
|
-
Execution response: ${result.toString()}` : ""}`
|
|
282
|
-
);
|
|
283
|
-
} else {
|
|
284
|
-
console.info(
|
|
285
|
-
`Published tag "${tag}" to ${registry}. ${result ? `
|
|
286
|
-
|
|
287
|
-
Execution response: ${result.toString()}` : ""}`
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
return { success: true };
|
|
291
|
-
} catch (err) {
|
|
292
|
-
try {
|
|
293
|
-
const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
|
|
294
|
-
const errorMessage = `An error occurred while publishing the npm package:
|
|
295
|
-
|
|
296
|
-
${stdoutData?.error?.summary ? `Summary: ${stdoutData?.error?.summary}${stdoutData?.error?.code ? ` (${stdoutData?.error?.code})` : ""}
|
|
297
|
-
` : ""}${stdoutData?.error?.detail ? `Detail: ${stdoutData?.error?.detail}
|
|
298
|
-
` : ""}`;
|
|
299
|
-
github.error(errorMessage);
|
|
300
|
-
return { success: false };
|
|
301
|
-
} catch (err2) {
|
|
302
|
-
const errorMessage = `Something unexpected went wrong when processing the npm publish output.
|
|
303
|
-
|
|
304
|
-
Error: ${JSON.stringify(
|
|
305
|
-
Buffer.isBuffer(err2) ? err2.toString() : err2,
|
|
306
|
-
null,
|
|
307
|
-
2
|
|
308
|
-
)}`;
|
|
309
|
-
github.error(errorMessage);
|
|
310
|
-
return { success: false };
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
export {
|
|
316
|
-
LARGE_BUFFER,
|
|
317
|
-
npmPublishExecutorFn
|
|
318
|
-
};
|