@storm-software/workspace-tools 1.296.81 → 1.296.84
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/config/base.json +13 -14
- package/config/recommended.json +17 -15
- package/dist/{chunk-SZWM7COV.js → chunk-3G7PNDZ5.js} +15 -2
- package/dist/chunk-5BGCA73V.mjs +39 -0
- package/dist/{chunk-3VIV3TF3.js → chunk-CSH4G6YP.js} +11 -5
- package/dist/{chunk-QC5ON3X4.mjs → chunk-DEHA5C77.mjs} +15 -2
- package/dist/{chunk-Q36BH543.mjs → chunk-E2PVUX2W.mjs} +25 -209
- package/dist/{chunk-YXDHTGAK.js → chunk-FETI3TYM.js} +47 -35
- package/dist/{chunk-2OB3TJFJ.mjs → chunk-FQ7VZ2JR.mjs} +1 -1
- package/dist/{chunk-C2QNKR3W.mjs → chunk-G35OKYMG.mjs} +1 -1
- package/dist/{chunk-TM2CRDJW.js → chunk-HN5UXNLM.js} +33 -12
- package/dist/{chunk-2UJDNCR7.mjs → chunk-HU2ZYTZL.mjs} +44 -32
- package/dist/{chunk-2F7AZHRH.js → chunk-ILSI74FW.js} +49 -20
- package/dist/chunk-KSEB2U7B.js +318 -0
- package/dist/{chunk-EHJC5RYU.mjs → chunk-M7W3EPWR.mjs} +2 -2
- package/dist/{chunk-323C3SE6.js → chunk-MYALGFOC.js} +3 -3
- package/dist/chunk-OGB3BDE5.js +39 -0
- package/dist/{chunk-77B77QNY.mjs → chunk-VQYZG5YE.mjs} +33 -12
- package/dist/{chunk-NNDVMJGY.mjs → chunk-WTASIX7S.mjs} +17 -15
- package/dist/{chunk-R4GXDUM2.mjs → chunk-WU2HALDD.mjs} +11 -5
- package/dist/{chunk-WCUI5X7P.js → chunk-WYV2VL6T.js} +17 -15
- package/dist/{chunk-NTTC774E.mjs → chunk-XSHN3XHD.mjs} +39 -10
- package/dist/{chunk-EEMND2GI.js → chunk-ZM4LIWD4.js} +3 -3
- package/dist/{chunk-2R2MHEOI.js → chunk-ZO6ZPXB7.js} +5 -5
- package/dist/executors.js +10 -9
- package/dist/executors.mjs +11 -10
- package/dist/generators.js +10 -9
- package/dist/generators.mjs +9 -8
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +54 -28
- package/dist/index.mjs +59 -33
- package/dist/src/base/index.js +3 -3
- package/dist/src/base/index.mjs +2 -2
- package/dist/src/executors/npm-publish/executor.js +3 -2
- package/dist/src/executors/npm-publish/executor.mjs +2 -1
- package/dist/src/generators/browser-library/generator.js +4 -4
- package/dist/src/generators/browser-library/generator.mjs +3 -3
- package/dist/src/generators/neutral-library/generator.js +4 -4
- package/dist/src/generators/neutral-library/generator.mjs +3 -3
- package/dist/src/generators/node-library/generator.js +4 -4
- package/dist/src/generators/node-library/generator.mjs +3 -3
- package/dist/src/generators/preset/generator.js +4 -3
- package/dist/src/generators/preset/generator.mjs +3 -2
- package/dist/src/plugins/rust/cargo-toml.js +6 -2
- package/dist/src/plugins/rust/cargo-toml.mjs +5 -1
- package/dist/src/plugins/rust/index.js +6 -2
- package/dist/src/plugins/rust/index.mjs +5 -1
- package/dist/src/plugins/typescript/index.js +19 -14
- package/dist/src/plugins/typescript/index.mjs +20 -15
- package/dist/src/plugins/typescript/tsdown.js +16 -11
- package/dist/src/plugins/typescript/tsdown.mjs +16 -11
- package/dist/src/plugins/typescript/tsup.js +16 -11
- package/dist/src/plugins/typescript/tsup.mjs +16 -11
- package/dist/src/plugins/typescript/untyped-schema.js +15 -7
- package/dist/src/plugins/typescript/untyped-schema.mjs +15 -7
- package/dist/src/utils/index.d.mts +4 -3
- package/dist/src/utils/index.d.ts +4 -3
- package/dist/src/utils/index.js +37 -10
- package/dist/src/utils/index.mjs +45 -18
- package/dist/src/utils/lock-file.d.mts +16 -4
- package/dist/src/utils/lock-file.d.ts +16 -4
- package/dist/src/utils/lock-file.js +12 -2
- package/dist/src/utils/lock-file.mjs +11 -1
- package/dist/src/utils/nx-json.js +2 -2
- package/dist/src/utils/nx-json.mjs +1 -1
- package/dist/src/utils/package-manager.d.mts +33 -0
- package/dist/src/utils/package-manager.d.ts +33 -0
- package/dist/src/utils/package-manager.js +14 -0
- package/dist/src/utils/package-manager.mjs +15 -0
- package/dist/src/utils/versions.d.mts +11 -2
- package/dist/src/utils/versions.d.ts +11 -2
- package/dist/src/utils/versions.js +10 -2
- package/dist/src/utils/versions.mjs +11 -3
- package/package.json +15 -10
- package/dist/chunk-F6U5OQR6.js +0 -502
- /package/dist/{chunk-DO2X7OZO.js → chunk-CVKUY5YY.js} +0 -0
- /package/dist/{chunk-XCVH63OO.mjs → chunk-QCN77EOQ.mjs} +0 -0
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.84",
|
|
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,10 +238,10 @@
|
|
|
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-tools": "^1.190.
|
|
242
|
-
"@storm-software/npm-tools": "^0.6.
|
|
243
|
-
"@storm-software/prettier": "^0.59.
|
|
244
|
-
"@storm-software/tsdown": "^0.45.
|
|
241
|
+
"@storm-software/config-tools": "^1.190.104",
|
|
242
|
+
"@storm-software/npm-tools": "^0.6.222",
|
|
243
|
+
"@storm-software/prettier": "^0.59.157",
|
|
244
|
+
"@storm-software/tsdown": "^0.45.265",
|
|
245
245
|
"fs-extra": "11.2.0",
|
|
246
246
|
"glob": "^11.1.0",
|
|
247
247
|
"jiti": "^2.7.0",
|
|
@@ -255,10 +255,11 @@
|
|
|
255
255
|
},
|
|
256
256
|
"devDependencies": {
|
|
257
257
|
"@napi-rs/cli": "^3.7.3",
|
|
258
|
-
"@storm-software/
|
|
259
|
-
"@storm-software/
|
|
260
|
-
"@storm-software/
|
|
261
|
-
"@storm-software/
|
|
258
|
+
"@storm-software/bun-tools": "^0.0.13",
|
|
259
|
+
"@storm-software/esbuild": "^0.53.265",
|
|
260
|
+
"@storm-software/package-constants": "^0.1.117",
|
|
261
|
+
"@storm-software/pnpm-tools": "^0.7.115",
|
|
262
|
+
"@storm-software/unbuild": "^0.57.265",
|
|
262
263
|
"@types/micromatch": "^4.0.10",
|
|
263
264
|
"@types/node": "^25.9.5",
|
|
264
265
|
"@types/semver": "^7.7.1",
|
|
@@ -271,7 +272,9 @@
|
|
|
271
272
|
},
|
|
272
273
|
"peerDependencies": {
|
|
273
274
|
"@napi-rs/cli": "^3.4.1",
|
|
275
|
+
"@storm-software/bun-tools": "*",
|
|
274
276
|
"@storm-software/esbuild": "*",
|
|
277
|
+
"@storm-software/pnpm-tools": "*",
|
|
275
278
|
"@storm-software/tsdown": "*",
|
|
276
279
|
"@storm-software/unbuild": "*",
|
|
277
280
|
"markdownlint-cli2": "^0.17.2",
|
|
@@ -280,7 +283,9 @@
|
|
|
280
283
|
},
|
|
281
284
|
"peerDependenciesMeta": {
|
|
282
285
|
"@napi-rs/cli": { "optional": true },
|
|
286
|
+
"@storm-software/bun-tools": { "optional": true },
|
|
283
287
|
"@storm-software/esbuild": { "optional": true },
|
|
288
|
+
"@storm-software/pnpm-tools": { "optional": true },
|
|
284
289
|
"@storm-software/tsdown": { "optional": true },
|
|
285
290
|
"@storm-software/unbuild": { "optional": true },
|
|
286
291
|
"markdownlint-cli2": { "optional": false },
|
|
@@ -290,5 +295,5 @@
|
|
|
290
295
|
"publishConfig": { "access": "public" },
|
|
291
296
|
"executors": "./executors.json",
|
|
292
297
|
"generators": "./generators.json",
|
|
293
|
-
"gitHead": "
|
|
298
|
+
"gitHead": "e9118ed4d0235c8643e71d0d8370987a2945f8d1"
|
|
294
299
|
}
|
package/dist/chunk-F6U5OQR6.js
DELETED
|
@@ -1,502 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunk4ARF5MP2js = require('./chunk-4ARF5MP2.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chunkGUI4USIOjs = require('./chunk-GUI4USIO.js');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkCQDBLKPFjs = require('./chunk-CQDBLKPF.js');
|
|
16
|
-
|
|
17
|
-
// ../npm-tools/src/helpers/get-version.ts
|
|
18
|
-
var _child_process = require('child_process');
|
|
19
|
-
var _semver = require('semver');
|
|
20
|
-
var _stripansi = require('strip-ansi'); var _stripansi2 = _interopRequireDefault(_stripansi);
|
|
21
|
-
|
|
22
|
-
// ../npm-tools/src/helpers/get-registry.ts
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// ../pnpm-tools/src/helpers/catalog.ts
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// ../pnpm-tools/src/helpers/pnpm-workspace.ts
|
|
29
|
-
var _fs = require('fs');
|
|
30
|
-
var _promises = require('fs/promises');
|
|
31
|
-
var _yaml = require('yaml');
|
|
32
|
-
function getPnpmWorkspaceFilePath(workspaceRoot = _chunkGUI4USIOjs.findWorkspaceRoot.call(void 0, process.cwd())) {
|
|
33
|
-
const pnpmWorkspacePath = _chunkCQDBLKPFjs.joinPaths.call(void 0, workspaceRoot, "pnpm-workspace.yaml");
|
|
34
|
-
if (!_fs.existsSync.call(void 0, pnpmWorkspacePath)) {
|
|
35
|
-
throw new Error(
|
|
36
|
-
`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${pnpmWorkspacePath}).`
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
return pnpmWorkspacePath;
|
|
40
|
-
}
|
|
41
|
-
async function readPnpmWorkspaceFile(workspaceRoot = _chunkGUI4USIOjs.findWorkspaceRoot.call(void 0, process.cwd())) {
|
|
42
|
-
const result = await _promises.readFile.call(void 0,
|
|
43
|
-
getPnpmWorkspaceFilePath(workspaceRoot),
|
|
44
|
-
"utf8"
|
|
45
|
-
);
|
|
46
|
-
if (!result) {
|
|
47
|
-
return void 0;
|
|
48
|
-
}
|
|
49
|
-
return _yaml.parse.call(void 0, result);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// ../pnpm-tools/src/helpers/catalog.ts
|
|
53
|
-
async function getCatalogSafe(workspaceRoot = _chunkGUI4USIOjs.findWorkspaceRoot.call(void 0, process.cwd())) {
|
|
54
|
-
const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
|
|
55
|
-
if (!pnpmWorkspaceFile) {
|
|
56
|
-
throw new Error("No pnpm-workspace.yaml file found");
|
|
57
|
-
}
|
|
58
|
-
if (_optionalChain([pnpmWorkspaceFile, 'optionalAccess', _ => _.catalog])) {
|
|
59
|
-
return Object.fromEntries(
|
|
60
|
-
Object.entries(pnpmWorkspaceFile.catalog).map(([key, value]) => {
|
|
61
|
-
return [key, value.replaceAll('"', "").replaceAll("'", "")];
|
|
62
|
-
})
|
|
63
|
-
);
|
|
64
|
-
} else {
|
|
65
|
-
console.warn(
|
|
66
|
-
`No catalog found in pnpm-workspace.yaml file located in workspace root: ${workspaceRoot}
|
|
67
|
-
File content: ${JSON.stringify(
|
|
68
|
-
pnpmWorkspaceFile,
|
|
69
|
-
null,
|
|
70
|
-
2
|
|
71
|
-
)}`
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
return void 0;
|
|
75
|
-
}
|
|
76
|
-
async function getCatalog(workspaceRoot = _chunkGUI4USIOjs.findWorkspaceRoot.call(void 0, process.cwd())) {
|
|
77
|
-
const catalog = await getCatalogSafe(workspaceRoot);
|
|
78
|
-
if (!catalog) {
|
|
79
|
-
throw new Error("No catalog entries found in pnpm-workspace.yaml file");
|
|
80
|
-
}
|
|
81
|
-
return catalog;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// ../pnpm-tools/src/helpers/replace-deps-aliases.ts
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var _devkit = require('@nx/devkit');
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var _prettier = require('prettier');
|
|
92
|
-
async function replaceDepsAliases(packageRoot = process.cwd(), workspaceRoot = _chunkGUI4USIOjs.findWorkspaceRoot.call(void 0, packageRoot)) {
|
|
93
|
-
const packageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, packageRoot, "package.json");
|
|
94
|
-
const packageJsonFile = await _promises.readFile.call(void 0, packageJsonPath, "utf8");
|
|
95
|
-
if (!packageJsonFile) {
|
|
96
|
-
throw new Error(
|
|
97
|
-
"No package.json file found in package root: " + packageRoot
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
const catalog = await getCatalog(workspaceRoot);
|
|
101
|
-
const packageJson = JSON.parse(packageJsonFile);
|
|
102
|
-
const pnpmWorkspacePath = _chunkCQDBLKPFjs.joinPaths.call(void 0, workspaceRoot, "pnpm-workspace.yaml");
|
|
103
|
-
if (!_fs.existsSync.call(void 0, pnpmWorkspacePath)) {
|
|
104
|
-
console.warn(
|
|
105
|
-
`No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${pnpmWorkspacePath}). Skipping pnpm catalog read for now.`
|
|
106
|
-
);
|
|
107
|
-
return packageJson;
|
|
108
|
-
}
|
|
109
|
-
if (!catalog) {
|
|
110
|
-
console.warn(
|
|
111
|
-
`No pnpm catalog found. Skipping dependencies replacement for now.`
|
|
112
|
-
);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
for (const dependencyType of [
|
|
116
|
-
"dependencies",
|
|
117
|
-
"devDependencies",
|
|
118
|
-
"peerDependencies"
|
|
119
|
-
]) {
|
|
120
|
-
const dependencies = packageJson[dependencyType];
|
|
121
|
-
if (!dependencies) {
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
for (const dependencyName of Object.keys(dependencies)) {
|
|
125
|
-
if (dependencies[dependencyName] === "catalog:") {
|
|
126
|
-
if (!catalog) {
|
|
127
|
-
throw new Error(
|
|
128
|
-
`Dependency ${dependencyName} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`pnpm-workspace.yaml\` file.`
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
const catalogVersion = catalog[dependencyName];
|
|
132
|
-
if (!catalogVersion) {
|
|
133
|
-
throw new Error("Missing pnpm catalog version for " + dependencyName);
|
|
134
|
-
}
|
|
135
|
-
dependencies[dependencyName] = catalogVersion;
|
|
136
|
-
} else if (dependencies[dependencyName].startsWith("catalog:")) {
|
|
137
|
-
throw new Error("multiple named catalogs not supported");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
let projectGraph;
|
|
142
|
-
try {
|
|
143
|
-
projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
144
|
-
} catch (e) {
|
|
145
|
-
await _devkit.createProjectGraphAsync.call(void 0, );
|
|
146
|
-
projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
147
|
-
}
|
|
148
|
-
const workspacePackages = {};
|
|
149
|
-
if (projectGraph) {
|
|
150
|
-
await Promise.all(
|
|
151
|
-
Object.keys(projectGraph.nodes).map(async (node) => {
|
|
152
|
-
const projectNode = projectGraph.nodes[node];
|
|
153
|
-
if (_optionalChain([projectNode, 'optionalAccess', _2 => _2.data, 'access', _3 => _3.root])) {
|
|
154
|
-
const projectPackageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0,
|
|
155
|
-
workspaceRoot,
|
|
156
|
-
projectNode.data.root,
|
|
157
|
-
"package.json"
|
|
158
|
-
);
|
|
159
|
-
if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
|
|
160
|
-
const projectPackageJsonContent = await _promises.readFile.call(void 0,
|
|
161
|
-
projectPackageJsonPath,
|
|
162
|
-
"utf8"
|
|
163
|
-
);
|
|
164
|
-
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
165
|
-
if (projectPackageJson.private !== true) {
|
|
166
|
-
workspacePackages[projectPackageJson.name] = projectPackageJson.version;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
for (const dependencyType of [
|
|
174
|
-
"dependencies",
|
|
175
|
-
"devDependencies",
|
|
176
|
-
"peerDependencies"
|
|
177
|
-
]) {
|
|
178
|
-
const dependencies = packageJson[dependencyType];
|
|
179
|
-
if (!dependencies) {
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
for (const dependencyName of Object.keys(dependencies)) {
|
|
183
|
-
if (dependencies[dependencyName].startsWith("workspace:")) {
|
|
184
|
-
if (workspacePackages[dependencyName]) {
|
|
185
|
-
dependencies[dependencyName] = `^${workspacePackages[dependencyName]}`;
|
|
186
|
-
} else {
|
|
187
|
-
throw new Error(
|
|
188
|
-
`Workspace dependency ${dependencyName} not found in workspace packages.`
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return _promises.writeFile.call(void 0,
|
|
195
|
-
packageJsonPath,
|
|
196
|
-
await _prettier.format.call(void 0, JSON.stringify(packageJson), {
|
|
197
|
-
parser: "json",
|
|
198
|
-
proseWrap: "preserve",
|
|
199
|
-
trailingComma: "none",
|
|
200
|
-
tabWidth: 2,
|
|
201
|
-
semi: true,
|
|
202
|
-
singleQuote: false,
|
|
203
|
-
quoteProps: "as-needed",
|
|
204
|
-
insertPragma: false,
|
|
205
|
-
bracketSameLine: true,
|
|
206
|
-
printWidth: 80,
|
|
207
|
-
bracketSpacing: true,
|
|
208
|
-
arrowParens: "avoid",
|
|
209
|
-
endOfLine: "lf",
|
|
210
|
-
plugins: ["prettier-plugin-packagejson"]
|
|
211
|
-
})
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// src/executors/npm-publish/executor.ts
|
|
216
|
-
var _jiti = require('jiti');
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
var LARGE_BUFFER = 1024 * 1e6;
|
|
221
|
-
async function npmPublishExecutorFn(options, context) {
|
|
222
|
-
const workspaceConfig = await _chunk4ARF5MP2js.getConfig.call(void 0, context.root);
|
|
223
|
-
const github = await _chunkMKJITWLNjs.getGitHubTools.call(void 0, workspaceConfig);
|
|
224
|
-
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
225
|
-
if (!context.projectName) {
|
|
226
|
-
github.error("The `npm-publish` executor requires a `projectName`.");
|
|
227
|
-
return { success: false };
|
|
228
|
-
}
|
|
229
|
-
const projectConfig = _optionalChain([context, 'access', _4 => _4.projectsConfigurations, 'optionalAccess', _5 => _5.projects, 'optionalAccess', _6 => _6[context.projectName]]);
|
|
230
|
-
if (!projectConfig) {
|
|
231
|
-
github.error(
|
|
232
|
-
`Could not find project configuration for \`${context.projectName}\``
|
|
233
|
-
);
|
|
234
|
-
return { success: false };
|
|
235
|
-
}
|
|
236
|
-
const packageRoot = _chunkCQDBLKPFjs.joinPaths.call(void 0,
|
|
237
|
-
context.root,
|
|
238
|
-
options.packageRoot || _chunkCQDBLKPFjs.joinPaths.call(void 0, "dist", projectConfig.root)
|
|
239
|
-
);
|
|
240
|
-
const projectRoot = _optionalChain([context, 'access', _7 => _7.projectsConfigurations, 'access', _8 => _8.projects, 'access', _9 => _9[context.projectName], 'optionalAccess', _10 => _10.root]) ? _chunkCQDBLKPFjs.joinPaths.call(void 0,
|
|
241
|
-
context.root,
|
|
242
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
243
|
-
context.projectsConfigurations.projects[context.projectName].root
|
|
244
|
-
) : packageRoot;
|
|
245
|
-
const jiti = _jiti.createJiti.call(void 0, context.root, {
|
|
246
|
-
fsCache: _chunkCQDBLKPFjs.joinPaths.call(void 0, context.root, "node_modules/.cache/storm", "jiti"),
|
|
247
|
-
interopDefault: true
|
|
248
|
-
});
|
|
249
|
-
const { getNpmRegistry, getRegistry: getRegistry2 } = await jiti.import(jiti.esmResolve("@storm-software/npm-tools/helpers"));
|
|
250
|
-
const packageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, packageRoot, "package.json");
|
|
251
|
-
const packageJsonFile = await _promises.readFile.call(void 0, packageJsonPath, "utf8");
|
|
252
|
-
if (!packageJsonFile) {
|
|
253
|
-
github.error(`Could not find \`package.json\` at ${packageJsonPath}`);
|
|
254
|
-
return { success: false };
|
|
255
|
-
}
|
|
256
|
-
const packageJson = JSON.parse(packageJsonFile);
|
|
257
|
-
const projectPackageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, projectRoot, "package.json");
|
|
258
|
-
const projectPackageJsonFile = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
|
|
259
|
-
if (!projectPackageJsonFile) {
|
|
260
|
-
github.error(
|
|
261
|
-
`Could not find \`package.json\` at ${projectPackageJsonPath}`
|
|
262
|
-
);
|
|
263
|
-
return { success: false };
|
|
264
|
-
}
|
|
265
|
-
const projectPackageJson = JSON.parse(projectPackageJsonFile);
|
|
266
|
-
if (packageJson.version !== projectPackageJson.version) {
|
|
267
|
-
console.warn(
|
|
268
|
-
`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.`
|
|
269
|
-
);
|
|
270
|
-
if (projectPackageJson.version) {
|
|
271
|
-
packageJson.version = projectPackageJson.version;
|
|
272
|
-
await _promises.writeFile.call(void 0,
|
|
273
|
-
packageJsonPath,
|
|
274
|
-
await _prettier.format.call(void 0, JSON.stringify(packageJson), {
|
|
275
|
-
parser: "json",
|
|
276
|
-
proseWrap: "preserve",
|
|
277
|
-
trailingComma: "none",
|
|
278
|
-
tabWidth: 2,
|
|
279
|
-
semi: true,
|
|
280
|
-
singleQuote: false,
|
|
281
|
-
quoteProps: "as-needed",
|
|
282
|
-
insertPragma: false,
|
|
283
|
-
bracketSameLine: true,
|
|
284
|
-
printWidth: 80,
|
|
285
|
-
bracketSpacing: true,
|
|
286
|
-
arrowParens: "avoid",
|
|
287
|
-
endOfLine: "lf",
|
|
288
|
-
plugins: ["prettier-plugin-packagejson"]
|
|
289
|
-
})
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
const packageName = packageJson.name;
|
|
294
|
-
console.info(
|
|
295
|
-
`\u{1F680} Running Storm NPM Publish executor on the ${packageName} package`
|
|
296
|
-
);
|
|
297
|
-
const packageTxt = packageName === context.projectName ? `package "${packageName}"` : `package "${packageName}" from project "${context.projectName}"`;
|
|
298
|
-
if (packageJson.private === true) {
|
|
299
|
-
console.warn(
|
|
300
|
-
`Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`
|
|
301
|
-
);
|
|
302
|
-
return { success: true };
|
|
303
|
-
}
|
|
304
|
-
await replaceDepsAliases(packageRoot, context.root);
|
|
305
|
-
await _chunk46OIJVV3js.addPackageJsonGitHead.call(void 0, packageRoot);
|
|
306
|
-
const npmPublishCommandSegments = [`npm publish --json`];
|
|
307
|
-
const npmViewCommandSegments = [
|
|
308
|
-
`npm view ${packageName} versions dist-tags --json`
|
|
309
|
-
];
|
|
310
|
-
const registry = await Promise.resolve(
|
|
311
|
-
await _asyncNullishCoalesce(options.registry, async () => ( (await getRegistry2() || getNpmRegistry())))
|
|
312
|
-
);
|
|
313
|
-
if (registry) {
|
|
314
|
-
npmPublishCommandSegments.push(`--registry="${registry}" `);
|
|
315
|
-
npmViewCommandSegments.push(`--registry="${registry}" `);
|
|
316
|
-
}
|
|
317
|
-
if (options.otp) {
|
|
318
|
-
npmPublishCommandSegments.push(`--otp="${options.otp}" `);
|
|
319
|
-
}
|
|
320
|
-
let token;
|
|
321
|
-
if (!options.otp && registry) {
|
|
322
|
-
token = await github.getIDToken(
|
|
323
|
-
`npm:${registry.replace(/^https?:\/\//, "")}`
|
|
324
|
-
);
|
|
325
|
-
if (!token) {
|
|
326
|
-
github.warning(
|
|
327
|
-
`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.`
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
npmPublishCommandSegments.push("--provenance --access=public ");
|
|
332
|
-
if (isDryRun) {
|
|
333
|
-
npmPublishCommandSegments.push("--dry-run");
|
|
334
|
-
}
|
|
335
|
-
const tag = options.tag || _child_process.execSync.call(void 0, "npm config get tag", {
|
|
336
|
-
cwd: packageRoot,
|
|
337
|
-
env: {
|
|
338
|
-
NPM_ID_TOKEN: token,
|
|
339
|
-
...process.env,
|
|
340
|
-
FORCE_COLOR: "true"
|
|
341
|
-
},
|
|
342
|
-
maxBuffer: LARGE_BUFFER,
|
|
343
|
-
killSignal: "SIGTERM"
|
|
344
|
-
}).toString().trim();
|
|
345
|
-
if (tag) {
|
|
346
|
-
npmPublishCommandSegments.push(`--tag="${tag}" `);
|
|
347
|
-
}
|
|
348
|
-
if (!isDryRun) {
|
|
349
|
-
const currentVersion = options.version || packageJson.version;
|
|
350
|
-
try {
|
|
351
|
-
try {
|
|
352
|
-
const result = _child_process.execSync.call(void 0, npmViewCommandSegments.join(" "), {
|
|
353
|
-
cwd: packageRoot,
|
|
354
|
-
env: {
|
|
355
|
-
NPM_ID_TOKEN: token,
|
|
356
|
-
...process.env,
|
|
357
|
-
FORCE_COLOR: "true"
|
|
358
|
-
},
|
|
359
|
-
maxBuffer: LARGE_BUFFER,
|
|
360
|
-
killSignal: "SIGTERM"
|
|
361
|
-
});
|
|
362
|
-
const resultJson = JSON.parse(result.toString());
|
|
363
|
-
const distTags = resultJson["dist-tags"] || {};
|
|
364
|
-
if (distTags[tag] === currentVersion) {
|
|
365
|
-
console.warn(
|
|
366
|
-
`Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`
|
|
367
|
-
);
|
|
368
|
-
return { success: true };
|
|
369
|
-
}
|
|
370
|
-
} catch (err) {
|
|
371
|
-
console.debug(
|
|
372
|
-
`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.
|
|
373
|
-
|
|
374
|
-
Error: ${JSON.stringify(
|
|
375
|
-
err,
|
|
376
|
-
null,
|
|
377
|
-
2
|
|
378
|
-
)}`
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
try {
|
|
382
|
-
if (!isDryRun) {
|
|
383
|
-
const command = `npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry="${registry}" `;
|
|
384
|
-
console.debug(
|
|
385
|
-
`Adding the dist-tag ${tag} - preparing to run the following: ${command}`
|
|
386
|
-
);
|
|
387
|
-
const result = _child_process.execSync.call(void 0, command, {
|
|
388
|
-
cwd: packageRoot,
|
|
389
|
-
env: {
|
|
390
|
-
NPM_ID_TOKEN: token,
|
|
391
|
-
...process.env,
|
|
392
|
-
FORCE_COLOR: "true"
|
|
393
|
-
},
|
|
394
|
-
maxBuffer: LARGE_BUFFER,
|
|
395
|
-
killSignal: "SIGTERM"
|
|
396
|
-
});
|
|
397
|
-
console.info(
|
|
398
|
-
`Added the dist-tag ${tag} to v${currentVersion} for registry "${registry}".
|
|
399
|
-
|
|
400
|
-
Execution response: ${result.toString()}`
|
|
401
|
-
);
|
|
402
|
-
} else {
|
|
403
|
-
console.info(
|
|
404
|
-
`Would have added the dist-tag ${tag} to v${currentVersion} for registry "${registry}", but [dry-run] was set.
|
|
405
|
-
`
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
return { success: true };
|
|
409
|
-
} catch (err) {
|
|
410
|
-
try {
|
|
411
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access', _11 => _11.stdout, 'optionalAccess', _12 => _12.toString, 'call', _13 => _13()]) || "{}");
|
|
412
|
-
if (_optionalChain([stdoutData, 'optionalAccess', _14 => _14.error]) && !(_optionalChain([stdoutData, 'access', _15 => _15.error, 'optionalAccess', _16 => _16.code, 'optionalAccess', _17 => _17.includes, 'call', _18 => _18("E404")]) && _optionalChain([stdoutData, 'access', _19 => _19.error, 'optionalAccess', _20 => _20.summary, 'optionalAccess', _21 => _21.includes, 'call', _22 => _22("no such package available")])) && !(_optionalChain([err, 'access', _23 => _23.stderr, 'optionalAccess', _24 => _24.toString, 'call', _25 => _25(), 'access', _26 => _26.includes, 'call', _27 => _27("E404")]) && _optionalChain([err, 'access', _28 => _28.stderr, 'optionalAccess', _29 => _29.toString, 'call', _30 => _30(), 'access', _31 => _31.includes, 'call', _32 => _32("no such package available")]))) {
|
|
413
|
-
const errorMessage = `An unexpected error occured while running the npm dist-tag add command:
|
|
414
|
-
|
|
415
|
-
${_optionalChain([stdoutData, 'optionalAccess', _33 => _33.error, 'optionalAccess', _34 => _34.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _35 => _35.error, 'optionalAccess', _36 => _36.summary])}${_optionalChain([stdoutData, 'optionalAccess', _37 => _37.error, 'optionalAccess', _38 => _38.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _39 => _39.error, 'optionalAccess', _40 => _40.code])})` : ""}
|
|
416
|
-
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _41 => _41.error, 'optionalAccess', _42 => _42.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _43 => _43.error, 'optionalAccess', _44 => _44.detail])}
|
|
417
|
-
` : ""}`;
|
|
418
|
-
github.error(errorMessage);
|
|
419
|
-
return { success: false };
|
|
420
|
-
}
|
|
421
|
-
} catch (err2) {
|
|
422
|
-
const stdoutData = JSON.parse(_optionalChain([err2, 'access', _45 => _45.stdout, 'optionalAccess', _46 => _46.toString, 'call', _47 => _47()]) || "{}");
|
|
423
|
-
const errorMessage = `An unexpected error occured while processing the npm dist-tag add output:
|
|
424
|
-
|
|
425
|
-
${_optionalChain([stdoutData, 'optionalAccess', _48 => _48.error, 'optionalAccess', _49 => _49.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _50 => _50.error, 'optionalAccess', _51 => _51.summary])}${_optionalChain([stdoutData, 'optionalAccess', _52 => _52.error, 'optionalAccess', _53 => _53.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _54 => _54.error, 'optionalAccess', _55 => _55.code])})` : ""}
|
|
426
|
-
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _56 => _56.error, 'optionalAccess', _57 => _57.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _58 => _58.error, 'optionalAccess', _59 => _59.detail])}
|
|
427
|
-
` : ""}`;
|
|
428
|
-
github.error(errorMessage);
|
|
429
|
-
return { success: false };
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
} catch (err) {
|
|
433
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access', _60 => _60.stdout, 'optionalAccess', _61 => _61.toString, 'call', _62 => _62()]) || "{}");
|
|
434
|
-
if (!(_optionalChain([stdoutData, 'access', _63 => _63.error, 'optionalAccess', _64 => _64.code, 'optionalAccess', _65 => _65.includes, 'call', _66 => _66("E404")]) && _optionalChain([stdoutData, 'access', _67 => _67.error, 'optionalAccess', _68 => _68.summary, 'optionalAccess', _69 => _69.toLowerCase, 'call', _70 => _70(), 'access', _71 => _71.includes, 'call', _72 => _72("not found")])) && !(_optionalChain([err, 'access', _73 => _73.stderr, 'optionalAccess', _74 => _74.toString, 'call', _75 => _75(), 'access', _76 => _76.includes, 'call', _77 => _77("E404")]) && _optionalChain([err, 'access', _78 => _78.stderr, 'optionalAccess', _79 => _79.toString, 'call', _80 => _80(), 'access', _81 => _81.toLowerCase, 'call', _82 => _82(), 'access', _83 => _83.includes, 'call', _84 => _84("not found")]))) {
|
|
435
|
-
const errorMessage = `An unexpected error occured while checking for existing dist-tags:
|
|
436
|
-
|
|
437
|
-
${_optionalChain([stdoutData, 'optionalAccess', _85 => _85.error, 'optionalAccess', _86 => _86.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _87 => _87.error, 'optionalAccess', _88 => _88.summary])}${_optionalChain([stdoutData, 'optionalAccess', _89 => _89.error, 'optionalAccess', _90 => _90.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _91 => _91.error, 'optionalAccess', _92 => _92.code])})` : ""}
|
|
438
|
-
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _93 => _93.error, 'optionalAccess', _94 => _94.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _95 => _95.error, 'optionalAccess', _96 => _96.detail])}
|
|
439
|
-
` : ""}`;
|
|
440
|
-
github.error(errorMessage);
|
|
441
|
-
return { success: false };
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
try {
|
|
446
|
-
const cwd = packageRoot;
|
|
447
|
-
const command = npmPublishCommandSegments.join(" ");
|
|
448
|
-
console.info(
|
|
449
|
-
`Running publish command "${command}" in current working directory: "${cwd}" `
|
|
450
|
-
);
|
|
451
|
-
const result = _child_process.execSync.call(void 0, command, {
|
|
452
|
-
cwd,
|
|
453
|
-
env: {
|
|
454
|
-
NPM_ID_TOKEN: token,
|
|
455
|
-
...process.env,
|
|
456
|
-
FORCE_COLOR: "true"
|
|
457
|
-
},
|
|
458
|
-
maxBuffer: LARGE_BUFFER,
|
|
459
|
-
killSignal: "SIGTERM"
|
|
460
|
-
});
|
|
461
|
-
if (isDryRun) {
|
|
462
|
-
console.info(
|
|
463
|
-
`Would publish tag "${tag}" to ${registry}, but [dry-run] was set. ${result ? `
|
|
464
|
-
|
|
465
|
-
Execution response: ${result.toString()}` : ""}`
|
|
466
|
-
);
|
|
467
|
-
} else {
|
|
468
|
-
console.info(
|
|
469
|
-
`Published tag "${tag}" to ${registry}. ${result ? `
|
|
470
|
-
|
|
471
|
-
Execution response: ${result.toString()}` : ""}`
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
|
-
return { success: true };
|
|
475
|
-
} catch (err) {
|
|
476
|
-
try {
|
|
477
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access', _97 => _97.stdout, 'optionalAccess', _98 => _98.toString, 'call', _99 => _99()]) || "{}");
|
|
478
|
-
const errorMessage = `An error occurred while publishing the npm package:
|
|
479
|
-
|
|
480
|
-
${_optionalChain([stdoutData, 'optionalAccess', _100 => _100.error, 'optionalAccess', _101 => _101.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _102 => _102.error, 'optionalAccess', _103 => _103.summary])}${_optionalChain([stdoutData, 'optionalAccess', _104 => _104.error, 'optionalAccess', _105 => _105.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _106 => _106.error, 'optionalAccess', _107 => _107.code])})` : ""}
|
|
481
|
-
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _108 => _108.error, 'optionalAccess', _109 => _109.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _110 => _110.error, 'optionalAccess', _111 => _111.detail])}
|
|
482
|
-
` : ""}`;
|
|
483
|
-
github.error(errorMessage);
|
|
484
|
-
return { success: false };
|
|
485
|
-
} catch (err2) {
|
|
486
|
-
const errorMessage = `Something unexpected went wrong when processing the npm publish output.
|
|
487
|
-
|
|
488
|
-
Error: ${JSON.stringify(
|
|
489
|
-
Buffer.isBuffer(err2) ? err2.toString() : err2,
|
|
490
|
-
null,
|
|
491
|
-
2
|
|
492
|
-
)}`;
|
|
493
|
-
github.error(errorMessage);
|
|
494
|
-
return { success: false };
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
exports.LARGE_BUFFER = LARGE_BUFFER; exports.npmPublishExecutorFn = npmPublishExecutorFn;
|
|
File without changes
|
|
File without changes
|