@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.js
CHANGED
|
@@ -1,7 +1,59 @@
|
|
|
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
|
+
|
|
1
53
|
// packages/workspace-tools/src/utils/get-workspace-root.ts
|
|
2
|
-
|
|
54
|
+
var import_find_workspace_root = require("nx/src/utils/find-workspace-root.js");
|
|
3
55
|
var getWorkspaceRoot = () => {
|
|
4
|
-
const root = findWorkspaceRoot(process.cwd());
|
|
56
|
+
const root = (0, import_find_workspace_root.findWorkspaceRoot)(process.cwd());
|
|
5
57
|
process.env.STORM_REPO_ROOT ??= root?.dir;
|
|
6
58
|
process.env.NX_WORKSPACE_ROOT_PATH ??= root?.dir;
|
|
7
59
|
return root?.dir;
|
|
@@ -110,23 +162,23 @@ var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
|
110
162
|
};
|
|
111
163
|
|
|
112
164
|
// packages/workspace-tools/src/utils/file-path-utils.ts
|
|
113
|
-
|
|
165
|
+
var import_node_path = require("node:path");
|
|
114
166
|
var removeExtension = (filePath) => {
|
|
115
167
|
return filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
|
|
116
168
|
};
|
|
117
169
|
function findFileName(filePath) {
|
|
118
170
|
return filePath?.split(
|
|
119
|
-
filePath?.includes(sep) ? sep : filePath?.includes("/") ? "/" : "\\"
|
|
171
|
+
filePath?.includes(import_node_path.sep) ? import_node_path.sep : filePath?.includes("/") ? "/" : "\\"
|
|
120
172
|
)?.pop() ?? "";
|
|
121
173
|
}
|
|
122
174
|
|
|
123
175
|
// packages/workspace-tools/src/utils/find-cache-dir.ts
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
176
|
+
var import_node_fs = require("node:fs");
|
|
177
|
+
var import_node_path2 = require("node:path");
|
|
178
|
+
var import_node_process = require("node:process");
|
|
127
179
|
var isWritable = (path) => {
|
|
128
180
|
try {
|
|
129
|
-
accessSync(path, constants.W_OK);
|
|
181
|
+
(0, import_node_fs.accessSync)(path, import_node_fs.constants.W_OK);
|
|
130
182
|
return true;
|
|
131
183
|
} catch {
|
|
132
184
|
return false;
|
|
@@ -134,13 +186,13 @@ var isWritable = (path) => {
|
|
|
134
186
|
};
|
|
135
187
|
function useDirectory(directory, { create = true }) {
|
|
136
188
|
if (create) {
|
|
137
|
-
mkdirSync(directory, { recursive: true });
|
|
189
|
+
(0, import_node_fs.mkdirSync)(directory, { recursive: true });
|
|
138
190
|
}
|
|
139
191
|
return directory;
|
|
140
192
|
}
|
|
141
193
|
function getNodeModuleDirectory(workspaceRoot) {
|
|
142
|
-
const nodeModules = join(workspaceRoot, "node_modules");
|
|
143
|
-
if (existsSync(nodeModules) && !isWritable(nodeModules)) {
|
|
194
|
+
const nodeModules = (0, import_node_path2.join)(workspaceRoot, "node_modules");
|
|
195
|
+
if ((0, import_node_fs.existsSync)(nodeModules) && !isWritable(nodeModules)) {
|
|
144
196
|
throw new Error("Cannot write to node_modules directory");
|
|
145
197
|
}
|
|
146
198
|
return nodeModules;
|
|
@@ -155,11 +207,11 @@ function findCacheDirectory({
|
|
|
155
207
|
workspaceRoot: getWorkspaceRoot(),
|
|
156
208
|
create: true
|
|
157
209
|
}) {
|
|
158
|
-
if (env.CACHE_DIR && !["true", "false", "1", "0"].includes(env.CACHE_DIR)) {
|
|
159
|
-
return useDirectory(join(env.CACHE_DIR, name, cacheName), { create });
|
|
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 });
|
|
160
212
|
}
|
|
161
|
-
if (env.STORM_CACHE_DIR && !["true", "false", "1", "0"].includes(env.STORM_CACHE_DIR)) {
|
|
162
|
-
return useDirectory(join(env.STORM_CACHE_DIR, name, cacheName), {
|
|
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), {
|
|
163
215
|
create
|
|
164
216
|
});
|
|
165
217
|
}
|
|
@@ -168,7 +220,7 @@ function findCacheDirectory({
|
|
|
168
220
|
throw new Error("Cannot find node_modules directory");
|
|
169
221
|
}
|
|
170
222
|
return useDirectory(
|
|
171
|
-
join(workspaceRoot, "node_modules", ".cache", name, cacheName),
|
|
223
|
+
(0, import_node_path2.join)(workspaceRoot, "node_modules", ".cache", name, cacheName),
|
|
172
224
|
{ create }
|
|
173
225
|
);
|
|
174
226
|
}
|
|
@@ -204,8 +256,8 @@ ${commentStart} ----------------------------------------------------------------
|
|
|
204
256
|
};
|
|
205
257
|
|
|
206
258
|
// packages/workspace-tools/src/utils/get-project-configurations.ts
|
|
207
|
-
|
|
208
|
-
var getProjectConfigurations = () => retrieveProjectConfigurationsWithoutPluginInference(
|
|
259
|
+
var import_retrieve_workspace_files = require("nx/src/project-graph/utils/retrieve-workspace-files");
|
|
260
|
+
var getProjectConfigurations = () => (0, import_retrieve_workspace_files.retrieveProjectConfigurationsWithoutPluginInference)(
|
|
209
261
|
getWorkspaceRoot()
|
|
210
262
|
);
|
|
211
263
|
|
|
@@ -230,14 +282,8 @@ var nodeVersion = "18.17.1";
|
|
|
230
282
|
var pnpmVersion = "8.10.2";
|
|
231
283
|
|
|
232
284
|
// packages/workspace-tools/src/utils/workspace-storage.ts
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
readFileSync,
|
|
236
|
-
readdirSync,
|
|
237
|
-
rmSync,
|
|
238
|
-
writeFileSync
|
|
239
|
-
} from "node:fs";
|
|
240
|
-
import { join as join2 } from "node:path";
|
|
285
|
+
var import_node_fs2 = require("node:fs");
|
|
286
|
+
var import_node_path3 = require("node:path");
|
|
241
287
|
var WorkspaceStorage = class {
|
|
242
288
|
constructor({
|
|
243
289
|
cacheName,
|
|
@@ -257,9 +303,9 @@ var WorkspaceStorage = class {
|
|
|
257
303
|
* @returns The value of the key
|
|
258
304
|
*/
|
|
259
305
|
getItem(key) {
|
|
260
|
-
const cacheFile =
|
|
261
|
-
if (
|
|
262
|
-
return readFileSync(cacheFile, "utf-8");
|
|
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");
|
|
263
309
|
}
|
|
264
310
|
return void 0;
|
|
265
311
|
}
|
|
@@ -270,7 +316,7 @@ var WorkspaceStorage = class {
|
|
|
270
316
|
* @param value - The value to set
|
|
271
317
|
*/
|
|
272
318
|
setItem(key, value) {
|
|
273
|
-
writeFileSync(
|
|
319
|
+
(0, import_node_fs2.writeFileSync)((0, import_node_path3.join)(this.cacheDir, key), value, { encoding: "utf-8" });
|
|
274
320
|
}
|
|
275
321
|
/**
|
|
276
322
|
* Remove item from cache
|
|
@@ -278,14 +324,14 @@ var WorkspaceStorage = class {
|
|
|
278
324
|
* @param key - The key to remove
|
|
279
325
|
*/
|
|
280
326
|
removeItem(key) {
|
|
281
|
-
rmSync(
|
|
327
|
+
(0, import_node_fs2.rmSync)((0, import_node_path3.join)(this.cacheDir, key), { force: true, recursive: true });
|
|
282
328
|
}
|
|
283
329
|
/**
|
|
284
330
|
* Clear the cache
|
|
285
331
|
*/
|
|
286
332
|
clear() {
|
|
287
|
-
readdirSync(this.cacheDir).forEach((cacheFile) => {
|
|
288
|
-
rmSync(cacheFile, { force: true, recursive: true });
|
|
333
|
+
(0, import_node_fs2.readdirSync)(this.cacheDir).forEach((cacheFile) => {
|
|
334
|
+
(0, import_node_fs2.rmSync)(cacheFile, { force: true, recursive: true });
|
|
289
335
|
});
|
|
290
336
|
}
|
|
291
337
|
/**
|
|
@@ -295,14 +341,15 @@ var WorkspaceStorage = class {
|
|
|
295
341
|
* @returns The key at the index
|
|
296
342
|
*/
|
|
297
343
|
key(index) {
|
|
298
|
-
const files = readdirSync(this.cacheDir);
|
|
344
|
+
const files = (0, import_node_fs2.readdirSync)(this.cacheDir);
|
|
299
345
|
if (index < files.length && index >= 0) {
|
|
300
346
|
return files[index];
|
|
301
347
|
}
|
|
302
348
|
return void 0;
|
|
303
349
|
}
|
|
304
350
|
};
|
|
305
|
-
export
|
|
351
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
352
|
+
0 && (module.exports = {
|
|
306
353
|
WorkspaceStorage,
|
|
307
354
|
applyWorkspaceExecutorTokens,
|
|
308
355
|
applyWorkspaceGeneratorTokens,
|
|
@@ -331,4 +378,4 @@ export {
|
|
|
331
378
|
typesNodeVersion,
|
|
332
379
|
typescriptVersion,
|
|
333
380
|
verdaccioVersion
|
|
334
|
-
};
|
|
381
|
+
});
|