@storm-software/workspace-tools 1.286.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 +11 -0
- package/README.md +1 -1
- package/dist/{chunk-OZFFOIQJ.mjs → chunk-5K5OGRSL.mjs} +175 -11
- package/dist/{chunk-GF6O2RXB.js → chunk-5X2P7IL3.js} +179 -15
- package/dist/{chunk-NTQG45CW.js → chunk-DA53ZKBY.js} +22 -1
- package/dist/{chunk-5BP7WBYT.mjs → chunk-M7ZPKNJT.mjs} +22 -1
- package/dist/{chunk-QEPFDTFD.js → chunk-Q27SXGNA.js} +11 -30
- package/dist/{chunk-BNDXPQJL.mjs → chunk-YTQNRG2E.mjs} +3 -22
- package/dist/executors.js +3 -4
- package/dist/executors.mjs +2 -3
- package/dist/generators.js +3 -3
- package/dist/generators.mjs +2 -2
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +5 -9
- package/dist/index.mjs +4 -8
- package/dist/src/executors/npm-publish/executor.js +3 -4
- package/dist/src/executors/npm-publish/executor.mjs +2 -3
- package/dist/src/generators/release-version/generator.js +3 -3
- package/dist/src/generators/release-version/generator.mjs +2 -2
- 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 -24
- 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,17 @@
|
|
|
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
|
+
|
|
5
16
|
## [1.285.0](https://github.com/storm-software/storm-ops/releases/tag/workspace-tools%401.285.0) (2025-09-13)
|
|
6
17
|
|
|
7
18
|
### 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 -->
|
|
@@ -1,21 +1,185 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addPackageJsonGitHead
|
|
3
3
|
} from "./chunk-PIK7KYVE.mjs";
|
|
4
|
-
import {
|
|
5
|
-
pnpmUpdate
|
|
6
|
-
} from "./chunk-KHT5W6AJ.mjs";
|
|
7
4
|
import {
|
|
8
5
|
getNpmRegistry,
|
|
9
6
|
getRegistry
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-M7ZPKNJT.mjs";
|
|
8
|
+
import {
|
|
9
|
+
findWorkspaceRoot
|
|
10
|
+
} from "./chunk-M5Z57CUO.mjs";
|
|
11
11
|
import {
|
|
12
12
|
joinPaths
|
|
13
13
|
} from "./chunk-U7JFVMCK.mjs";
|
|
14
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
|
+
|
|
15
179
|
// src/executors/npm-publish/executor.ts
|
|
16
180
|
import { execSync } from "node:child_process";
|
|
17
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
18
|
-
import { format } from "prettier";
|
|
181
|
+
import { readFile as readFile2, writeFile as writeFile3 } from "node:fs/promises";
|
|
182
|
+
import { format as format2 } from "prettier";
|
|
19
183
|
var LARGE_BUFFER = 1024 * 1e6;
|
|
20
184
|
async function npmPublishExecutorFn(options, context) {
|
|
21
185
|
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
@@ -38,13 +202,13 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
38
202
|
context.projectsConfigurations.projects[context.projectName].root
|
|
39
203
|
) : packageRoot;
|
|
40
204
|
const packageJsonPath = joinPaths(packageRoot, "package.json");
|
|
41
|
-
const packageJsonFile = await
|
|
205
|
+
const packageJsonFile = await readFile2(packageJsonPath, "utf8");
|
|
42
206
|
if (!packageJsonFile) {
|
|
43
207
|
throw new Error(`Could not find \`package.json\` at ${packageJsonPath}`);
|
|
44
208
|
}
|
|
45
209
|
const packageJson = JSON.parse(packageJsonFile);
|
|
46
210
|
const projectPackageJsonPath = joinPaths(projectRoot, "package.json");
|
|
47
|
-
const projectPackageJsonFile = await
|
|
211
|
+
const projectPackageJsonFile = await readFile2(projectPackageJsonPath, "utf8");
|
|
48
212
|
if (!projectPackageJsonFile) {
|
|
49
213
|
throw new Error(
|
|
50
214
|
`Could not find \`package.json\` at ${projectPackageJsonPath}`
|
|
@@ -57,9 +221,9 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
57
221
|
);
|
|
58
222
|
if (projectPackageJson.version) {
|
|
59
223
|
packageJson.version = projectPackageJson.version;
|
|
60
|
-
await
|
|
224
|
+
await writeFile3(
|
|
61
225
|
packageJsonPath,
|
|
62
|
-
await
|
|
226
|
+
await format2(JSON.stringify(packageJson), {
|
|
63
227
|
parser: "json",
|
|
64
228
|
proseWrap: "always",
|
|
65
229
|
trailingComma: "none",
|
|
@@ -89,7 +253,7 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
89
253
|
);
|
|
90
254
|
return { success: true };
|
|
91
255
|
}
|
|
92
|
-
await
|
|
256
|
+
await replaceDepsAliases(packageRoot, context.root);
|
|
93
257
|
await addPackageJsonGitHead(packageRoot);
|
|
94
258
|
const npmPublishCommandSegments = [`npm publish --json`];
|
|
95
259
|
const npmViewCommandSegments = [
|
|
@@ -3,26 +3,190 @@
|
|
|
3
3
|
var _chunk73IC2JQVjs = require('./chunk-73IC2JQV.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var _chunkF6X43VUXjs = require('./chunk-F6X43VUX.js');
|
|
7
6
|
|
|
7
|
+
var _chunkDA53ZKBYjs = require('./chunk-DA53ZKBY.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkHNFKVXBVjs = require('./chunk-HNFKVXBV.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunk53DNHF7Bjs = require('./chunk-53DNHF7B.js');
|
|
14
14
|
|
|
15
|
-
// src/
|
|
16
|
-
|
|
15
|
+
// ../pnpm-tools/src/helpers/replace-deps-aliases.ts
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _devkit = require('@nx/devkit');
|
|
20
|
+
var _fs = require('fs');
|
|
17
21
|
var _promises = require('fs/promises');
|
|
18
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
|
+
|
|
19
183
|
var LARGE_BUFFER = 1024 * 1e6;
|
|
20
184
|
async function npmPublishExecutorFn(options, context) {
|
|
21
185
|
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
22
186
|
if (!context.projectName) {
|
|
23
187
|
throw new Error("The `npm-publish` executor requires a `projectName`.");
|
|
24
188
|
}
|
|
25
|
-
const projectConfig = _optionalChain([context, 'access',
|
|
189
|
+
const projectConfig = _optionalChain([context, 'access', _4 => _4.projectsConfigurations, 'optionalAccess', _5 => _5.projects, 'optionalAccess', _6 => _6[context.projectName]]);
|
|
26
190
|
if (!projectConfig) {
|
|
27
191
|
throw new Error(
|
|
28
192
|
`Could not find project configuration for \`${context.projectName}\``
|
|
@@ -32,7 +196,7 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
32
196
|
context.root,
|
|
33
197
|
options.packageRoot || _chunk53DNHF7Bjs.joinPaths.call(void 0, "dist", projectConfig.root)
|
|
34
198
|
);
|
|
35
|
-
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,
|
|
36
200
|
context.root,
|
|
37
201
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
38
202
|
context.projectsConfigurations.projects[context.projectName].root
|
|
@@ -89,13 +253,13 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
89
253
|
);
|
|
90
254
|
return { success: true };
|
|
91
255
|
}
|
|
92
|
-
await
|
|
256
|
+
await replaceDepsAliases(packageRoot, context.root);
|
|
93
257
|
await _chunk73IC2JQVjs.addPackageJsonGitHead.call(void 0, packageRoot);
|
|
94
258
|
const npmPublishCommandSegments = [`npm publish --json`];
|
|
95
259
|
const npmViewCommandSegments = [
|
|
96
260
|
`npm view ${packageName} versions dist-tags --json`
|
|
97
261
|
];
|
|
98
|
-
const registry = await _asyncNullishCoalesce(options.registry, async () => ( (await
|
|
262
|
+
const registry = await _asyncNullishCoalesce(options.registry, async () => ( (await _chunkDA53ZKBYjs.getRegistry.call(void 0, ) || _chunkDA53ZKBYjs.getNpmRegistry.call(void 0, ))));
|
|
99
263
|
if (registry) {
|
|
100
264
|
npmPublishCommandSegments.push(`--registry="${registry}" `);
|
|
101
265
|
npmViewCommandSegments.push(`--registry="${registry}" `);
|
|
@@ -198,16 +362,16 @@ Note: If this is the first time this package has been published to NPM, this can
|
|
|
198
362
|
`
|
|
199
363
|
);
|
|
200
364
|
console.info("");
|
|
201
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access',
|
|
202
|
-
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")]))) {
|
|
203
367
|
console.error(
|
|
204
368
|
"npm dist-tag add error please see below for more information:"
|
|
205
369
|
);
|
|
206
370
|
if (stdoutData.error.summary) {
|
|
207
|
-
console.error(_optionalChain([stdoutData, 'access',
|
|
371
|
+
console.error(_optionalChain([stdoutData, 'access', _33 => _33.error, 'optionalAccess', _34 => _34.summary]));
|
|
208
372
|
}
|
|
209
373
|
if (stdoutData.error.detail) {
|
|
210
|
-
console.error(_optionalChain([stdoutData, 'access',
|
|
374
|
+
console.error(_optionalChain([stdoutData, 'access', _35 => _35.error, 'optionalAccess', _36 => _36.detail]));
|
|
211
375
|
}
|
|
212
376
|
if (context.isVerbose) {
|
|
213
377
|
console.error(
|
|
@@ -236,8 +400,8 @@ ${JSON.stringify(err2)}`
|
|
|
236
400
|
);
|
|
237
401
|
console.error(error);
|
|
238
402
|
console.info("");
|
|
239
|
-
const stdoutData = JSON.parse(_optionalChain([err, 'access',
|
|
240
|
-
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")]))) {
|
|
241
405
|
console.error(
|
|
242
406
|
`Something unexpected went wrong when checking for existing dist-tags.
|
|
243
407
|
|
|
@@ -284,7 +448,7 @@ Execution response: ${result.toString()}` : ""}
|
|
|
284
448
|
console.error("An error occured running npm publish.");
|
|
285
449
|
console.error("Please see below for more information:");
|
|
286
450
|
console.info("");
|
|
287
|
-
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()]) || "{}");
|
|
288
452
|
if (stdoutData.error.summary) {
|
|
289
453
|
console.error(stdoutData.error.summary);
|
|
290
454
|
console.error(stdoutData.error.summary);
|
|
@@ -44,9 +44,30 @@ async function getGitHubRegistry() {
|
|
|
44
44
|
return DEFAULT_GITHUB_REGISTRY;
|
|
45
45
|
}
|
|
46
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
|
+
|
|
47
68
|
|
|
48
69
|
|
|
49
70
|
|
|
50
71
|
|
|
51
72
|
|
|
52
|
-
exports.DEFAULT_NPM_TAG = DEFAULT_NPM_TAG; exports.getRegistry = getRegistry; exports.getNpmRegistry = getNpmRegistry; exports.getGitHubRegistry = getGitHubRegistry;
|
|
73
|
+
exports.DEFAULT_NPM_TAG = DEFAULT_NPM_TAG; exports.getRegistry = getRegistry; exports.getNpmRegistry = getNpmRegistry; exports.getGitHubRegistry = getGitHubRegistry; exports.getVersion = getVersion;
|
|
@@ -44,9 +44,30 @@ async function getGitHubRegistry() {
|
|
|
44
44
|
return DEFAULT_GITHUB_REGISTRY;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// ../npm-tools/src/helpers/get-version.ts
|
|
48
|
+
import { exec as exec2 } from "node:child_process";
|
|
49
|
+
async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
50
|
+
const { registry = getRegistry() } = options;
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
52
|
+
exec2(
|
|
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
|
+
|
|
47
67
|
export {
|
|
48
68
|
DEFAULT_NPM_TAG,
|
|
49
69
|
getRegistry,
|
|
50
70
|
getNpmRegistry,
|
|
51
|
-
getGitHubRegistry
|
|
71
|
+
getGitHubRegistry,
|
|
72
|
+
getVersion
|
|
52
73
|
};
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
var _chunkDA53ZKBYjs = require('./chunk-DA53ZKBY.js');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
@@ -299,28 +300,8 @@ var DEFAULT_CONVENTIONAL_COMMITS_CONFIG = {
|
|
|
299
300
|
types: COMMIT_TYPES
|
|
300
301
|
};
|
|
301
302
|
|
|
302
|
-
// ../npm-tools/src/helpers/get-version.ts
|
|
303
|
-
var _child_process = require('child_process');
|
|
304
|
-
async function getVersion(packageName, tag = _chunkNTQG45CWjs.DEFAULT_NPM_TAG, options = {}) {
|
|
305
|
-
const { registry = _chunkNTQG45CWjs.getRegistry.call(void 0, ) } = options;
|
|
306
|
-
return new Promise((resolve, reject) => {
|
|
307
|
-
_child_process.exec.call(void 0,
|
|
308
|
-
`npm view ${packageName} version --registry=${registry} --tag=${tag}`,
|
|
309
|
-
(error, stdout, stderr) => {
|
|
310
|
-
if (error) {
|
|
311
|
-
return reject(error);
|
|
312
|
-
}
|
|
313
|
-
if (stderr) {
|
|
314
|
-
return reject(stderr);
|
|
315
|
-
}
|
|
316
|
-
return resolve(stdout.trim());
|
|
317
|
-
}
|
|
318
|
-
);
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
|
|
322
303
|
// src/generators/release-version/generator.ts
|
|
323
|
-
|
|
304
|
+
var _child_process = require('child_process');
|
|
324
305
|
var _path = require('path');
|
|
325
306
|
var _config = require('nx/src/command-line/release/config/config');
|
|
326
307
|
|
|
@@ -466,19 +447,19 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
|
|
|
466
447
|
switch (options.currentVersionResolver) {
|
|
467
448
|
case "registry": {
|
|
468
449
|
const metadata = _nullishCoalesce(options.currentVersionResolverMetadata, () => ( {}));
|
|
469
|
-
const tag = _nullishCoalesce(metadata.tag, () => (
|
|
470
|
-
const registry = await _asyncNullishCoalesce(metadata.registry, async () => ( await
|
|
471
|
-
const npmRegistry = await
|
|
472
|
-
const githubRegistry = await
|
|
450
|
+
const tag = _nullishCoalesce(metadata.tag, () => ( _chunkDA53ZKBYjs.DEFAULT_NPM_TAG));
|
|
451
|
+
const registry = await _asyncNullishCoalesce(metadata.registry, async () => ( await _chunkDA53ZKBYjs.getRegistry.call(void 0, )));
|
|
452
|
+
const npmRegistry = await _chunkDA53ZKBYjs.getNpmRegistry.call(void 0, );
|
|
453
|
+
const githubRegistry = await _chunkDA53ZKBYjs.getGitHubRegistry.call(void 0, );
|
|
473
454
|
if (options.releaseGroup.projectsRelationship === "independent") {
|
|
474
455
|
try {
|
|
475
|
-
currentVersion = await getVersion(packageName, tag, { registry });
|
|
456
|
+
currentVersion = await _chunkDA53ZKBYjs.getVersion.call(void 0, packageName, tag, { registry });
|
|
476
457
|
if (!currentVersion) {
|
|
477
|
-
currentVersion = await getVersion(packageName, tag, {
|
|
458
|
+
currentVersion = await _chunkDA53ZKBYjs.getVersion.call(void 0, packageName, tag, {
|
|
478
459
|
registry: npmRegistry
|
|
479
460
|
});
|
|
480
461
|
if (!currentVersion) {
|
|
481
|
-
currentVersion = await getVersion(packageName, tag, {
|
|
462
|
+
currentVersion = await _chunkDA53ZKBYjs.getVersion.call(void 0, packageName, tag, {
|
|
482
463
|
registry: githubRegistry
|
|
483
464
|
});
|
|
484
465
|
}
|
|
@@ -488,7 +469,7 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
|
|
|
488
469
|
);
|
|
489
470
|
} catch (e) {
|
|
490
471
|
try {
|
|
491
|
-
currentVersion = await getVersion(packageName, tag, {
|
|
472
|
+
currentVersion = await _chunkDA53ZKBYjs.getVersion.call(void 0, packageName, tag, {
|
|
492
473
|
registry: githubRegistry
|
|
493
474
|
});
|
|
494
475
|
log(
|