@storm-software/workspace-tools 1.296.81 → 1.296.85
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/bun.json +230 -0
- 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-WCUI5X7P.js → chunk-5KAJDSTQ.js} +17 -15
- 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-NNDVMJGY.mjs → chunk-KMTNXFZA.mjs} +17 -15
- 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-R4GXDUM2.mjs → chunk-WU2HALDD.mjs} +11 -5
- 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 +14 -13
- package/dist/executors.mjs +15 -14
- package/dist/generators.js +10 -9
- package/dist/generators.mjs +11 -10
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +62 -36
- package/dist/index.mjs +67 -41
- 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 +16 -8
- package/dist/src/plugins/typescript/untyped-schema.mjs +16 -8
- 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
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getWorkspacePackageManager
|
|
3
|
+
} from "./chunk-5BGCA73V.mjs";
|
|
1
4
|
import {
|
|
2
5
|
getGitHubTools
|
|
3
6
|
} from "./chunk-54BBSJHK.mjs";
|
|
@@ -7,219 +10,32 @@ import {
|
|
|
7
10
|
import {
|
|
8
11
|
getConfig
|
|
9
12
|
} from "./chunk-VO3QUJGP.mjs";
|
|
10
|
-
import {
|
|
11
|
-
findWorkspaceRoot
|
|
12
|
-
} from "./chunk-JUJWJXED.mjs";
|
|
13
13
|
import {
|
|
14
14
|
joinPaths
|
|
15
15
|
} from "./chunk-TBW5MCN6.mjs";
|
|
16
16
|
|
|
17
|
-
//
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import stripAnsi from "strip-ansi";
|
|
21
|
-
|
|
22
|
-
// ../npm-tools/src/helpers/get-registry.ts
|
|
23
|
-
import { exec } from "node:child_process";
|
|
24
|
-
|
|
25
|
-
// ../pnpm-tools/src/helpers/catalog.ts
|
|
26
|
-
import { coerce, gt, valid as valid2 } from "semver";
|
|
27
|
-
|
|
28
|
-
// ../pnpm-tools/src/helpers/pnpm-workspace.ts
|
|
29
|
-
import { existsSync } from "node:fs";
|
|
17
|
+
// src/executors/npm-publish/executor.ts
|
|
18
|
+
import { createJiti } from "jiti";
|
|
19
|
+
import { execSync } from "node:child_process";
|
|
30
20
|
import { readFile, writeFile } from "node:fs/promises";
|
|
31
|
-
import { parse, stringify } from "yaml";
|
|
32
|
-
function getPnpmWorkspaceFilePath(workspaceRoot = findWorkspaceRoot(process.cwd())) {
|
|
33
|
-
const pnpmWorkspacePath = joinPaths(workspaceRoot, "pnpm-workspace.yaml");
|
|
34
|
-
if (!existsSync(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 = findWorkspaceRoot(process.cwd())) {
|
|
42
|
-
const result = await readFile(
|
|
43
|
-
getPnpmWorkspaceFilePath(workspaceRoot),
|
|
44
|
-
"utf8"
|
|
45
|
-
);
|
|
46
|
-
if (!result) {
|
|
47
|
-
return void 0;
|
|
48
|
-
}
|
|
49
|
-
return parse(result);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// ../pnpm-tools/src/helpers/catalog.ts
|
|
53
|
-
async function getCatalogSafe(workspaceRoot = findWorkspaceRoot(process.cwd())) {
|
|
54
|
-
const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
|
|
55
|
-
if (!pnpmWorkspaceFile) {
|
|
56
|
-
throw new Error("No pnpm-workspace.yaml file found");
|
|
57
|
-
}
|
|
58
|
-
if (pnpmWorkspaceFile?.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 = findWorkspaceRoot(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
|
-
import {
|
|
86
|
-
createProjectGraphAsync,
|
|
87
|
-
readCachedProjectGraph
|
|
88
|
-
} from "@nx/devkit";
|
|
89
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
90
|
-
import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
|
|
91
21
|
import { format } from "prettier";
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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 = joinPaths(workspaceRoot, "pnpm-workspace.yaml");
|
|
103
|
-
if (!existsSync2(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 = readCachedProjectGraph();
|
|
144
|
-
} catch {
|
|
145
|
-
await createProjectGraphAsync();
|
|
146
|
-
projectGraph = readCachedProjectGraph();
|
|
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 (projectNode?.data.root) {
|
|
154
|
-
const projectPackageJsonPath = joinPaths(
|
|
155
|
-
workspaceRoot,
|
|
156
|
-
projectNode.data.root,
|
|
157
|
-
"package.json"
|
|
158
|
-
);
|
|
159
|
-
if (existsSync2(projectPackageJsonPath)) {
|
|
160
|
-
const projectPackageJsonContent = await readFile2(
|
|
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
|
-
);
|
|
22
|
+
var LARGE_BUFFER = 1024 * 1e6;
|
|
23
|
+
async function replaceDepsAliases(jiti, packageRoot, workspaceRoot, packageManager) {
|
|
24
|
+
if (packageManager === "bun") {
|
|
25
|
+
const { replaceDepsAliases: replaceBunDepsAliases } = await jiti.import(jiti.esmResolve("@storm-software/bun-tools"));
|
|
26
|
+
return replaceBunDepsAliases(packageRoot, workspaceRoot);
|
|
172
27
|
}
|
|
173
|
-
|
|
174
|
-
"
|
|
175
|
-
|
|
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
|
-
}
|
|
28
|
+
if (packageManager === "pnpm") {
|
|
29
|
+
const { replaceDepsAliases: replacePnpmDepsAliases } = await jiti.import(jiti.esmResolve("@storm-software/pnpm-tools"));
|
|
30
|
+
return replacePnpmDepsAliases(packageRoot, workspaceRoot);
|
|
193
31
|
}
|
|
194
|
-
return writeFile2(
|
|
195
|
-
packageJsonPath,
|
|
196
|
-
await format(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
32
|
}
|
|
214
|
-
|
|
215
|
-
// src/executors/npm-publish/executor.ts
|
|
216
|
-
import { createJiti } from "jiti";
|
|
217
|
-
import { execSync } from "node:child_process";
|
|
218
|
-
import { readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
|
|
219
|
-
import { format as format2 } from "prettier";
|
|
220
|
-
var LARGE_BUFFER = 1024 * 1e6;
|
|
221
33
|
async function npmPublishExecutorFn(options, context) {
|
|
222
34
|
const workspaceConfig = await getConfig(context.root);
|
|
35
|
+
const packageManager = await getWorkspacePackageManager(
|
|
36
|
+
context.root,
|
|
37
|
+
workspaceConfig
|
|
38
|
+
);
|
|
223
39
|
const github = await getGitHubTools(workspaceConfig);
|
|
224
40
|
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
225
41
|
if (!context.projectName) {
|
|
@@ -246,16 +62,16 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
246
62
|
fsCache: joinPaths(context.root, "node_modules/.cache/storm", "jiti"),
|
|
247
63
|
interopDefault: true
|
|
248
64
|
});
|
|
249
|
-
const { getNpmRegistry, getRegistry
|
|
65
|
+
const { getNpmRegistry, getRegistry } = await jiti.import(jiti.esmResolve("@storm-software/npm-tools/helpers"));
|
|
250
66
|
const packageJsonPath = joinPaths(packageRoot, "package.json");
|
|
251
|
-
const packageJsonFile = await
|
|
67
|
+
const packageJsonFile = await readFile(packageJsonPath, "utf8");
|
|
252
68
|
if (!packageJsonFile) {
|
|
253
69
|
github.error(`Could not find \`package.json\` at ${packageJsonPath}`);
|
|
254
70
|
return { success: false };
|
|
255
71
|
}
|
|
256
72
|
const packageJson = JSON.parse(packageJsonFile);
|
|
257
73
|
const projectPackageJsonPath = joinPaths(projectRoot, "package.json");
|
|
258
|
-
const projectPackageJsonFile = await
|
|
74
|
+
const projectPackageJsonFile = await readFile(projectPackageJsonPath, "utf8");
|
|
259
75
|
if (!projectPackageJsonFile) {
|
|
260
76
|
github.error(
|
|
261
77
|
`Could not find \`package.json\` at ${projectPackageJsonPath}`
|
|
@@ -269,9 +85,9 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
269
85
|
);
|
|
270
86
|
if (projectPackageJson.version) {
|
|
271
87
|
packageJson.version = projectPackageJson.version;
|
|
272
|
-
await
|
|
88
|
+
await writeFile(
|
|
273
89
|
packageJsonPath,
|
|
274
|
-
await
|
|
90
|
+
await format(JSON.stringify(packageJson), {
|
|
275
91
|
parser: "json",
|
|
276
92
|
proseWrap: "preserve",
|
|
277
93
|
trailingComma: "none",
|
|
@@ -301,14 +117,14 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
301
117
|
);
|
|
302
118
|
return { success: true };
|
|
303
119
|
}
|
|
304
|
-
await replaceDepsAliases(packageRoot, context.root);
|
|
120
|
+
await replaceDepsAliases(jiti, packageRoot, context.root, packageManager);
|
|
305
121
|
await addPackageJsonGitHead(packageRoot);
|
|
306
122
|
const npmPublishCommandSegments = [`npm publish --json`];
|
|
307
123
|
const npmViewCommandSegments = [
|
|
308
124
|
`npm view ${packageName} versions dist-tags --json`
|
|
309
125
|
];
|
|
310
126
|
const registry = await Promise.resolve(
|
|
311
|
-
options.registry ?? (await
|
|
127
|
+
options.registry ?? (await getRegistry() || getNpmRegistry())
|
|
312
128
|
);
|
|
313
129
|
if (registry) {
|
|
314
130
|
npmPublishCommandSegments.push(`--registry="${registry}" `);
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
+
var _chunkHN5UXNLMjs = require('./chunk-HN5UXNLM.js');
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk3G7PNDZ5js = require('./chunk-3G7PNDZ5.js');
|
|
5
9
|
|
|
6
10
|
|
|
7
11
|
var _chunkQSTZP7MXjs = require('./chunk-QSTZP7MX.js');
|
|
@@ -14,10 +18,15 @@ var _chunkQSTZP7MXjs = require('./chunk-QSTZP7MX.js');
|
|
|
14
18
|
|
|
15
19
|
|
|
16
20
|
|
|
21
|
+
|
|
17
22
|
var _devkit = require('@nx/devkit');
|
|
18
23
|
var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
19
24
|
async function presetGeneratorFn(tree, options) {
|
|
20
25
|
const projectRoot = ".";
|
|
26
|
+
const packageManager = _nullishCoalesce(options.packageManager, () => ( "pnpm"));
|
|
27
|
+
const packageManagerVersion = _chunk3G7PNDZ5js.packageManagerVersions[packageManager];
|
|
28
|
+
const pmc = _devkit.getPackageManagerCommand.call(void 0, packageManager);
|
|
29
|
+
const lockFileName = _chunkHN5UXNLMjs.getLockFileName.call(void 0, packageManager);
|
|
21
30
|
options.description ??= `\u26A1The ${options.namespace ? options.namespace : options.name} monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.`;
|
|
22
31
|
options.namespace ??= options.organization;
|
|
23
32
|
_devkit.addProjectConfiguration.call(void 0, tree, `@${options.namespace}/${options.name}`, {
|
|
@@ -85,11 +94,6 @@ async function presetGeneratorFn(tree, options) {
|
|
|
85
94
|
type: "github",
|
|
86
95
|
url: `${options.repositoryUrl}.git`
|
|
87
96
|
};
|
|
88
|
-
json.packageManager ??= "pnpm@10.3.0";
|
|
89
|
-
json.engines ??= {
|
|
90
|
-
node: ">=20.11.0",
|
|
91
|
-
pnpm: ">=10.3.0"
|
|
92
|
-
};
|
|
93
97
|
json.prettier = "@storm-software/prettier/config.json";
|
|
94
98
|
json.nx ??= {
|
|
95
99
|
includedScripts: [
|
|
@@ -106,14 +110,14 @@ async function presetGeneratorFn(tree, options) {
|
|
|
106
110
|
"release"
|
|
107
111
|
]
|
|
108
112
|
};
|
|
109
|
-
json.scripts.adr = "
|
|
110
|
-
json.scripts["adr-preview"] = "
|
|
111
|
-
json.scripts.prepare =
|
|
112
|
-
json.scripts.preinstall =
|
|
113
|
-
json.scripts["install-csb"] = "corepack enable &&
|
|
113
|
+
json.scripts.adr = pmc.run("log4brains", "adr new");
|
|
114
|
+
json.scripts["adr-preview"] = pmc.run("log4brains", "preview");
|
|
115
|
+
json.scripts.prepare = `${pmc.addDev} lefthook && ${packageManager} lefthook install`;
|
|
116
|
+
json.scripts.preinstall = `npx -y only-allow ${packageManager}`;
|
|
117
|
+
json.scripts["install-csb"] = packageManager === "bun" ? "bun install" : `corepack enable && ${pmc.install}`;
|
|
114
118
|
json.scripts.clean = "rimraf dist && rimraf --glob packages/**/dist && rimraf --glob tools/**/dist && rimraf --glob docs/**/dist && rimraf --glob apps/**/dist && rimraf --glob libs/**/dist";
|
|
115
|
-
json.scripts.nuke =
|
|
116
|
-
json.scripts.prebuild =
|
|
119
|
+
json.scripts.nuke = `nx clear-cache && rimraf .nx/cache && rimraf .nx/workspace-data && ${packageManager} clean && rimraf ${lockFileName} && rimraf --glob packages/**/node_modules && rimraf --glob tools/**/node_modules && rimraf node_modules`;
|
|
120
|
+
json.scripts.prebuild = `${packageManager} clean`;
|
|
117
121
|
json.scripts.build = "nx affected -t build --parallel=5";
|
|
118
122
|
json.scripts["build-all"] = "nx run-many -t build --all --parallel=5";
|
|
119
123
|
json.scripts["build-prod"] = "nx run-many -t build --all --prod --parallel=5";
|
|
@@ -128,45 +132,53 @@ async function presetGeneratorFn(tree, options) {
|
|
|
128
132
|
}
|
|
129
133
|
json.scripts.nx = "nx";
|
|
130
134
|
json.scripts.graph = "nx graph";
|
|
131
|
-
json.scripts.lint = "pnpm storm-lint all --skip-cspell --skip-alex";
|
|
132
135
|
if (options.includeApps) {
|
|
133
136
|
json.scripts.start = "nx serve";
|
|
134
|
-
json.scripts.storybook = "
|
|
137
|
+
json.scripts.storybook = pmc.run("storybook", "dev -p 6006");
|
|
135
138
|
}
|
|
136
139
|
json.scripts.help = "nx help";
|
|
137
140
|
json.scripts["dep-graph"] = "nx dep-graph";
|
|
138
141
|
json.scripts["local-registry"] = `nx local-registry @${options.namespace}/${options.name}`;
|
|
139
142
|
json.scripts.e2e = "nx e2e";
|
|
140
143
|
if (options.includeApps) {
|
|
141
|
-
json.scripts.test =
|
|
142
|
-
json.scripts["test-storybook"] =
|
|
144
|
+
json.scripts.test = `nx test && ${packageManager} test-storybook`;
|
|
145
|
+
json.scripts["test-storybook"] = `${packageManager} test-storybook`;
|
|
143
146
|
} else {
|
|
144
147
|
json.scripts.test = "nx test";
|
|
145
148
|
}
|
|
146
|
-
json.scripts.
|
|
147
|
-
json.scripts
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
json.scripts.commit = pmc.run("storm-git", "commit");
|
|
150
|
+
json.scripts["api-extractor"] = pmc.run(
|
|
151
|
+
"storm-docs",
|
|
152
|
+
'api-extractor --outputPath="docs/api-reference" --clean'
|
|
153
|
+
);
|
|
154
|
+
json.scripts.release = pmc.run("storm-git", "release");
|
|
150
155
|
json.scripts.format = "nx format:write";
|
|
151
|
-
json.scripts["format-sherif"] =
|
|
152
|
-
json.scripts["format-toml"] =
|
|
153
|
-
json.scripts["format-readme"] =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
json.scripts["
|
|
158
|
-
json.scripts
|
|
159
|
-
json.
|
|
156
|
+
json.scripts["format-sherif"] = `${pmc.exec} sherif -f -i typescript -i react -i react-dom`;
|
|
157
|
+
json.scripts["format-toml"] = `${pmc.exec} taplo format --config="./node_modules/@storm-software/linting-tools/taplo/config.toml" --cache-path="./node_modules/.cache/storm/taplo"`;
|
|
158
|
+
json.scripts["format-readme"] = pmc.run(
|
|
159
|
+
"storm-git",
|
|
160
|
+
'readme --templates="tools/readme-templates"'
|
|
161
|
+
);
|
|
162
|
+
json.scripts["format-prettier"] = `${pmc.exec} prettier --write --ignore-unknown --no-error-on-unmatched-pattern --cache && git update-index`;
|
|
163
|
+
json.scripts.lint = pmc.run("storm-lint", "all --skip-cspell");
|
|
164
|
+
json.scripts["lint-knip"] = `${pmc.exec} knip`;
|
|
165
|
+
json.scripts["lint-sherif"] = `${pmc.exec} sherif -i typescript -i react -i react-dom`;
|
|
166
|
+
json.scripts["lint-ls"] = `${pmc.exec} ls-lint --config="./node_modules/@storm-software/linting-tools/ls-lint/ls-lint.yml"`;
|
|
167
|
+
json.packageManager ??= `${packageManager}@${packageManagerVersion}`;
|
|
160
168
|
json.engines = {
|
|
161
|
-
node: `>=${
|
|
162
|
-
|
|
169
|
+
node: `>=${_chunk3G7PNDZ5js.nodeVersion}`,
|
|
170
|
+
[packageManager]: `>=${packageManagerVersion}`
|
|
163
171
|
};
|
|
164
172
|
return json;
|
|
165
173
|
});
|
|
166
174
|
_devkit.generateFiles.call(void 0, tree, path.join(__dirname, "files"), projectRoot, {
|
|
167
175
|
...options,
|
|
168
|
-
|
|
169
|
-
|
|
176
|
+
packageManager,
|
|
177
|
+
packageManagerVersion,
|
|
178
|
+
pnpmVersion: _chunk3G7PNDZ5js.pnpmVersion,
|
|
179
|
+
nodeVersion: _chunk3G7PNDZ5js.nodeVersion,
|
|
180
|
+
lockFileName,
|
|
181
|
+
exec: pmc.exec
|
|
170
182
|
});
|
|
171
183
|
await _devkit.formatFiles.call(void 0, tree);
|
|
172
184
|
let dependencies = {
|
|
@@ -21,10 +21,17 @@ var _yarnparser = require('nx/src/plugins/js/lock-file/yarn-parser');
|
|
|
21
21
|
var YARN_LOCK_FILE = "yarn.lock";
|
|
22
22
|
var NPM_LOCK_FILE = "package-lock.json";
|
|
23
23
|
var PNPM_LOCK_FILE = "pnpm-lock.yaml";
|
|
24
|
-
var
|
|
24
|
+
var BUN_LOCK_FILE = "bun.lock";
|
|
25
|
+
var LOCK_FILES = [
|
|
26
|
+
YARN_LOCK_FILE,
|
|
27
|
+
NPM_LOCK_FILE,
|
|
28
|
+
PNPM_LOCK_FILE,
|
|
29
|
+
BUN_LOCK_FILE
|
|
30
|
+
];
|
|
25
31
|
var YARN_LOCK_PATH = _path.join.call(void 0, _devkit.workspaceRoot, YARN_LOCK_FILE);
|
|
26
32
|
var NPM_LOCK_PATH = _path.join.call(void 0, _devkit.workspaceRoot, NPM_LOCK_FILE);
|
|
27
33
|
var PNPM_LOCK_PATH = _path.join.call(void 0, _devkit.workspaceRoot, PNPM_LOCK_FILE);
|
|
34
|
+
var BUN_LOCK_PATH = _path.join.call(void 0, _devkit.workspaceRoot, BUN_LOCK_FILE);
|
|
28
35
|
function getLockFileNodes(packageManager, contents, lockFileHash, context) {
|
|
29
36
|
try {
|
|
30
37
|
if (packageManager === "yarn") {
|
|
@@ -97,21 +104,30 @@ function lockFileExists(packageManager) {
|
|
|
97
104
|
if (packageManager === "npm") {
|
|
98
105
|
return _fs.existsSync.call(void 0, NPM_LOCK_PATH);
|
|
99
106
|
}
|
|
107
|
+
if (packageManager === "bun") {
|
|
108
|
+
return _fs.existsSync.call(void 0, BUN_LOCK_PATH) || _fs.existsSync.call(void 0, _path.join.call(void 0, _devkit.workspaceRoot, "bun.lockb"));
|
|
109
|
+
}
|
|
100
110
|
throw new Error(
|
|
101
111
|
`Unknown package manager ${packageManager} or lock file missing`
|
|
102
112
|
);
|
|
103
113
|
}
|
|
114
|
+
var LOCK_FILE_BY_PACKAGE_MANAGER = {
|
|
115
|
+
npm: "package-lock.json",
|
|
116
|
+
yarn: "yarn.lock",
|
|
117
|
+
pnpm: "pnpm-lock.yaml",
|
|
118
|
+
bun: "bun.lock"
|
|
119
|
+
};
|
|
120
|
+
var OTHER_LOCK_FILES = {
|
|
121
|
+
npm: ["yarn.lock", "pnpm-lock.yaml", "bun.lock", "bun.lockb"],
|
|
122
|
+
yarn: ["package-lock.json", "pnpm-lock.yaml", "bun.lock", "bun.lockb"],
|
|
123
|
+
pnpm: ["package-lock.json", "yarn.lock", "bun.lock", "bun.lockb"],
|
|
124
|
+
bun: ["package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb"]
|
|
125
|
+
};
|
|
104
126
|
function getLockFileName(packageManager) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return PNPM_LOCK_FILE;
|
|
110
|
-
}
|
|
111
|
-
if (packageManager === "npm") {
|
|
112
|
-
return NPM_LOCK_FILE;
|
|
113
|
-
}
|
|
114
|
-
throw new Error(`Unknown package manager: ${packageManager}`);
|
|
127
|
+
return LOCK_FILE_BY_PACKAGE_MANAGER[packageManager];
|
|
128
|
+
}
|
|
129
|
+
function getOtherLockFileNames(packageManager) {
|
|
130
|
+
return OTHER_LOCK_FILES[packageManager];
|
|
115
131
|
}
|
|
116
132
|
function errorBodyLines(originalError, additionalInfo = []) {
|
|
117
133
|
const result = [
|
|
@@ -145,4 +161,9 @@ function isPostInstallProcess() {
|
|
|
145
161
|
|
|
146
162
|
|
|
147
163
|
|
|
148
|
-
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
exports.YARN_LOCK_FILE = YARN_LOCK_FILE; exports.NPM_LOCK_FILE = NPM_LOCK_FILE; exports.PNPM_LOCK_FILE = PNPM_LOCK_FILE; exports.BUN_LOCK_FILE = BUN_LOCK_FILE; exports.LOCK_FILES = LOCK_FILES; exports.YARN_LOCK_PATH = YARN_LOCK_PATH; exports.NPM_LOCK_PATH = NPM_LOCK_PATH; exports.PNPM_LOCK_PATH = PNPM_LOCK_PATH; exports.BUN_LOCK_PATH = BUN_LOCK_PATH; exports.getLockFileNodes = getLockFileNodes; exports.getLockFileDependencies = getLockFileDependencies; exports.lockFileExists = lockFileExists; exports.LOCK_FILE_BY_PACKAGE_MANAGER = LOCK_FILE_BY_PACKAGE_MANAGER; exports.OTHER_LOCK_FILES = OTHER_LOCK_FILES; exports.getLockFileName = getLockFileName; exports.getOtherLockFileNames = getOtherLockFileNames;
|