@storm-software/workspace-tools 1.285.0 → 1.287.0
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/CHANGELOG.md +32 -0
- package/README.md +1 -2
- package/dist/{chunk-D26STI4S.mjs → chunk-5K5OGRSL.mjs} +178 -18
- package/dist/{chunk-BZTR7YL6.js → chunk-5X2P7IL3.js} +183 -23
- package/dist/chunk-DA53ZKBY.js +73 -0
- package/dist/chunk-M7ZPKNJT.mjs +73 -0
- package/dist/{chunk-G77OCEMB.js → chunk-Q27SXGNA.js} +79 -109
- package/dist/{chunk-3G7XO5ON.mjs → chunk-YTQNRG2E.mjs} +69 -99
- package/dist/executors.js +3 -3
- package/dist/executors.mjs +2 -2
- package/dist/generators.js +3 -2
- package/dist/generators.mjs +2 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +5 -8
- package/dist/index.mjs +4 -7
- package/dist/src/executors/npm-publish/executor.js +5 -3
- package/dist/src/executors/npm-publish/executor.mjs +4 -2
- package/dist/src/generators/release-version/generator.js +3 -2
- package/dist/src/generators/release-version/generator.mjs +2 -1
- package/dist/src/utils/index.d.mts +0 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.js +2 -6
- package/dist/src/utils/index.mjs +1 -5
- package/package.json +22 -23
- package/dist/chunk-F6X43VUX.js +0 -163
- package/dist/chunk-KHT5W6AJ.mjs +0 -163
- package/dist/src/utils/pnpm-deps-update.d.mts +0 -9
- package/dist/src/utils/pnpm-deps-update.d.ts +0 -9
- package/dist/src/utils/pnpm-deps-update.js +0 -7
- package/dist/src/utils/pnpm-deps-update.mjs +0 -8
- /package/dist/{chunk-XCVH63OO.mjs → chunk-6YZ3OUJB.mjs} +0 -0
- /package/dist/{chunk-DO2X7OZO.js → chunk-JGP4YWZY.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Storm Ops - Workspace Tools
|
|
4
4
|
|
|
5
|
+
## [1.286.0](https://github.com/storm-software/storm-ops/releases/tag/workspace-tools%401.286.0) (2025-09-13)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- **npm-tools:** Initial check-in of the npm utility tools package
|
|
10
|
+
([caf8e3fd4](https://github.com/storm-software/storm-ops/commit/caf8e3fd4))
|
|
11
|
+
|
|
12
|
+
### Updated Dependencies
|
|
13
|
+
|
|
14
|
+
- Updated npm-tools to 0.1.0
|
|
15
|
+
|
|
16
|
+
## [1.285.0](https://github.com/storm-software/storm-ops/releases/tag/workspace-tools%401.285.0) (2025-09-13)
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
- **eslint:** Update `eslint-plugin-tsdoc` patch to allow local custom config
|
|
21
|
+
files
|
|
22
|
+
([57257ac47](https://github.com/storm-software/storm-ops/commit/57257ac47))
|
|
23
|
+
|
|
24
|
+
### Miscellaneous
|
|
25
|
+
|
|
26
|
+
- **monorepo:** Update workspace package links
|
|
27
|
+
([762d49e0e](https://github.com/storm-software/storm-ops/commit/762d49e0e))
|
|
28
|
+
- **monorepo:** Regenerate README markdown files
|
|
29
|
+
([5a5124fd7](https://github.com/storm-software/storm-ops/commit/5a5124fd7))
|
|
30
|
+
|
|
31
|
+
### Updated Dependencies
|
|
32
|
+
|
|
33
|
+
- Updated prettier to 0.54.0
|
|
34
|
+
- Updated esbuild to 0.49.0
|
|
35
|
+
- Updated unbuild to 0.53.0
|
|
36
|
+
|
|
5
37
|
## [1.284.0](https://github.com/storm-software/storm-ops/releases/tag/workspace-tools%401.284.0) (2025-09-13)
|
|
6
38
|
|
|
7
39
|
### Features
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
23
23
|
|
|
24
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
|
@@ -40,7 +40,6 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
40
40
|
|
|
41
41
|
<!-- START doctoc -->
|
|
42
42
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
43
|
-
|
|
44
43
|
## Table of Contents
|
|
45
44
|
|
|
46
45
|
- [Storm Workspace Tools](#storm-workspace-tools)
|
|
@@ -2,16 +2,184 @@ import {
|
|
|
2
2
|
addPackageJsonGitHead
|
|
3
3
|
} from "./chunk-PIK7KYVE.mjs";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
getNpmRegistry,
|
|
6
|
+
getRegistry
|
|
7
|
+
} from "./chunk-M7ZPKNJT.mjs";
|
|
8
|
+
import {
|
|
9
|
+
findWorkspaceRoot
|
|
10
|
+
} from "./chunk-M5Z57CUO.mjs";
|
|
7
11
|
import {
|
|
8
12
|
joinPaths
|
|
9
13
|
} from "./chunk-U7JFVMCK.mjs";
|
|
10
14
|
|
|
15
|
+
// ../pnpm-tools/src/helpers/replace-deps-aliases.ts
|
|
16
|
+
import {
|
|
17
|
+
createProjectGraphAsync,
|
|
18
|
+
readCachedProjectGraph
|
|
19
|
+
} from "@nx/devkit";
|
|
20
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
21
|
+
import { readFile, writeFile as writeFile2 } from "node:fs/promises";
|
|
22
|
+
import { format } from "prettier";
|
|
23
|
+
|
|
24
|
+
// ../pnpm-tools/src/helpers/catalog.ts
|
|
25
|
+
import { coerce, gt, valid } from "semver";
|
|
26
|
+
|
|
27
|
+
// ../pnpm-tools/src/helpers/pnpm-workspace.ts
|
|
28
|
+
import { dump, load } from "js-yaml";
|
|
29
|
+
import { existsSync } from "node:fs";
|
|
30
|
+
import { writeFile } from "node:fs/promises";
|
|
31
|
+
async function readPnpmWorkspaceFile(workspaceRoot = findWorkspaceRoot(process.cwd())) {
|
|
32
|
+
const pnpmWorkspacePath = joinPaths(workspaceRoot, "pnpm-workspace.yaml");
|
|
33
|
+
if (!existsSync(pnpmWorkspacePath)) {
|
|
34
|
+
console.warn(
|
|
35
|
+
`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${pnpmWorkspacePath}).`
|
|
36
|
+
);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
return load(pnpmWorkspacePath);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ../pnpm-tools/src/helpers/catalog.ts
|
|
43
|
+
async function getCatalog(workspaceRoot = findWorkspaceRoot(process.cwd())) {
|
|
44
|
+
const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
|
|
45
|
+
if (pnpmWorkspaceFile?.catalog) {
|
|
46
|
+
return Object.fromEntries(
|
|
47
|
+
Object.entries(pnpmWorkspaceFile.catalog).map(([key, value]) => {
|
|
48
|
+
return [key, value.replaceAll(/^"/g, "").replaceAll(/"$/g, "")];
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ../pnpm-tools/src/helpers/replace-deps-aliases.ts
|
|
56
|
+
async function replaceDepsAliases(packageRoot = process.cwd(), workspaceRoot = findWorkspaceRoot(packageRoot)) {
|
|
57
|
+
const packageJsonPath = joinPaths(packageRoot, "package.json");
|
|
58
|
+
const packageJsonFile = await readFile(packageJsonPath, "utf8");
|
|
59
|
+
if (!packageJsonFile) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
"No package.json file found in package root: " + packageRoot
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
const catalog = await getCatalog(workspaceRoot);
|
|
65
|
+
const packageJson = JSON.parse(packageJsonFile);
|
|
66
|
+
const pnpmWorkspacePath = joinPaths(workspaceRoot, "pnpm-workspace.yaml");
|
|
67
|
+
if (!existsSync2(pnpmWorkspacePath)) {
|
|
68
|
+
console.warn(
|
|
69
|
+
`No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${pnpmWorkspacePath}). Skipping pnpm catalog read for now.`
|
|
70
|
+
);
|
|
71
|
+
return packageJson;
|
|
72
|
+
}
|
|
73
|
+
if (!catalog) {
|
|
74
|
+
console.warn(
|
|
75
|
+
`No pnpm catalog found. Skipping dependencies replacement for now.`
|
|
76
|
+
);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
for (const dependencyType of [
|
|
80
|
+
"dependencies",
|
|
81
|
+
"devDependencies",
|
|
82
|
+
"peerDependencies"
|
|
83
|
+
]) {
|
|
84
|
+
const dependencies = packageJson[dependencyType];
|
|
85
|
+
if (!dependencies) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
for (const dependencyName of Object.keys(dependencies)) {
|
|
89
|
+
if (dependencies[dependencyName] === "catalog:") {
|
|
90
|
+
if (!catalog) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`Dependency ${dependencyName} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`pnpm-workspace.yaml\` file.`
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
const catalogVersion = catalog[dependencyName];
|
|
96
|
+
if (!catalogVersion) {
|
|
97
|
+
throw new Error("Missing pnpm catalog version for " + dependencyName);
|
|
98
|
+
}
|
|
99
|
+
dependencies[dependencyName] = catalogVersion;
|
|
100
|
+
} else if (dependencies[dependencyName].startsWith("catalog:")) {
|
|
101
|
+
throw new Error("multiple named catalogs not supported");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
let projectGraph;
|
|
106
|
+
try {
|
|
107
|
+
projectGraph = readCachedProjectGraph();
|
|
108
|
+
} catch {
|
|
109
|
+
await createProjectGraphAsync();
|
|
110
|
+
projectGraph = readCachedProjectGraph();
|
|
111
|
+
}
|
|
112
|
+
const workspacePackages = {};
|
|
113
|
+
if (projectGraph) {
|
|
114
|
+
await Promise.all(
|
|
115
|
+
Object.keys(projectGraph.nodes).map(async (node) => {
|
|
116
|
+
const projectNode = projectGraph.nodes[node];
|
|
117
|
+
if (projectNode?.data.root) {
|
|
118
|
+
const projectPackageJsonPath = joinPaths(
|
|
119
|
+
workspaceRoot,
|
|
120
|
+
projectNode.data.root,
|
|
121
|
+
"package.json"
|
|
122
|
+
);
|
|
123
|
+
if (existsSync2(projectPackageJsonPath)) {
|
|
124
|
+
const projectPackageJsonContent = await readFile(
|
|
125
|
+
projectPackageJsonPath,
|
|
126
|
+
"utf8"
|
|
127
|
+
);
|
|
128
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
129
|
+
if (projectPackageJson.private !== true) {
|
|
130
|
+
workspacePackages[projectPackageJson.name] = projectPackageJson.version;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
for (const dependencyType of [
|
|
138
|
+
"dependencies",
|
|
139
|
+
"devDependencies",
|
|
140
|
+
"peerDependencies"
|
|
141
|
+
]) {
|
|
142
|
+
const dependencies = packageJson[dependencyType];
|
|
143
|
+
if (!dependencies) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
for (const dependencyName of Object.keys(dependencies)) {
|
|
147
|
+
if (dependencies[dependencyName].startsWith("workspace:")) {
|
|
148
|
+
if (workspacePackages[dependencyName]) {
|
|
149
|
+
dependencies[dependencyName] = `^${workspacePackages[dependencyName]}`;
|
|
150
|
+
} else {
|
|
151
|
+
throw new Error(
|
|
152
|
+
`Workspace dependency ${dependencyName} not found in workspace packages.`
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return writeFile2(
|
|
159
|
+
packageJsonPath,
|
|
160
|
+
await format(JSON.stringify(packageJson), {
|
|
161
|
+
parser: "json",
|
|
162
|
+
proseWrap: "always",
|
|
163
|
+
trailingComma: "none",
|
|
164
|
+
tabWidth: 2,
|
|
165
|
+
semi: true,
|
|
166
|
+
singleQuote: false,
|
|
167
|
+
quoteProps: "as-needed",
|
|
168
|
+
insertPragma: false,
|
|
169
|
+
bracketSameLine: true,
|
|
170
|
+
printWidth: 80,
|
|
171
|
+
bracketSpacing: true,
|
|
172
|
+
arrowParens: "avoid",
|
|
173
|
+
endOfLine: "lf",
|
|
174
|
+
plugins: ["prettier-plugin-pkg"]
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
11
179
|
// src/executors/npm-publish/executor.ts
|
|
12
180
|
import { execSync } from "node:child_process";
|
|
13
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
14
|
-
import { format } from "prettier";
|
|
181
|
+
import { readFile as readFile2, writeFile as writeFile3 } from "node:fs/promises";
|
|
182
|
+
import { format as format2 } from "prettier";
|
|
15
183
|
var LARGE_BUFFER = 1024 * 1e6;
|
|
16
184
|
async function npmPublishExecutorFn(options, context) {
|
|
17
185
|
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
@@ -34,13 +202,13 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
34
202
|
context.projectsConfigurations.projects[context.projectName].root
|
|
35
203
|
) : packageRoot;
|
|
36
204
|
const packageJsonPath = joinPaths(packageRoot, "package.json");
|
|
37
|
-
const packageJsonFile = await
|
|
205
|
+
const packageJsonFile = await readFile2(packageJsonPath, "utf8");
|
|
38
206
|
if (!packageJsonFile) {
|
|
39
207
|
throw new Error(`Could not find \`package.json\` at ${packageJsonPath}`);
|
|
40
208
|
}
|
|
41
209
|
const packageJson = JSON.parse(packageJsonFile);
|
|
42
210
|
const projectPackageJsonPath = joinPaths(projectRoot, "package.json");
|
|
43
|
-
const projectPackageJsonFile = await
|
|
211
|
+
const projectPackageJsonFile = await readFile2(projectPackageJsonPath, "utf8");
|
|
44
212
|
if (!projectPackageJsonFile) {
|
|
45
213
|
throw new Error(
|
|
46
214
|
`Could not find \`package.json\` at ${projectPackageJsonPath}`
|
|
@@ -53,9 +221,9 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
53
221
|
);
|
|
54
222
|
if (projectPackageJson.version) {
|
|
55
223
|
packageJson.version = projectPackageJson.version;
|
|
56
|
-
await
|
|
224
|
+
await writeFile3(
|
|
57
225
|
packageJsonPath,
|
|
58
|
-
await
|
|
226
|
+
await format2(JSON.stringify(packageJson), {
|
|
59
227
|
parser: "json",
|
|
60
228
|
proseWrap: "always",
|
|
61
229
|
trailingComma: "none",
|
|
@@ -85,21 +253,13 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
85
253
|
);
|
|
86
254
|
return { success: true };
|
|
87
255
|
}
|
|
88
|
-
await
|
|
256
|
+
await replaceDepsAliases(packageRoot, context.root);
|
|
89
257
|
await addPackageJsonGitHead(packageRoot);
|
|
90
258
|
const npmPublishCommandSegments = [`npm publish --json`];
|
|
91
259
|
const npmViewCommandSegments = [
|
|
92
260
|
`npm view ${packageName} versions dist-tags --json`
|
|
93
261
|
];
|
|
94
|
-
const registry = options.registry
|
|
95
|
-
cwd: packageRoot,
|
|
96
|
-
env: {
|
|
97
|
-
...process.env,
|
|
98
|
-
FORCE_COLOR: "true"
|
|
99
|
-
},
|
|
100
|
-
maxBuffer: LARGE_BUFFER,
|
|
101
|
-
killSignal: "SIGTERM"
|
|
102
|
-
}).toString().trim();
|
|
262
|
+
const registry = options.registry ?? (await getRegistry() || getNpmRegistry());
|
|
103
263
|
if (registry) {
|
|
104
264
|
npmPublishCommandSegments.push(`--registry="${registry}" `);
|
|
105
265
|
npmViewCommandSegments.push(`--registry="${registry}" `);
|
|
@@ -1,24 +1,192 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }
|
|
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
2
|
|
|
3
3
|
var _chunk73IC2JQVjs = require('./chunk-73IC2JQV.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
var _chunkDA53ZKBYjs = require('./chunk-DA53ZKBY.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkHNFKVXBVjs = require('./chunk-HNFKVXBV.js');
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
var _chunk53DNHF7Bjs = require('./chunk-53DNHF7B.js');
|
|
10
14
|
|
|
11
|
-
// src/
|
|
12
|
-
|
|
15
|
+
// ../pnpm-tools/src/helpers/replace-deps-aliases.ts
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _devkit = require('@nx/devkit');
|
|
20
|
+
var _fs = require('fs');
|
|
13
21
|
var _promises = require('fs/promises');
|
|
14
22
|
var _prettier = require('prettier');
|
|
23
|
+
|
|
24
|
+
// ../pnpm-tools/src/helpers/catalog.ts
|
|
25
|
+
var _semver = require('semver');
|
|
26
|
+
|
|
27
|
+
// ../pnpm-tools/src/helpers/pnpm-workspace.ts
|
|
28
|
+
var _jsyaml = require('js-yaml');
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
async function readPnpmWorkspaceFile(workspaceRoot = _chunkHNFKVXBVjs.findWorkspaceRoot.call(void 0, process.cwd())) {
|
|
32
|
+
const pnpmWorkspacePath = _chunk53DNHF7Bjs.joinPaths.call(void 0, workspaceRoot, "pnpm-workspace.yaml");
|
|
33
|
+
if (!_fs.existsSync.call(void 0, pnpmWorkspacePath)) {
|
|
34
|
+
console.warn(
|
|
35
|
+
`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${pnpmWorkspacePath}).`
|
|
36
|
+
);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
return _jsyaml.load.call(void 0, pnpmWorkspacePath);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ../pnpm-tools/src/helpers/catalog.ts
|
|
43
|
+
async function getCatalog(workspaceRoot = _chunkHNFKVXBVjs.findWorkspaceRoot.call(void 0, process.cwd())) {
|
|
44
|
+
const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
|
|
45
|
+
if (_optionalChain([pnpmWorkspaceFile, 'optionalAccess', _ => _.catalog])) {
|
|
46
|
+
return Object.fromEntries(
|
|
47
|
+
Object.entries(pnpmWorkspaceFile.catalog).map(([key, value]) => {
|
|
48
|
+
return [key, value.replaceAll(/^"/g, "").replaceAll(/"$/g, "")];
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ../pnpm-tools/src/helpers/replace-deps-aliases.ts
|
|
56
|
+
async function replaceDepsAliases(packageRoot = process.cwd(), workspaceRoot = _chunkHNFKVXBVjs.findWorkspaceRoot.call(void 0, packageRoot)) {
|
|
57
|
+
const packageJsonPath = _chunk53DNHF7Bjs.joinPaths.call(void 0, packageRoot, "package.json");
|
|
58
|
+
const packageJsonFile = await _promises.readFile.call(void 0, packageJsonPath, "utf8");
|
|
59
|
+
if (!packageJsonFile) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
"No package.json file found in package root: " + packageRoot
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
const catalog = await getCatalog(workspaceRoot);
|
|
65
|
+
const packageJson = JSON.parse(packageJsonFile);
|
|
66
|
+
const pnpmWorkspacePath = _chunk53DNHF7Bjs.joinPaths.call(void 0, workspaceRoot, "pnpm-workspace.yaml");
|
|
67
|
+
if (!_fs.existsSync.call(void 0, pnpmWorkspacePath)) {
|
|
68
|
+
console.warn(
|
|
69
|
+
`No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${pnpmWorkspacePath}). Skipping pnpm catalog read for now.`
|
|
70
|
+
);
|
|
71
|
+
return packageJson;
|
|
72
|
+
}
|
|
73
|
+
if (!catalog) {
|
|
74
|
+
console.warn(
|
|
75
|
+
`No pnpm catalog found. Skipping dependencies replacement for now.`
|
|
76
|
+
);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
for (const dependencyType of [
|
|
80
|
+
"dependencies",
|
|
81
|
+
"devDependencies",
|
|
82
|
+
"peerDependencies"
|
|
83
|
+
]) {
|
|
84
|
+
const dependencies = packageJson[dependencyType];
|
|
85
|
+
if (!dependencies) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
for (const dependencyName of Object.keys(dependencies)) {
|
|
89
|
+
if (dependencies[dependencyName] === "catalog:") {
|
|
90
|
+
if (!catalog) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`Dependency ${dependencyName} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`pnpm-workspace.yaml\` file.`
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
const catalogVersion = catalog[dependencyName];
|
|
96
|
+
if (!catalogVersion) {
|
|
97
|
+
throw new Error("Missing pnpm catalog version for " + dependencyName);
|
|
98
|
+
}
|
|
99
|
+
dependencies[dependencyName] = catalogVersion;
|
|
100
|
+
} else if (dependencies[dependencyName].startsWith("catalog:")) {
|
|
101
|
+
throw new Error("multiple named catalogs not supported");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
let projectGraph;
|
|
106
|
+
try {
|
|
107
|
+
projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
108
|
+
} catch (e) {
|
|
109
|
+
await _devkit.createProjectGraphAsync.call(void 0, );
|
|
110
|
+
projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
111
|
+
}
|
|
112
|
+
const workspacePackages = {};
|
|
113
|
+
if (projectGraph) {
|
|
114
|
+
await Promise.all(
|
|
115
|
+
Object.keys(projectGraph.nodes).map(async (node) => {
|
|
116
|
+
const projectNode = projectGraph.nodes[node];
|
|
117
|
+
if (_optionalChain([projectNode, 'optionalAccess', _2 => _2.data, 'access', _3 => _3.root])) {
|
|
118
|
+
const projectPackageJsonPath = _chunk53DNHF7Bjs.joinPaths.call(void 0,
|
|
119
|
+
workspaceRoot,
|
|
120
|
+
projectNode.data.root,
|
|
121
|
+
"package.json"
|
|
122
|
+
);
|
|
123
|
+
if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
|
|
124
|
+
const projectPackageJsonContent = await _promises.readFile.call(void 0,
|
|
125
|
+
projectPackageJsonPath,
|
|
126
|
+
"utf8"
|
|
127
|
+
);
|
|
128
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
129
|
+
if (projectPackageJson.private !== true) {
|
|
130
|
+
workspacePackages[projectPackageJson.name] = projectPackageJson.version;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
for (const dependencyType of [
|
|
138
|
+
"dependencies",
|
|
139
|
+
"devDependencies",
|
|
140
|
+
"peerDependencies"
|
|
141
|
+
]) {
|
|
142
|
+
const dependencies = packageJson[dependencyType];
|
|
143
|
+
if (!dependencies) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
for (const dependencyName of Object.keys(dependencies)) {
|
|
147
|
+
if (dependencies[dependencyName].startsWith("workspace:")) {
|
|
148
|
+
if (workspacePackages[dependencyName]) {
|
|
149
|
+
dependencies[dependencyName] = `^${workspacePackages[dependencyName]}`;
|
|
150
|
+
} else {
|
|
151
|
+
throw new Error(
|
|
152
|
+
`Workspace dependency ${dependencyName} not found in workspace packages.`
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return _promises.writeFile.call(void 0,
|
|
159
|
+
packageJsonPath,
|
|
160
|
+
await _prettier.format.call(void 0, JSON.stringify(packageJson), {
|
|
161
|
+
parser: "json",
|
|
162
|
+
proseWrap: "always",
|
|
163
|
+
trailingComma: "none",
|
|
164
|
+
tabWidth: 2,
|
|
165
|
+
semi: true,
|
|
166
|
+
singleQuote: false,
|
|
167
|
+
quoteProps: "as-needed",
|
|
168
|
+
insertPragma: false,
|
|
169
|
+
bracketSameLine: true,
|
|
170
|
+
printWidth: 80,
|
|
171
|
+
bracketSpacing: true,
|
|
172
|
+
arrowParens: "avoid",
|
|
173
|
+
endOfLine: "lf",
|
|
174
|
+
plugins: ["prettier-plugin-pkg"]
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// src/executors/npm-publish/executor.ts
|
|
180
|
+
var _child_process = require('child_process');
|
|
181
|
+
|
|
182
|
+
|
|
15
183
|
var LARGE_BUFFER = 1024 * 1e6;
|
|
16
184
|
async function npmPublishExecutorFn(options, context) {
|
|
17
185
|
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
18
186
|
if (!context.projectName) {
|
|
19
187
|
throw new Error("The `npm-publish` executor requires a `projectName`.");
|
|
20
188
|
}
|
|
21
|
-
const projectConfig = _optionalChain([context, 'access',
|
|
189
|
+
const projectConfig = _optionalChain([context, 'access', _4 => _4.projectsConfigurations, 'optionalAccess', _5 => _5.projects, 'optionalAccess', _6 => _6[context.projectName]]);
|
|
22
190
|
if (!projectConfig) {
|
|
23
191
|
throw new Error(
|
|
24
192
|
`Could not find project configuration for \`${context.projectName}\``
|
|
@@ -28,7 +196,7 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
28
196
|
context.root,
|
|
29
197
|
options.packageRoot || _chunk53DNHF7Bjs.joinPaths.call(void 0, "dist", projectConfig.root)
|
|
30
198
|
);
|
|
31
|
-
const projectRoot = _optionalChain([context, 'access',
|
|
199
|
+
const projectRoot = _optionalChain([context, 'access', _7 => _7.projectsConfigurations, 'access', _8 => _8.projects, 'access', _9 => _9[context.projectName], 'optionalAccess', _10 => _10.root]) ? _chunk53DNHF7Bjs.joinPaths.call(void 0,
|
|
32
200
|
context.root,
|
|
33
201
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
34
202
|
context.projectsConfigurations.projects[context.projectName].root
|
|
@@ -85,21 +253,13 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
85
253
|
);
|
|
86
254
|
return { success: true };
|
|
87
255
|
}
|
|
88
|
-
await
|
|
256
|
+
await replaceDepsAliases(packageRoot, context.root);
|
|
89
257
|
await _chunk73IC2JQVjs.addPackageJsonGitHead.call(void 0, packageRoot);
|
|
90
258
|
const npmPublishCommandSegments = [`npm publish --json`];
|
|
91
259
|
const npmViewCommandSegments = [
|
|
92
260
|
`npm view ${packageName} versions dist-tags --json`
|
|
93
261
|
];
|
|
94
|
-
const registry = options.registry
|
|
95
|
-
cwd: packageRoot,
|
|
96
|
-
env: {
|
|
97
|
-
...process.env,
|
|
98
|
-
FORCE_COLOR: "true"
|
|
99
|
-
},
|
|
100
|
-
maxBuffer: LARGE_BUFFER,
|
|
101
|
-
killSignal: "SIGTERM"
|
|
102
|
-
}).toString().trim();
|
|
262
|
+
const registry = await _asyncNullishCoalesce(options.registry, async () => ( (await _chunkDA53ZKBYjs.getRegistry.call(void 0, ) || _chunkDA53ZKBYjs.getNpmRegistry.call(void 0, ))));
|
|
103
263
|
if (registry) {
|
|
104
264
|
npmPublishCommandSegments.push(`--registry="${registry}" `);
|
|
105
265
|
npmViewCommandSegments.push(`--registry="${registry}" `);
|
|
@@ -202,16 +362,16 @@ Note: If this is the first time this package has been published to NPM, this can
|
|
|
202
362
|
`
|
|
203
363
|
);
|
|
204
364
|
console.info("");
|
|
205
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access',
|
|
206
|
-
if (_optionalChain([stdoutData, 'optionalAccess',
|
|
365
|
+
const stdoutData = JSON.parse(_optionalChain([err, 'access', _11 => _11.stdout, 'optionalAccess', _12 => _12.toString, 'call', _13 => _13()]) || "{}");
|
|
366
|
+
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")]))) {
|
|
207
367
|
console.error(
|
|
208
368
|
"npm dist-tag add error please see below for more information:"
|
|
209
369
|
);
|
|
210
370
|
if (stdoutData.error.summary) {
|
|
211
|
-
console.error(_optionalChain([stdoutData, 'access',
|
|
371
|
+
console.error(_optionalChain([stdoutData, 'access', _33 => _33.error, 'optionalAccess', _34 => _34.summary]));
|
|
212
372
|
}
|
|
213
373
|
if (stdoutData.error.detail) {
|
|
214
|
-
console.error(_optionalChain([stdoutData, 'access',
|
|
374
|
+
console.error(_optionalChain([stdoutData, 'access', _35 => _35.error, 'optionalAccess', _36 => _36.detail]));
|
|
215
375
|
}
|
|
216
376
|
if (context.isVerbose) {
|
|
217
377
|
console.error(
|
|
@@ -240,8 +400,8 @@ ${JSON.stringify(err2)}`
|
|
|
240
400
|
);
|
|
241
401
|
console.error(error);
|
|
242
402
|
console.info("");
|
|
243
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access',
|
|
244
|
-
if (!(_optionalChain([stdoutData, 'access',
|
|
403
|
+
const stdoutData = JSON.parse(_optionalChain([err, 'access', _37 => _37.stdout, 'optionalAccess', _38 => _38.toString, 'call', _39 => _39()]) || "{}");
|
|
404
|
+
if (!(_optionalChain([stdoutData, 'access', _40 => _40.error, 'optionalAccess', _41 => _41.code, 'optionalAccess', _42 => _42.includes, 'call', _43 => _43("E404")]) && _optionalChain([stdoutData, 'access', _44 => _44.error, 'optionalAccess', _45 => _45.summary, 'optionalAccess', _46 => _46.toLowerCase, 'call', _47 => _47(), 'access', _48 => _48.includes, 'call', _49 => _49("not found")])) && !(_optionalChain([err, 'access', _50 => _50.stderr, 'optionalAccess', _51 => _51.toString, 'call', _52 => _52(), 'access', _53 => _53.includes, 'call', _54 => _54("E404")]) && _optionalChain([err, 'access', _55 => _55.stderr, 'optionalAccess', _56 => _56.toString, 'call', _57 => _57(), 'access', _58 => _58.toLowerCase, 'call', _59 => _59(), 'access', _60 => _60.includes, 'call', _61 => _61("not found")]))) {
|
|
245
405
|
console.error(
|
|
246
406
|
`Something unexpected went wrong when checking for existing dist-tags.
|
|
247
407
|
|
|
@@ -288,7 +448,7 @@ Execution response: ${result.toString()}` : ""}
|
|
|
288
448
|
console.error("An error occured running npm publish.");
|
|
289
449
|
console.error("Please see below for more information:");
|
|
290
450
|
console.info("");
|
|
291
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access',
|
|
451
|
+
const stdoutData = JSON.parse(_optionalChain([err, 'access', _62 => _62.stdout, 'optionalAccess', _63 => _63.toString, 'call', _64 => _64()]) || "{}");
|
|
292
452
|
if (stdoutData.error.summary) {
|
|
293
453
|
console.error(stdoutData.error.summary);
|
|
294
454
|
console.error(stdoutData.error.summary);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkOSMA3OJGjs = require('./chunk-OSMA3OJG.js');
|
|
4
|
+
|
|
5
|
+
// ../npm-tools/src/constants.ts
|
|
6
|
+
var DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
7
|
+
var DEFAULT_GITHUB_REGISTRY = "https://npm.pkg.github.com";
|
|
8
|
+
var LATEST_NPM_TAG = "latest";
|
|
9
|
+
var DEFAULT_NPM_TAG = LATEST_NPM_TAG;
|
|
10
|
+
|
|
11
|
+
// ../npm-tools/src/helpers/get-registry.ts
|
|
12
|
+
var _child_process = require('child_process');
|
|
13
|
+
async function getRegistry() {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
_child_process.exec.call(void 0, "npm config get registry", (error, stdout, stderr) => {
|
|
16
|
+
if (error) {
|
|
17
|
+
return reject(error);
|
|
18
|
+
}
|
|
19
|
+
if (stderr) {
|
|
20
|
+
return reject(stderr);
|
|
21
|
+
}
|
|
22
|
+
return resolve(stdout.trim());
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async function getNpmRegistry() {
|
|
27
|
+
if (process.env.STORM_REGISTRY_NPM) {
|
|
28
|
+
return process.env.STORM_REGISTRY_NPM;
|
|
29
|
+
}
|
|
30
|
+
const workspaceConfig = await _chunkOSMA3OJGjs.getConfig.call(void 0, );
|
|
31
|
+
if (_optionalChain([workspaceConfig, 'optionalAccess', _ => _.registry, 'optionalAccess', _2 => _2.npm])) {
|
|
32
|
+
return _optionalChain([workspaceConfig, 'optionalAccess', _3 => _3.registry, 'optionalAccess', _4 => _4.npm]);
|
|
33
|
+
}
|
|
34
|
+
return DEFAULT_NPM_REGISTRY;
|
|
35
|
+
}
|
|
36
|
+
async function getGitHubRegistry() {
|
|
37
|
+
if (process.env.STORM_REGISTRY_GITHUB) {
|
|
38
|
+
return process.env.STORM_REGISTRY_GITHUB;
|
|
39
|
+
}
|
|
40
|
+
const workspaceConfig = await _chunkOSMA3OJGjs.getConfig.call(void 0, );
|
|
41
|
+
if (_optionalChain([workspaceConfig, 'optionalAccess', _5 => _5.registry, 'optionalAccess', _6 => _6.github])) {
|
|
42
|
+
return _optionalChain([workspaceConfig, 'optionalAccess', _7 => _7.registry, 'optionalAccess', _8 => _8.github]);
|
|
43
|
+
}
|
|
44
|
+
return DEFAULT_GITHUB_REGISTRY;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ../npm-tools/src/helpers/get-version.ts
|
|
48
|
+
|
|
49
|
+
async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
50
|
+
const { registry = getRegistry() } = options;
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
52
|
+
_child_process.exec.call(void 0,
|
|
53
|
+
`npm view ${packageName} version --registry=${registry} --tag=${tag}`,
|
|
54
|
+
(error, stdout, stderr) => {
|
|
55
|
+
if (error) {
|
|
56
|
+
return reject(error);
|
|
57
|
+
}
|
|
58
|
+
if (stderr) {
|
|
59
|
+
return reject(stderr);
|
|
60
|
+
}
|
|
61
|
+
return resolve(stdout.trim());
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
exports.DEFAULT_NPM_TAG = DEFAULT_NPM_TAG; exports.getRegistry = getRegistry; exports.getNpmRegistry = getNpmRegistry; exports.getGitHubRegistry = getGitHubRegistry; exports.getVersion = getVersion;
|