@storm-software/workspace-tools 1.21.11 → 1.21.13
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 +14 -0
- package/README.md +1 -1
- package/index.js +1501 -1456
- package/{meta.cjs.json → meta.json} +1 -1
- package/package.json +2 -2
- package/src/base/index.js +196 -183
- package/src/executors/tsup/executor.js +1422 -1411
- package/src/executors/tsup/get-config.js +781 -772
- package/src/executors/tsup-neutral/executor.js +1423 -1411
- package/src/executors/tsup-node/executor.js +1423 -1411
- package/src/generators/config-schema/generator.js +386 -384
- package/src/generators/init/init.js +202 -203
- package/src/generators/node-library/generator.js +677 -675
- package/src/generators/preset/generator.js +375 -373
- package/src/utils/index.js +83 -36
- package/index.cjs +0 -118316
- package/meta.esm.json +0 -1
- package/src/base/index.cjs +0 -12341
- package/src/executors/tsup/executor.cjs +0 -116187
- package/src/executors/tsup/get-config.cjs +0 -71069
- package/src/executors/tsup-neutral/executor.cjs +0 -116261
- package/src/executors/tsup-node/executor.cjs +0 -116257
- package/src/generators/config-schema/generator.cjs +0 -31471
- package/src/generators/init/init.cjs +0 -18290
- package/src/generators/node-library/generator.cjs +0 -48225
- package/src/generators/preset/generator.cjs +0 -30634
- package/src/utils/index.cjs +0 -381
package/src/utils/index.cjs
DELETED
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/workspace-tools/src/utils/index.ts
|
|
20
|
-
var utils_exports = {};
|
|
21
|
-
__export(utils_exports, {
|
|
22
|
-
WorkspaceStorage: () => WorkspaceStorage,
|
|
23
|
-
applyWorkspaceExecutorTokens: () => applyWorkspaceExecutorTokens,
|
|
24
|
-
applyWorkspaceGeneratorTokens: () => applyWorkspaceGeneratorTokens,
|
|
25
|
-
applyWorkspaceTokens: () => applyWorkspaceTokens,
|
|
26
|
-
eslintVersion: () => eslintVersion,
|
|
27
|
-
findCacheDirectory: () => findCacheDirectory,
|
|
28
|
-
findFileName: () => findFileName,
|
|
29
|
-
getFileBanner: () => getFileBanner,
|
|
30
|
-
getProjectConfigurations: () => getProjectConfigurations,
|
|
31
|
-
getWorkspaceRoot: () => getWorkspaceRoot,
|
|
32
|
-
lintStagedVersion: () => lintStagedVersion,
|
|
33
|
-
nodeVersion: () => nodeVersion,
|
|
34
|
-
nxVersion: () => nxVersion,
|
|
35
|
-
pnpmVersion: () => pnpmVersion,
|
|
36
|
-
prettierPackageJsonVersion: () => prettierPackageJsonVersion,
|
|
37
|
-
prettierPrismaVersion: () => prettierPrismaVersion,
|
|
38
|
-
prettierVersion: () => prettierVersion,
|
|
39
|
-
removeExtension: () => removeExtension,
|
|
40
|
-
semanticReleaseVersion: () => semanticReleaseVersion,
|
|
41
|
-
swcCliVersion: () => swcCliVersion,
|
|
42
|
-
swcCoreVersion: () => swcCoreVersion,
|
|
43
|
-
swcHelpersVersion: () => swcHelpersVersion,
|
|
44
|
-
swcNodeVersion: () => swcNodeVersion,
|
|
45
|
-
tsLibVersion: () => tsLibVersion,
|
|
46
|
-
tsupVersion: () => tsupVersion,
|
|
47
|
-
typesNodeVersion: () => typesNodeVersion,
|
|
48
|
-
typescriptVersion: () => typescriptVersion,
|
|
49
|
-
verdaccioVersion: () => verdaccioVersion
|
|
50
|
-
});
|
|
51
|
-
module.exports = __toCommonJS(utils_exports);
|
|
52
|
-
|
|
53
|
-
// packages/workspace-tools/src/utils/get-workspace-root.ts
|
|
54
|
-
var import_find_workspace_root = require("nx/src/utils/find-workspace-root.js");
|
|
55
|
-
var getWorkspaceRoot = () => {
|
|
56
|
-
const root = (0, import_find_workspace_root.findWorkspaceRoot)(process.cwd());
|
|
57
|
-
process.env.STORM_REPO_ROOT ??= root?.dir;
|
|
58
|
-
process.env.NX_WORKSPACE_ROOT_PATH ??= root?.dir;
|
|
59
|
-
return root?.dir;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// packages/workspace-tools/src/utils/apply-workspace-tokens.ts
|
|
63
|
-
var applyWorkspaceExecutorTokens = (option, tokenizerOptions) => {
|
|
64
|
-
let result = option;
|
|
65
|
-
if (!result) {
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
let projectName;
|
|
69
|
-
let projectRoot;
|
|
70
|
-
let sourceRoot;
|
|
71
|
-
if (tokenizerOptions?.projectName) {
|
|
72
|
-
const context = tokenizerOptions;
|
|
73
|
-
projectName = context.projectName;
|
|
74
|
-
projectRoot = context.root;
|
|
75
|
-
sourceRoot = context.sourceRoot;
|
|
76
|
-
} else {
|
|
77
|
-
const projectConfig = tokenizerOptions;
|
|
78
|
-
projectName = projectConfig.name;
|
|
79
|
-
projectRoot = projectConfig.root;
|
|
80
|
-
sourceRoot = projectConfig.sourceRoot;
|
|
81
|
-
}
|
|
82
|
-
if (tokenizerOptions.config) {
|
|
83
|
-
const configKeys = Object.keys(tokenizerOptions.config);
|
|
84
|
-
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
|
|
85
|
-
configKeys.forEach((configKey) => {
|
|
86
|
-
if (result.includes(`{${configKey}}`)) {
|
|
87
|
-
result = result.replaceAll(
|
|
88
|
-
`{${configKey}}`,
|
|
89
|
-
tokenizerOptions.config[configKey]
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (result.includes("{projectName}")) {
|
|
96
|
-
result = result.replaceAll("{projectName}", projectName);
|
|
97
|
-
}
|
|
98
|
-
if (result.includes("{projectRoot}")) {
|
|
99
|
-
result = result.replaceAll("{projectRoot}", projectRoot);
|
|
100
|
-
}
|
|
101
|
-
if (result.includes("{sourceRoot}")) {
|
|
102
|
-
result = result.replaceAll("{sourceRoot}", sourceRoot);
|
|
103
|
-
}
|
|
104
|
-
if (result.includes("{workspaceRoot}")) {
|
|
105
|
-
result = result.replaceAll(
|
|
106
|
-
"{workspaceRoot}",
|
|
107
|
-
tokenizerOptions.workspaceRoot ?? getWorkspaceRoot()
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
};
|
|
112
|
-
var applyWorkspaceGeneratorTokens = (option, tokenizerOptions) => {
|
|
113
|
-
let result = option;
|
|
114
|
-
if (!result) {
|
|
115
|
-
return result;
|
|
116
|
-
}
|
|
117
|
-
if (tokenizerOptions.config) {
|
|
118
|
-
const configKeys = Object.keys(tokenizerOptions.config);
|
|
119
|
-
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
|
|
120
|
-
configKeys.forEach((configKey) => {
|
|
121
|
-
if (result.includes(`{${configKey}}`)) {
|
|
122
|
-
result = result.replaceAll(
|
|
123
|
-
`{${configKey}}`,
|
|
124
|
-
tokenizerOptions.config[configKey]
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
if (result.includes("{workspaceRoot}")) {
|
|
131
|
-
result = result.replaceAll(
|
|
132
|
-
"{workspaceRoot}",
|
|
133
|
-
tokenizerOptions.workspaceRoot ?? tokenizerOptions.config.workspaceRoot ?? getWorkspaceRoot()
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
return result;
|
|
137
|
-
};
|
|
138
|
-
var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
139
|
-
let result = options;
|
|
140
|
-
if (!result) {
|
|
141
|
-
return {};
|
|
142
|
-
}
|
|
143
|
-
return Object.keys(options).reduce(
|
|
144
|
-
(ret, option) => {
|
|
145
|
-
if (typeof options[option] === "string") {
|
|
146
|
-
ret[option] = tokenizerFn(options[option], config);
|
|
147
|
-
} else if (Array.isArray(options[option])) {
|
|
148
|
-
ret[option] = options[option].map(
|
|
149
|
-
(item) => typeof item === "string" ? tokenizerFn(item, config) : item
|
|
150
|
-
);
|
|
151
|
-
} else if (typeof options[option] === "object") {
|
|
152
|
-
ret[option] = applyWorkspaceTokens(
|
|
153
|
-
options[option],
|
|
154
|
-
config,
|
|
155
|
-
tokenizerFn
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
return ret;
|
|
159
|
-
},
|
|
160
|
-
{}
|
|
161
|
-
);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
// packages/workspace-tools/src/utils/file-path-utils.ts
|
|
165
|
-
var import_node_path = require("node:path");
|
|
166
|
-
var removeExtension = (filePath) => {
|
|
167
|
-
return filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
|
|
168
|
-
};
|
|
169
|
-
function findFileName(filePath) {
|
|
170
|
-
return filePath?.split(
|
|
171
|
-
filePath?.includes(import_node_path.sep) ? import_node_path.sep : filePath?.includes("/") ? "/" : "\\"
|
|
172
|
-
)?.pop() ?? "";
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// packages/workspace-tools/src/utils/find-cache-dir.ts
|
|
176
|
-
var import_node_fs = require("node:fs");
|
|
177
|
-
var import_node_path2 = require("node:path");
|
|
178
|
-
var import_node_process = require("node:process");
|
|
179
|
-
var isWritable = (path) => {
|
|
180
|
-
try {
|
|
181
|
-
(0, import_node_fs.accessSync)(path, import_node_fs.constants.W_OK);
|
|
182
|
-
return true;
|
|
183
|
-
} catch {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
function useDirectory(directory, { create = true }) {
|
|
188
|
-
if (create) {
|
|
189
|
-
(0, import_node_fs.mkdirSync)(directory, { recursive: true });
|
|
190
|
-
}
|
|
191
|
-
return directory;
|
|
192
|
-
}
|
|
193
|
-
function getNodeModuleDirectory(workspaceRoot) {
|
|
194
|
-
const nodeModules = (0, import_node_path2.join)(workspaceRoot, "node_modules");
|
|
195
|
-
if ((0, import_node_fs.existsSync)(nodeModules) && !isWritable(nodeModules)) {
|
|
196
|
-
throw new Error("Cannot write to node_modules directory");
|
|
197
|
-
}
|
|
198
|
-
return nodeModules;
|
|
199
|
-
}
|
|
200
|
-
function findCacheDirectory({
|
|
201
|
-
name,
|
|
202
|
-
cacheName,
|
|
203
|
-
workspaceRoot,
|
|
204
|
-
create
|
|
205
|
-
} = {
|
|
206
|
-
name: "storm",
|
|
207
|
-
workspaceRoot: getWorkspaceRoot(),
|
|
208
|
-
create: true
|
|
209
|
-
}) {
|
|
210
|
-
if (import_node_process.env.CACHE_DIR && !["true", "false", "1", "0"].includes(import_node_process.env.CACHE_DIR)) {
|
|
211
|
-
return useDirectory((0, import_node_path2.join)(import_node_process.env.CACHE_DIR, name, cacheName), { create });
|
|
212
|
-
}
|
|
213
|
-
if (import_node_process.env.STORM_CACHE_DIR && !["true", "false", "1", "0"].includes(import_node_process.env.STORM_CACHE_DIR)) {
|
|
214
|
-
return useDirectory((0, import_node_path2.join)(import_node_process.env.STORM_CACHE_DIR, name, cacheName), {
|
|
215
|
-
create
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
const nodeModules = getNodeModuleDirectory(workspaceRoot);
|
|
219
|
-
if (!nodeModules) {
|
|
220
|
-
throw new Error("Cannot find node_modules directory");
|
|
221
|
-
}
|
|
222
|
-
return useDirectory(
|
|
223
|
-
(0, import_node_path2.join)(workspaceRoot, "node_modules", ".cache", name, cacheName),
|
|
224
|
-
{ create }
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// packages/workspace-tools/src/utils/get-file-banner.ts
|
|
229
|
-
var getFileBanner = (name, commentStart = "//") => {
|
|
230
|
-
let padding = "";
|
|
231
|
-
while (name.length + padding.length < 18) {
|
|
232
|
-
padding += " ";
|
|
233
|
-
}
|
|
234
|
-
return `
|
|
235
|
-
|
|
236
|
-
${commentStart} -------------------------------------------------------------------
|
|
237
|
-
${commentStart}
|
|
238
|
-
${commentStart} ${padding}Storm Software
|
|
239
|
-
${commentStart} \u26A1 ${process.env.STORM_NAMESPACE} - ${name}
|
|
240
|
-
${commentStart}
|
|
241
|
-
${commentStart} This code was released as part of the ${process.env.STORM_NAMESPACE} project. ${process.env.STORM_NAMESPACE}
|
|
242
|
-
${commentStart} is maintained by Storm Software under the {${process.env.STORM_LICENSE ?? "Apache License 2.0"}, and is
|
|
243
|
-
${commentStart} free for commercial and private use. For more information, please visit
|
|
244
|
-
${commentStart} our licensing page.
|
|
245
|
-
${commentStart}
|
|
246
|
-
${commentStart} Website: ${process.env.STORM_HOMEPAGE ?? "https://stormsoftware.org"}
|
|
247
|
-
${commentStart} Repository: ${process.env.STORM_REPOSITORY ?? "https://github.com/storm-software/storm-stack"}
|
|
248
|
-
${commentStart} Documentation: https://stormsoftware.org/docs/storm-stack
|
|
249
|
-
${commentStart} Contact: https://stormsoftware.org/contact
|
|
250
|
-
${commentStart} Licensing: https://stormsoftware.org/licensing
|
|
251
|
-
${commentStart}
|
|
252
|
-
${commentStart} -------------------------------------------------------------------
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
`;
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// packages/workspace-tools/src/utils/get-project-configurations.ts
|
|
259
|
-
var import_retrieve_workspace_files = require("nx/src/project-graph/utils/retrieve-workspace-files");
|
|
260
|
-
var getProjectConfigurations = () => (0, import_retrieve_workspace_files.retrieveProjectConfigurationsWithoutPluginInference)(
|
|
261
|
-
getWorkspaceRoot()
|
|
262
|
-
);
|
|
263
|
-
|
|
264
|
-
// packages/workspace-tools/src/utils/versions.ts
|
|
265
|
-
var tsupVersion = "^7.2.0";
|
|
266
|
-
var prettierPackageJsonVersion = "2.4.6";
|
|
267
|
-
var prettierPrismaVersion = "5.0.0";
|
|
268
|
-
var prettierVersion = "^3.0.3";
|
|
269
|
-
var swcCliVersion = "~0.1.62";
|
|
270
|
-
var swcCoreVersion = "~1.3.95";
|
|
271
|
-
var swcHelpersVersion = "~0.5.3";
|
|
272
|
-
var swcNodeVersion = "1.6.8";
|
|
273
|
-
var tsLibVersion = "2.6.2";
|
|
274
|
-
var typesNodeVersion = "20.9.0";
|
|
275
|
-
var verdaccioVersion = "5.27.0";
|
|
276
|
-
var typescriptVersion = "~5.2.2";
|
|
277
|
-
var eslintVersion = "~8.53.0";
|
|
278
|
-
var lintStagedVersion = "15.0.2";
|
|
279
|
-
var semanticReleaseVersion = "22.0.7";
|
|
280
|
-
var nxVersion = "^17.0.3";
|
|
281
|
-
var nodeVersion = "18.17.1";
|
|
282
|
-
var pnpmVersion = "8.10.2";
|
|
283
|
-
|
|
284
|
-
// packages/workspace-tools/src/utils/workspace-storage.ts
|
|
285
|
-
var import_node_fs2 = require("node:fs");
|
|
286
|
-
var import_node_path3 = require("node:path");
|
|
287
|
-
var WorkspaceStorage = class {
|
|
288
|
-
constructor({
|
|
289
|
-
cacheName,
|
|
290
|
-
workspaceRoot
|
|
291
|
-
}) {
|
|
292
|
-
this.cacheDir = findCacheDirectory({
|
|
293
|
-
name: "storm",
|
|
294
|
-
cacheName,
|
|
295
|
-
workspaceRoot,
|
|
296
|
-
create: true
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Get item from cache
|
|
301
|
-
*
|
|
302
|
-
* @param key - The key to get
|
|
303
|
-
* @returns The value of the key
|
|
304
|
-
*/
|
|
305
|
-
getItem(key) {
|
|
306
|
-
const cacheFile = (0, import_node_path3.join)(this.cacheDir, key);
|
|
307
|
-
if ((0, import_node_fs2.existsSync)(cacheFile)) {
|
|
308
|
-
return (0, import_node_fs2.readFileSync)(cacheFile, "utf-8");
|
|
309
|
-
}
|
|
310
|
-
return void 0;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Set item to cache
|
|
314
|
-
*
|
|
315
|
-
* @param key - The key to set
|
|
316
|
-
* @param value - The value to set
|
|
317
|
-
*/
|
|
318
|
-
setItem(key, value) {
|
|
319
|
-
(0, import_node_fs2.writeFileSync)((0, import_node_path3.join)(this.cacheDir, key), value, { encoding: "utf-8" });
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Remove item from cache
|
|
323
|
-
*
|
|
324
|
-
* @param key - The key to remove
|
|
325
|
-
*/
|
|
326
|
-
removeItem(key) {
|
|
327
|
-
(0, import_node_fs2.rmSync)((0, import_node_path3.join)(this.cacheDir, key), { force: true, recursive: true });
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Clear the cache
|
|
331
|
-
*/
|
|
332
|
-
clear() {
|
|
333
|
-
(0, import_node_fs2.readdirSync)(this.cacheDir).forEach((cacheFile) => {
|
|
334
|
-
(0, import_node_fs2.rmSync)(cacheFile, { force: true, recursive: true });
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Get the key at the index
|
|
339
|
-
*
|
|
340
|
-
* @param index - The index to get
|
|
341
|
-
* @returns The key at the index
|
|
342
|
-
*/
|
|
343
|
-
key(index) {
|
|
344
|
-
const files = (0, import_node_fs2.readdirSync)(this.cacheDir);
|
|
345
|
-
if (index < files.length && index >= 0) {
|
|
346
|
-
return files[index];
|
|
347
|
-
}
|
|
348
|
-
return void 0;
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
352
|
-
0 && (module.exports = {
|
|
353
|
-
WorkspaceStorage,
|
|
354
|
-
applyWorkspaceExecutorTokens,
|
|
355
|
-
applyWorkspaceGeneratorTokens,
|
|
356
|
-
applyWorkspaceTokens,
|
|
357
|
-
eslintVersion,
|
|
358
|
-
findCacheDirectory,
|
|
359
|
-
findFileName,
|
|
360
|
-
getFileBanner,
|
|
361
|
-
getProjectConfigurations,
|
|
362
|
-
getWorkspaceRoot,
|
|
363
|
-
lintStagedVersion,
|
|
364
|
-
nodeVersion,
|
|
365
|
-
nxVersion,
|
|
366
|
-
pnpmVersion,
|
|
367
|
-
prettierPackageJsonVersion,
|
|
368
|
-
prettierPrismaVersion,
|
|
369
|
-
prettierVersion,
|
|
370
|
-
removeExtension,
|
|
371
|
-
semanticReleaseVersion,
|
|
372
|
-
swcCliVersion,
|
|
373
|
-
swcCoreVersion,
|
|
374
|
-
swcHelpersVersion,
|
|
375
|
-
swcNodeVersion,
|
|
376
|
-
tsLibVersion,
|
|
377
|
-
tsupVersion,
|
|
378
|
-
typesNodeVersion,
|
|
379
|
-
typescriptVersion,
|
|
380
|
-
verdaccioVersion
|
|
381
|
-
});
|