@storm-software/bun-tools 0.0.39 → 0.0.40
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 +15 -0
- package/bin/bun.cjs +59 -9
- package/bin/bun.js +59 -9
- package/dist/chunk-5XGB6SOS.cjs +3 -0
- package/dist/{chunk-A5XIRLT6.js → chunk-AD5LCW4J.js} +1 -1
- package/dist/{chunk-F3M3WZN6.cjs → chunk-ISMM6IAX.cjs} +1 -1
- package/dist/chunk-ZMUT65O7.js +3 -0
- package/dist/helpers/catalog.cjs +1 -1
- package/dist/helpers/catalog.js +1 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/replace-deps-aliases.cjs +1 -1
- package/dist/helpers/replace-deps-aliases.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-A6WN5WL5.js +0 -2
- package/dist/chunk-YDODSPMC.cjs +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Storm Ops - Bun Tools
|
|
4
4
|
|
|
5
|
+
## [0.0.40](https://github.com/storm-software/storm-ops/releases/tag/bun-tools%400.0.40) (08/08/2026)
|
|
6
|
+
|
|
7
|
+
### Miscellaneous
|
|
8
|
+
|
|
9
|
+
- **bun-tools:** Update `storm-bun` to include improved error logging ([97d65d1d3](https://github.com/storm-software/storm-ops/commit/97d65d1d3))
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
- **workspace-tools:** Resolve issue with `prettier-plugin-packagejson` imports ([b2f5d7b87](https://github.com/storm-software/storm-ops/commit/b2f5d7b87))
|
|
14
|
+
|
|
15
|
+
### Updated Dependencies
|
|
16
|
+
|
|
17
|
+
- Updated **config-tools** to **v1.190.129**
|
|
18
|
+
- Updated **npm-tools** to **v0.6.247**
|
|
19
|
+
|
|
5
20
|
## [0.0.39](https://github.com/storm-software/storm-ops/releases/tag/bun-tools%400.0.39) (08/08/2026)
|
|
6
21
|
|
|
7
22
|
### Bug Fixes
|
package/bin/bun.cjs
CHANGED
|
@@ -1233,6 +1233,34 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
|
1233
1233
|
return result;
|
|
1234
1234
|
}
|
|
1235
1235
|
|
|
1236
|
+
// ../config-tools/src/utilities/format-error-message.ts
|
|
1237
|
+
function formatErrorMessage(error) {
|
|
1238
|
+
if (error == null) {
|
|
1239
|
+
return "Unknown error";
|
|
1240
|
+
}
|
|
1241
|
+
if (typeof error === "string") {
|
|
1242
|
+
return error;
|
|
1243
|
+
}
|
|
1244
|
+
if (error instanceof Error) {
|
|
1245
|
+
const message = error.stack || error.message || error.name || "Unknown error";
|
|
1246
|
+
if (error.cause) {
|
|
1247
|
+
return `${message}
|
|
1248
|
+
Cause: ${formatErrorMessage(error.cause)}`;
|
|
1249
|
+
}
|
|
1250
|
+
return message;
|
|
1251
|
+
}
|
|
1252
|
+
if (typeof error === "object" && "message" in error && typeof error.message === "string" && error.message) {
|
|
1253
|
+
const stack = "stack" in error && typeof error.stack === "string" ? error.stack : "";
|
|
1254
|
+
return stack ? `${error.message}
|
|
1255
|
+
${stack}` : error.message;
|
|
1256
|
+
}
|
|
1257
|
+
try {
|
|
1258
|
+
return JSON.stringify(error, Object.getOwnPropertyNames(error), 2);
|
|
1259
|
+
} catch {
|
|
1260
|
+
return String(error);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1236
1264
|
// ../config-tools/src/utilities/get-default-config.ts
|
|
1237
1265
|
var import_node_fs2 = require("fs");
|
|
1238
1266
|
var import_promises = require("fs/promises");
|
|
@@ -2205,7 +2233,7 @@ var import_commander = require("commander");
|
|
|
2205
2233
|
// package.json
|
|
2206
2234
|
var package_default = {
|
|
2207
2235
|
name: "@storm-software/bun-tools",
|
|
2208
|
-
version: "0.0.
|
|
2236
|
+
version: "0.0.40",
|
|
2209
2237
|
private: false,
|
|
2210
2238
|
description: "A set of [Bun](https://bun.sh/) plugins and utilities for managing workspace packages/dependencies.",
|
|
2211
2239
|
repository: {
|
|
@@ -2352,6 +2380,20 @@ async function getNpmRegistry() {
|
|
|
2352
2380
|
var import_node_child_process3 = require("child_process");
|
|
2353
2381
|
var import_semver = require("semver");
|
|
2354
2382
|
var import_strip_ansi = __toESM(require("strip-ansi"), 1);
|
|
2383
|
+
var BENIGN_PACKAGE_MANAGER_STDERR_LINE = /^(npm warn|\[[\d.]+ms\]|\[sys\]|\[warn\] request took)/i;
|
|
2384
|
+
function filterBenignPackageManagerStderr(stderr) {
|
|
2385
|
+
return stderr.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0).filter((line) => !BENIGN_PACKAGE_MANAGER_STDERR_LINE.test(line)).join("\n").trim();
|
|
2386
|
+
}
|
|
2387
|
+
function extractPackageVersion(stdout) {
|
|
2388
|
+
const lines = (0, import_strip_ansi.default)(stdout).split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
2389
|
+
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
2390
|
+
const line = lines[index];
|
|
2391
|
+
if (line && (0, import_semver.valid)(line, true)) {
|
|
2392
|
+
return line;
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
return (0, import_strip_ansi.default)(stdout).trim();
|
|
2396
|
+
}
|
|
2355
2397
|
async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
2356
2398
|
const executable = options.executable || "npm";
|
|
2357
2399
|
const retries = options.retries ?? 3;
|
|
@@ -2374,13 +2416,16 @@ async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
|
2374
2416
|
// 10 MB
|
|
2375
2417
|
},
|
|
2376
2418
|
(error, stdout, stderr) => {
|
|
2419
|
+
const filteredStderr = stderr ? filterBenignPackageManagerStderr(stderr) : "";
|
|
2377
2420
|
if (error && !error.message.toLowerCase().trim().startsWith("npm warn")) {
|
|
2378
|
-
return reject(
|
|
2421
|
+
return reject(
|
|
2422
|
+
filteredStderr ? new Error(filteredStderr, { cause: error }) : error
|
|
2423
|
+
);
|
|
2379
2424
|
}
|
|
2380
|
-
if (
|
|
2381
|
-
return reject(
|
|
2425
|
+
if (filteredStderr) {
|
|
2426
|
+
return reject(new Error(filteredStderr));
|
|
2382
2427
|
}
|
|
2383
|
-
return resolve(stdout
|
|
2428
|
+
return resolve(extractPackageVersion(stdout));
|
|
2384
2429
|
}
|
|
2385
2430
|
);
|
|
2386
2431
|
})
|
|
@@ -2644,10 +2689,10 @@ function createProgram(config) {
|
|
|
2644
2689
|
writeFatal(
|
|
2645
2690
|
`A fatal error occurred while running the Storm bun CLI program:
|
|
2646
2691
|
|
|
2647
|
-
${error
|
|
2692
|
+
${formatErrorMessage(error)}`,
|
|
2648
2693
|
_config
|
|
2649
2694
|
);
|
|
2650
|
-
throw new Error(error
|
|
2695
|
+
throw new Error(formatErrorMessage(error), { cause: error });
|
|
2651
2696
|
}
|
|
2652
2697
|
}
|
|
2653
2698
|
async function updateAction(packages, options) {
|
|
@@ -2718,7 +2763,7 @@ async function updateAction(packages, options) {
|
|
|
2718
2763
|
} catch (error) {
|
|
2719
2764
|
writeFatal(
|
|
2720
2765
|
`A fatal error occurred while upgrading ${matchedPackage}:
|
|
2721
|
-
${
|
|
2766
|
+
${formatErrorMessage(error)}`,
|
|
2722
2767
|
_config
|
|
2723
2768
|
);
|
|
2724
2769
|
throw error;
|
|
@@ -2790,7 +2835,7 @@ ${changed.map(
|
|
|
2790
2835
|
} catch (error) {
|
|
2791
2836
|
writeFatal(
|
|
2792
2837
|
`A fatal error occurred while running storm-bun update:
|
|
2793
|
-
${
|
|
2838
|
+
${formatErrorMessage(error)}`,
|
|
2794
2839
|
_config
|
|
2795
2840
|
);
|
|
2796
2841
|
throw error;
|
|
@@ -2810,6 +2855,11 @@ void (async () => {
|
|
|
2810
2855
|
);
|
|
2811
2856
|
exitWithSuccess(config);
|
|
2812
2857
|
} catch (error) {
|
|
2858
|
+
writeFatal(
|
|
2859
|
+
`A fatal error occurred while running storm-bun:
|
|
2860
|
+
${formatErrorMessage(error)}`,
|
|
2861
|
+
config
|
|
2862
|
+
);
|
|
2813
2863
|
exitWithError(config);
|
|
2814
2864
|
process.exit(1);
|
|
2815
2865
|
}
|
package/bin/bun.js
CHANGED
|
@@ -1211,6 +1211,34 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
|
1211
1211
|
return result;
|
|
1212
1212
|
}
|
|
1213
1213
|
|
|
1214
|
+
// ../config-tools/src/utilities/format-error-message.ts
|
|
1215
|
+
function formatErrorMessage(error) {
|
|
1216
|
+
if (error == null) {
|
|
1217
|
+
return "Unknown error";
|
|
1218
|
+
}
|
|
1219
|
+
if (typeof error === "string") {
|
|
1220
|
+
return error;
|
|
1221
|
+
}
|
|
1222
|
+
if (error instanceof Error) {
|
|
1223
|
+
const message = error.stack || error.message || error.name || "Unknown error";
|
|
1224
|
+
if (error.cause) {
|
|
1225
|
+
return `${message}
|
|
1226
|
+
Cause: ${formatErrorMessage(error.cause)}`;
|
|
1227
|
+
}
|
|
1228
|
+
return message;
|
|
1229
|
+
}
|
|
1230
|
+
if (typeof error === "object" && "message" in error && typeof error.message === "string" && error.message) {
|
|
1231
|
+
const stack = "stack" in error && typeof error.stack === "string" ? error.stack : "";
|
|
1232
|
+
return stack ? `${error.message}
|
|
1233
|
+
${stack}` : error.message;
|
|
1234
|
+
}
|
|
1235
|
+
try {
|
|
1236
|
+
return JSON.stringify(error, Object.getOwnPropertyNames(error), 2);
|
|
1237
|
+
} catch {
|
|
1238
|
+
return String(error);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1214
1242
|
// ../config-tools/src/utilities/get-default-config.ts
|
|
1215
1243
|
import { existsSync as existsSync2 } from "node:fs";
|
|
1216
1244
|
import { readFile } from "node:fs/promises";
|
|
@@ -2183,7 +2211,7 @@ import { Command } from "commander";
|
|
|
2183
2211
|
// package.json
|
|
2184
2212
|
var package_default = {
|
|
2185
2213
|
name: "@storm-software/bun-tools",
|
|
2186
|
-
version: "0.0.
|
|
2214
|
+
version: "0.0.40",
|
|
2187
2215
|
private: false,
|
|
2188
2216
|
description: "A set of [Bun](https://bun.sh/) plugins and utilities for managing workspace packages/dependencies.",
|
|
2189
2217
|
repository: {
|
|
@@ -2330,6 +2358,20 @@ async function getNpmRegistry() {
|
|
|
2330
2358
|
import { exec as exec3 } from "node:child_process";
|
|
2331
2359
|
import { valid } from "semver";
|
|
2332
2360
|
import stripAnsi from "strip-ansi";
|
|
2361
|
+
var BENIGN_PACKAGE_MANAGER_STDERR_LINE = /^(npm warn|\[[\d.]+ms\]|\[sys\]|\[warn\] request took)/i;
|
|
2362
|
+
function filterBenignPackageManagerStderr(stderr) {
|
|
2363
|
+
return stderr.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0).filter((line) => !BENIGN_PACKAGE_MANAGER_STDERR_LINE.test(line)).join("\n").trim();
|
|
2364
|
+
}
|
|
2365
|
+
function extractPackageVersion(stdout) {
|
|
2366
|
+
const lines = stripAnsi(stdout).split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
2367
|
+
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
2368
|
+
const line = lines[index];
|
|
2369
|
+
if (line && valid(line, true)) {
|
|
2370
|
+
return line;
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
return stripAnsi(stdout).trim();
|
|
2374
|
+
}
|
|
2333
2375
|
async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
2334
2376
|
const executable = options.executable || "npm";
|
|
2335
2377
|
const retries = options.retries ?? 3;
|
|
@@ -2352,13 +2394,16 @@ async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
|
2352
2394
|
// 10 MB
|
|
2353
2395
|
},
|
|
2354
2396
|
(error, stdout, stderr) => {
|
|
2397
|
+
const filteredStderr = stderr ? filterBenignPackageManagerStderr(stderr) : "";
|
|
2355
2398
|
if (error && !error.message.toLowerCase().trim().startsWith("npm warn")) {
|
|
2356
|
-
return reject(
|
|
2399
|
+
return reject(
|
|
2400
|
+
filteredStderr ? new Error(filteredStderr, { cause: error }) : error
|
|
2401
|
+
);
|
|
2357
2402
|
}
|
|
2358
|
-
if (
|
|
2359
|
-
return reject(
|
|
2403
|
+
if (filteredStderr) {
|
|
2404
|
+
return reject(new Error(filteredStderr));
|
|
2360
2405
|
}
|
|
2361
|
-
return resolve(stdout
|
|
2406
|
+
return resolve(extractPackageVersion(stdout));
|
|
2362
2407
|
}
|
|
2363
2408
|
);
|
|
2364
2409
|
})
|
|
@@ -2622,10 +2667,10 @@ function createProgram(config) {
|
|
|
2622
2667
|
writeFatal(
|
|
2623
2668
|
`A fatal error occurred while running the Storm bun CLI program:
|
|
2624
2669
|
|
|
2625
|
-
${error
|
|
2670
|
+
${formatErrorMessage(error)}`,
|
|
2626
2671
|
_config
|
|
2627
2672
|
);
|
|
2628
|
-
throw new Error(error
|
|
2673
|
+
throw new Error(formatErrorMessage(error), { cause: error });
|
|
2629
2674
|
}
|
|
2630
2675
|
}
|
|
2631
2676
|
async function updateAction(packages, options) {
|
|
@@ -2696,7 +2741,7 @@ async function updateAction(packages, options) {
|
|
|
2696
2741
|
} catch (error) {
|
|
2697
2742
|
writeFatal(
|
|
2698
2743
|
`A fatal error occurred while upgrading ${matchedPackage}:
|
|
2699
|
-
${
|
|
2744
|
+
${formatErrorMessage(error)}`,
|
|
2700
2745
|
_config
|
|
2701
2746
|
);
|
|
2702
2747
|
throw error;
|
|
@@ -2768,7 +2813,7 @@ ${changed.map(
|
|
|
2768
2813
|
} catch (error) {
|
|
2769
2814
|
writeFatal(
|
|
2770
2815
|
`A fatal error occurred while running storm-bun update:
|
|
2771
|
-
${
|
|
2816
|
+
${formatErrorMessage(error)}`,
|
|
2772
2817
|
_config
|
|
2773
2818
|
);
|
|
2774
2819
|
throw error;
|
|
@@ -2788,6 +2833,11 @@ void (async () => {
|
|
|
2788
2833
|
);
|
|
2789
2834
|
exitWithSuccess(config);
|
|
2790
2835
|
} catch (error) {
|
|
2836
|
+
writeFatal(
|
|
2837
|
+
`A fatal error occurred while running storm-bun:
|
|
2838
|
+
${formatErrorMessage(error)}`,
|
|
2839
|
+
config
|
|
2840
|
+
);
|
|
2791
2841
|
exitWithError(config);
|
|
2792
2842
|
process.exit(1);
|
|
2793
2843
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var chunkWAL5SD4G_cjs=require('./chunk-WAL5SD4G.cjs'),chunk66TU3CP3_cjs=require('./chunk-66TU3CP3.cjs'),child_process=require('child_process'),semver=require('semver'),A=require('strip-ansi');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var A__default=/*#__PURE__*/_interopDefault(A);var O="https://registry.npmjs.org";var U="latest";var d=U;async function L(t="npm"){return new Promise((r,e)=>{child_process.exec(`${t} config get registry`,(o,a,f)=>o&&!o.message.toLowerCase().trim().startsWith("npm warn")?e(o):f&&!f.toLowerCase().trim().startsWith("npm warn")?e(f):r(a.trim()));})}async function _(){if(process.env.STORM_REGISTRY_NPM)return process.env.STORM_REGISTRY_NPM;let t=await chunk66TU3CP3_cjs.f();return t?.registry?.npm?t?.registry?.npm:O}var j=/^(npm warn|\[[\d.]+ms\]|\[sys\]|\[warn\] request took)/i;function B(t){return t.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0).filter(r=>!j.test(r)).join(`
|
|
2
|
+
`).trim()}function J(t){let r=A__default.default(t).split(/\r?\n/).map(e=>e.trim()).filter(Boolean);for(let e=r.length-1;e>=0;e-=1){let o=r[e];if(o&&semver.valid(o,true))return o}return A__default.default(t).trim()}async function v(t,r=d,e={}){let o=e.executable||"npm",a=e.retries??3,f=e.timeout??1e4,u=e.registry||await L(o),g;for(let n=0;n<=a;n++)try{let c=new AbortController,s=setTimeout(()=>{c.abort();},f),i=await Promise.resolve(new Promise((k,G)=>{child_process.exec(`${o} view ${t} version --registry=${u}`,{signal:c.signal,maxBuffer:1024*1024*10},($,F,C)=>{let T=C?B(C):"";return $&&!$.message.toLowerCase().trim().startsWith("npm warn")?G(T?new Error(T,{cause:$}):$):T?G(new Error(T)):k(J(F))});}));if(!semver.valid(i,!0))throw clearTimeout(s),new Error(A__default.default(i).startsWith("[WARN] Request took")?`A timeout occurred while fetching the version for package "${t}" with tag "${r}".`:`Invalid version "${i}" fetched for package "${t}" with tag "${r}"`);return clearTimeout(s),i}catch(c){if(g=c,n<a){let s=Math.pow(2,n)*100;await new Promise(i=>setTimeout(i,s));}}throw g}async function H(t=chunk66TU3CP3_cjs.e(process.cwd())){let r=await chunk66TU3CP3_cjs.i(t);if(!r){chunk66TU3CP3_cjs.a(`No package.json file found in workspace root: ${t}`,{logLevel:"all"});return}let e=chunk66TU3CP3_cjs.j(r);if(e)return Object.fromEntries(Object.entries(e).map(([o,a])=>[o,a.replaceAll('"',"").replaceAll("'","")]));console.warn(`No catalog found in package.json file located in workspace root: ${t}
|
|
3
|
+
File content: ${JSON.stringify(r,null,2)}`);}async function q(t=chunk66TU3CP3_cjs.e(process.cwd())){let r=await H(t);if(!r)throw new Error("No catalog entries found in workspace root package.json file");return r}async function X(t,r=chunk66TU3CP3_cjs.e(process.cwd())){let e=await chunk66TU3CP3_cjs.i(r);if(!e)throw new Error("No package.json file found in workspace root");chunk66TU3CP3_cjs.k(e,Object.fromEntries(Object.entries(t).filter(([,o])=>o&&(o.startsWith("npm:")||semver.valid(chunkWAL5SD4G_cjs.a(o),true))).map(([o,a])=>[o,a.replaceAll('"',"").replaceAll("'","")]))),await chunk66TU3CP3_cjs.l(e,r);}async function Rt(t,r,e={}){let{tag:o=d,prefix:a="^",workspaceRoot:f=chunk66TU3CP3_cjs.e(),verbose:u=false}=e,g=await chunk66TU3CP3_cjs.g(true,{workspaceRoot:f});u&&chunk66TU3CP3_cjs.c(`Upgrading catalog entry for package "${r}" with tag "${o}"`,g);let n=await _(),c=await v(r,o,{executable:"bun pm",registry:n});if(!c)throw new Error(`Failed to fetch version for package "${r}" with tag "${o}"`);if(!semver.valid(chunkWAL5SD4G_cjs.a(c),true))throw new Error(`Invalid version "${c}" fetched for package "${r}" with tag "${o}"`);let s=`${a||""}${chunkWAL5SD4G_cjs.a(c)}`,i=false;return t[r]?.startsWith("npm:")?(t[r]=s,chunk66TU3CP3_cjs.b(`Writing version ${t[r]} to catalog for "${r}" package`,g)):!semver.valid(semver.coerce(t[r]))||semver.coerce(t[r])&&semver.coerce(s)&&semver.gt(semver.coerce(s),semver.coerce(t[r]))?(t[r]=`${a||""}${chunkWAL5SD4G_cjs.a(s)}`,chunk66TU3CP3_cjs.b(`Writing version ${t[r]} to catalog for "${r}" package`,g),i=true):u&&chunk66TU3CP3_cjs.b(`The current version ${t[r]} for package "${r}" is greater than or equal to the version ${chunkWAL5SD4G_cjs.a(s)} fetched from the npm registry with tag "${o}". No update performed.`,g),{catalog:t,updated:i}}async function xt(t,r={}){let{tag:e=d,prefix:o="^",throwIfMissingInCatalog:a=false,workspaceRoot:f=chunk66TU3CP3_cjs.e(),verbose:u=false}=r,g=await chunk66TU3CP3_cjs.g(true,{workspaceRoot:f}),n=await q(f);if(!n)throw new Error("No catalog found");if(a===true&&!n[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(n,null,2)}`);u&&chunk66TU3CP3_cjs.c(`Upgrading catalog entry for package "${t}" with tag "${e}"`,g);let c=await _(),s=await v(t,e,{executable:"bun pm",registry:c});if(!s)throw new Error(`Failed to fetch version for package "${t}" with tag "${e}"`);if(!semver.valid(chunkWAL5SD4G_cjs.a(s),true))throw new Error(`Invalid version "${s}" fetched for package "${t}" with tag "${e}"`);let i=`${o||""}${chunkWAL5SD4G_cjs.a(s)}`;i===n[t]?u&&chunk66TU3CP3_cjs.c(`The version for package "${t}" is already up to date in the catalog: ${i}`,g):!semver.valid(chunkWAL5SD4G_cjs.a(n[t]),true)||semver.coerce(n[t])&&semver.coerce(i)&&semver.gt(semver.coerce(i),semver.coerce(n[t]))?(n[t]=`${o||""}${chunkWAL5SD4G_cjs.a(i)}`,chunk66TU3CP3_cjs.b(`Writing version ${n[t]} to catalog for "${t}" package`,g),await X(n,f)):u&&chunk66TU3CP3_cjs.a(`The current version "${n[t]}" for package "${t}" is greater than or equal to the version "${i}" fetched from the npm registry with tag "${e}". No update performed.`,g);}exports.a=H;exports.b=q;exports.c=X;exports.d=Rt;exports.e=xt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-ZMUT65O7.js';import {d,e}from'./chunk-6RUWDFGG.js';import {readCachedProjectGraph,createProjectGraphAsync}from'@nx/devkit';import {existsSync}from'node:fs';import {readFile,writeFile}from'node:fs/promises';import {format}from'prettier';import J from'prettier-plugin-packagejson';async function F(t=process.cwd(),f=e(t)){let g=d(t,"package.json"),l=await readFile(g,"utf8");if(!l)throw new Error("No package.json file found in package root: "+t);let s=await b(f),c=JSON.parse(l);if(!s){console.warn("No workspace catalog found. Skipping dependencies replacement for now.");return}for(let n of ["dependencies","devDependencies","peerDependencies"]){let o=c[n];if(o){for(let e of Object.keys(o))if(o[e]==="catalog:"){if(!s)throw new Error(`Dependency ${e} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`package.json\` file.`);let a=s[e];if(!a)throw new Error("Missing workspace catalog version for "+e);o[e]=a;}else if(o[e].startsWith("catalog:"))throw new Error("multiple named catalogs not supported")}}let r;try{r=readCachedProjectGraph();}catch{await createProjectGraphAsync(),r=readCachedProjectGraph();}let i={};r&&await Promise.all(Object.keys(r.nodes).map(async n=>{let o=r.nodes[n];if(o?.data.root){let e=d(f,o.data.root,"package.json");if(existsSync(e)){let a=await readFile(e,"utf8"),p=JSON.parse(a);p.private!==true&&(i[p.name]=p.version);}}}));for(let n of ["dependencies","devDependencies","peerDependencies"]){let o=c[n];if(o){for(let e of Object.keys(o))if(o[e].startsWith("workspace:"))if(i[e])o[e]=`^${i[e]}`;else throw new Error(`Workspace dependency ${e} not found in workspace packages.`)}}return writeFile(g,await format(JSON.stringify(c),{parser:"json",proseWrap:"preserve",trailingComma:"none",tabWidth:2,semi:true,singleQuote:false,quoteProps:"as-needed",insertPragma:false,bracketSameLine:true,printWidth:80,bracketSpacing:true,arrowParens:"avoid",endOfLine:"lf",plugins:[J]}))}export{F as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk5XGB6SOS_cjs=require('./chunk-5XGB6SOS.cjs'),chunk66TU3CP3_cjs=require('./chunk-66TU3CP3.cjs'),devkit=require('@nx/devkit'),fs=require('fs'),promises=require('fs/promises'),prettier=require('prettier'),J=require('prettier-plugin-packagejson');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var J__default=/*#__PURE__*/_interopDefault(J);async function x(t=process.cwd(),f=chunk66TU3CP3_cjs.e(t)){let g=chunk66TU3CP3_cjs.d(t,"package.json"),l=await promises.readFile(g,"utf8");if(!l)throw new Error("No package.json file found in package root: "+t);let s=await chunk5XGB6SOS_cjs.b(f),c=JSON.parse(l);if(!s){console.warn("No workspace catalog found. Skipping dependencies replacement for now.");return}for(let n of ["dependencies","devDependencies","peerDependencies"]){let o=c[n];if(o){for(let e of Object.keys(o))if(o[e]==="catalog:"){if(!s)throw new Error(`Dependency ${e} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`package.json\` file.`);let a=s[e];if(!a)throw new Error("Missing workspace catalog version for "+e);o[e]=a;}else if(o[e].startsWith("catalog:"))throw new Error("multiple named catalogs not supported")}}let r;try{r=devkit.readCachedProjectGraph();}catch{await devkit.createProjectGraphAsync(),r=devkit.readCachedProjectGraph();}let i={};r&&await Promise.all(Object.keys(r.nodes).map(async n=>{let o=r.nodes[n];if(o?.data.root){let e=chunk66TU3CP3_cjs.d(f,o.data.root,"package.json");if(fs.existsSync(e)){let a=await promises.readFile(e,"utf8"),p=JSON.parse(a);p.private!==true&&(i[p.name]=p.version);}}}));for(let n of ["dependencies","devDependencies","peerDependencies"]){let o=c[n];if(o){for(let e of Object.keys(o))if(o[e].startsWith("workspace:"))if(i[e])o[e]=`^${i[e]}`;else throw new Error(`Workspace dependency ${e} not found in workspace packages.`)}}return promises.writeFile(g,await prettier.format(JSON.stringify(c),{parser:"json",proseWrap:"preserve",trailingComma:"none",tabWidth:2,semi:true,singleQuote:false,quoteProps:"as-needed",insertPragma:false,bracketSameLine:true,printWidth:80,bracketSpacing:true,arrowParens:"avoid",endOfLine:"lf",plugins:[J__default.default]}))}exports.a=x;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-7QKHH2VM.js';import {i,a,j,e,k,l,g,c,b,f}from'./chunk-6RUWDFGG.js';import {exec}from'node:child_process';import {valid,coerce,gt}from'semver';import v from'strip-ansi';var U="https://registry.npmjs.org";var L="latest";var d=L;async function V(t="npm"){return new Promise((r,e)=>{exec(`${t} config get registry`,(o,a,f)=>o&&!o.message.toLowerCase().trim().startsWith("npm warn")?e(o):f&&!f.toLowerCase().trim().startsWith("npm warn")?e(f):r(a.trim()));})}async function A(){if(process.env.STORM_REGISTRY_NPM)return process.env.STORM_REGISTRY_NPM;let t=await f();return t?.registry?.npm?t?.registry?.npm:U}var B=/^(npm warn|\[[\d.]+ms\]|\[sys\]|\[warn\] request took)/i;function J(t){return t.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0).filter(r=>!B.test(r)).join(`
|
|
2
|
+
`).trim()}function H(t){let r=v(t).split(/\r?\n/).map(e=>e.trim()).filter(Boolean);for(let e=r.length-1;e>=0;e-=1){let o=r[e];if(o&&valid(o,true))return o}return v(t).trim()}async function G(t,r=d,e={}){let o=e.executable||"npm",a=e.retries??3,f=e.timeout??1e4,u=e.registry||await V(o),g;for(let n=0;n<=a;n++)try{let c=new AbortController,s=setTimeout(()=>{c.abort();},f),i=await Promise.resolve(new Promise((F,C)=>{exec(`${o} view ${t} version --registry=${u}`,{signal:c.signal,maxBuffer:1024*1024*10},($,Y,b)=>{let T=b?J(b):"";return $&&!$.message.toLowerCase().trim().startsWith("npm warn")?C(T?new Error(T,{cause:$}):$):T?C(new Error(T)):F(H(Y))});}));if(!valid(i,!0))throw clearTimeout(s),new Error(v(i).startsWith("[WARN] Request took")?`A timeout occurred while fetching the version for package "${t}" with tag "${r}".`:`Invalid version "${i}" fetched for package "${t}" with tag "${r}"`);return clearTimeout(s),i}catch(c){if(g=c,n<a){let s=Math.pow(2,n)*100;await new Promise(i=>setTimeout(i,s));}}throw g}async function q(t=e(process.cwd())){let r=await i(t);if(!r){a(`No package.json file found in workspace root: ${t}`,{logLevel:"all"});return}let e=j(r);if(e)return Object.fromEntries(Object.entries(e).map(([o,a])=>[o,a.replaceAll('"',"").replaceAll("'","")]));console.warn(`No catalog found in package.json file located in workspace root: ${t}
|
|
3
|
+
File content: ${JSON.stringify(r,null,2)}`);}async function X(t=e(process.cwd())){let r=await q(t);if(!r)throw new Error("No catalog entries found in workspace root package.json file");return r}async function K(t,r=e(process.cwd())){let e=await i(r);if(!e)throw new Error("No package.json file found in workspace root");k(e,Object.fromEntries(Object.entries(t).filter(([,o])=>o&&(o.startsWith("npm:")||valid(a$1(o),true))).map(([o,a])=>[o,a.replaceAll('"',"").replaceAll("'","")]))),await l(e,r);}async function xt(t,r,e$1={}){let{tag:o=d,prefix:a="^",workspaceRoot:f=e(),verbose:u=false}=e$1,g$1=await g(true,{workspaceRoot:f});u&&c(`Upgrading catalog entry for package "${r}" with tag "${o}"`,g$1);let n=await A(),c$1=await G(r,o,{executable:"bun pm",registry:n});if(!c$1)throw new Error(`Failed to fetch version for package "${r}" with tag "${o}"`);if(!valid(a$1(c$1),true))throw new Error(`Invalid version "${c$1}" fetched for package "${r}" with tag "${o}"`);let s=`${a||""}${a$1(c$1)}`,i=false;return t[r]?.startsWith("npm:")?(t[r]=s,b(`Writing version ${t[r]} to catalog for "${r}" package`,g$1)):!valid(coerce(t[r]))||coerce(t[r])&&coerce(s)&>(coerce(s),coerce(t[r]))?(t[r]=`${a||""}${a$1(s)}`,b(`Writing version ${t[r]} to catalog for "${r}" package`,g$1),i=true):u&&b(`The current version ${t[r]} for package "${r}" is greater than or equal to the version ${a$1(s)} fetched from the npm registry with tag "${o}". No update performed.`,g$1),{catalog:t,updated:i}}async function yt(t,r={}){let{tag:e$1=d,prefix:o="^",throwIfMissingInCatalog:a$2=false,workspaceRoot:f=e(),verbose:u=false}=r,g$1=await g(true,{workspaceRoot:f}),n=await X(f);if(!n)throw new Error("No catalog found");if(a$2===true&&!n[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(n,null,2)}`);u&&c(`Upgrading catalog entry for package "${t}" with tag "${e$1}"`,g$1);let c$1=await A(),s=await G(t,e$1,{executable:"bun pm",registry:c$1});if(!s)throw new Error(`Failed to fetch version for package "${t}" with tag "${e$1}"`);if(!valid(a$1(s),true))throw new Error(`Invalid version "${s}" fetched for package "${t}" with tag "${e$1}"`);let i=`${o||""}${a$1(s)}`;i===n[t]?u&&c(`The version for package "${t}" is already up to date in the catalog: ${i}`,g$1):!valid(a$1(n[t]),true)||coerce(n[t])&&coerce(i)&>(coerce(i),coerce(n[t]))?(n[t]=`${o||""}${a$1(i)}`,b(`Writing version ${n[t]} to catalog for "${t}" package`,g$1),await K(n,f)):u&&a(`The current version "${n[t]}" for package "${t}" is greater than or equal to the version "${i}" fetched from the npm registry with tag "${e$1}". No update performed.`,g$1);}export{q as a,X as b,K as c,xt as d,yt as e};
|
package/dist/helpers/catalog.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk5XGB6SOS_cjs=require('../chunk-5XGB6SOS.cjs');require('../chunk-WAL5SD4G.cjs'),require('../chunk-66TU3CP3.cjs');Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.b}});Object.defineProperty(exports,"getCatalogSafe",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.a}});Object.defineProperty(exports,"saveCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.e}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.c}});Object.defineProperty(exports,"upgradeCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.d}});
|
package/dist/helpers/catalog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as getCatalog,a as getCatalogSafe,e as saveCatalog,c as setCatalog,d as upgradeCatalog}from'../chunk-
|
|
1
|
+
export{b as getCatalog,a as getCatalogSafe,e as saveCatalog,c as setCatalog,d as upgradeCatalog}from'../chunk-ZMUT65O7.js';import'../chunk-7QKHH2VM.js';import'../chunk-6RUWDFGG.js';
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('../chunk-3CHW2FOO.cjs');var
|
|
1
|
+
'use strict';require('../chunk-3CHW2FOO.cjs');var chunkISMM6IAX_cjs=require('../chunk-ISMM6IAX.cjs'),chunk5XGB6SOS_cjs=require('../chunk-5XGB6SOS.cjs');require('../chunk-WAL5SD4G.cjs');var chunkGC3KXELW_cjs=require('../chunk-GC3KXELW.cjs'),chunk66TU3CP3_cjs=require('../chunk-66TU3CP3.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkISMM6IAX_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.b}});Object.defineProperty(exports,"getCatalogSafe",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.a}});Object.defineProperty(exports,"saveCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.e}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.c}});Object.defineProperty(exports,"upgradeCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.d}});Object.defineProperty(exports,"getWorkspaceFilePath",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.a}});Object.defineProperty(exports,"readWorkspaceFile",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.b}});Object.defineProperty(exports,"writeWorkspaceFile",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.c}});Object.defineProperty(exports,"getCatalogFromPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.j}});Object.defineProperty(exports,"getRootPackageJsonPath",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.h}});Object.defineProperty(exports,"readRootPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.i}});Object.defineProperty(exports,"setCatalogInPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.k}});Object.defineProperty(exports,"writeRootPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.l}});
|
package/dist/helpers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'../chunk-PJBAL7AE.js';export{a as replaceDepsAliases}from'../chunk-
|
|
1
|
+
import'../chunk-PJBAL7AE.js';export{a as replaceDepsAliases}from'../chunk-AD5LCW4J.js';export{b as getCatalog,a as getCatalogSafe,e as saveCatalog,c as setCatalog,d as upgradeCatalog}from'../chunk-ZMUT65O7.js';import'../chunk-7QKHH2VM.js';export{a as getWorkspaceFilePath,b as readWorkspaceFile,c as writeWorkspaceFile}from'../chunk-KWVKMOA5.js';export{j as getCatalogFromPackageJson,h as getRootPackageJsonPath,i as readRootPackageJson,k as setCatalogInPackageJson,l as writeRootPackageJson}from'../chunk-6RUWDFGG.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkISMM6IAX_cjs=require('../chunk-ISMM6IAX.cjs');require('../chunk-5XGB6SOS.cjs'),require('../chunk-WAL5SD4G.cjs'),require('../chunk-66TU3CP3.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkISMM6IAX_cjs.a}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as replaceDepsAliases}from'../chunk-
|
|
1
|
+
export{a as replaceDepsAliases}from'../chunk-AD5LCW4J.js';import'../chunk-ZMUT65O7.js';import'../chunk-7QKHH2VM.js';import'../chunk-6RUWDFGG.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('./chunk-SFZRYJZ2.cjs'),require('./chunk-3CHW2FOO.cjs');var
|
|
1
|
+
'use strict';require('./chunk-SFZRYJZ2.cjs'),require('./chunk-3CHW2FOO.cjs');var chunkISMM6IAX_cjs=require('./chunk-ISMM6IAX.cjs'),chunk5XGB6SOS_cjs=require('./chunk-5XGB6SOS.cjs');require('./chunk-WAL5SD4G.cjs');var chunkGC3KXELW_cjs=require('./chunk-GC3KXELW.cjs'),chunk66TU3CP3_cjs=require('./chunk-66TU3CP3.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkISMM6IAX_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.b}});Object.defineProperty(exports,"getCatalogSafe",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.a}});Object.defineProperty(exports,"saveCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.e}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.c}});Object.defineProperty(exports,"upgradeCatalog",{enumerable:true,get:function(){return chunk5XGB6SOS_cjs.d}});Object.defineProperty(exports,"getWorkspaceFilePath",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.a}});Object.defineProperty(exports,"readWorkspaceFile",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.b}});Object.defineProperty(exports,"writeWorkspaceFile",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.c}});Object.defineProperty(exports,"getCatalogFromPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.j}});Object.defineProperty(exports,"getRootPackageJsonPath",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.h}});Object.defineProperty(exports,"readRootPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.i}});Object.defineProperty(exports,"setCatalogInPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.k}});Object.defineProperty(exports,"writeRootPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.l}});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-GGNOJ77I.js';import'./chunk-PJBAL7AE.js';export{a as replaceDepsAliases}from'./chunk-
|
|
1
|
+
import'./chunk-GGNOJ77I.js';import'./chunk-PJBAL7AE.js';export{a as replaceDepsAliases}from'./chunk-AD5LCW4J.js';export{b as getCatalog,a as getCatalogSafe,e as saveCatalog,c as setCatalog,d as upgradeCatalog}from'./chunk-ZMUT65O7.js';import'./chunk-7QKHH2VM.js';export{a as getWorkspaceFilePath,b as readWorkspaceFile,c as writeWorkspaceFile}from'./chunk-KWVKMOA5.js';export{j as getCatalogFromPackageJson,h as getRootPackageJsonPath,i as readRootPackageJson,k as setCatalogInPackageJson,l as writeRootPackageJson}from'./chunk-6RUWDFGG.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/bun-tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A set of [Bun](https://bun.sh/) plugins and utilities for managing workspace packages/dependencies.",
|
|
6
6
|
"repository": {
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@storm-software/config": "^1.138.65",
|
|
77
|
-
"@storm-software/config-tools": "
|
|
78
|
-
"@storm-software/npm-tools": "
|
|
77
|
+
"@storm-software/config-tools": "1.190.129",
|
|
78
|
+
"@storm-software/npm-tools": "0.6.247",
|
|
79
79
|
"@storm-software/package-constants": "^0.1.141",
|
|
80
80
|
"chalk": "^4.1.2",
|
|
81
81
|
"commander": "^12.1.0",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": { "@types/node": "^25.9.5", "tsup": "8.4.0" },
|
|
89
89
|
"publishConfig": { "access": "public" },
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "b42641c3e4afdcfa82cb04d47afe5c6f372115ec"
|
|
91
91
|
}
|
package/dist/chunk-A6WN5WL5.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-7QKHH2VM.js';import {i,a,j as j$1,e,k,l,g,c,b,f}from'./chunk-6RUWDFGG.js';import {exec}from'node:child_process';import {valid,coerce,gt}from'semver';import D from'strip-ansi';var O="https://registry.npmjs.org";var U="latest";var d=U;async function L(t="npm"){return new Promise((r,o)=>{exec(`${t} config get registry`,(e,a,f)=>e&&!e.message.toLowerCase().trim().startsWith("npm warn")?o(e):f&&!f.toLowerCase().trim().startsWith("npm warn")?o(f):r(a.trim()));})}async function v(){if(process.env.STORM_REGISTRY_NPM)return process.env.STORM_REGISTRY_NPM;let t=await f();return t?.registry?.npm?t?.registry?.npm:O}async function A(t,r=d,o={}){let e=o.executable||"npm",a=o.retries??3,f=o.timeout??1e4,l=o.registry||await L(e),g;for(let i=0;i<=a;i++)try{let c=new AbortController,s=setTimeout(()=>{c.abort();},f),n=await Promise.resolve(new Promise((W,C)=>{exec(`${e} view ${t} version --registry=${l}`,{signal:c.signal,maxBuffer:1024*1024*10},(T,V,R)=>T&&!T.message.toLowerCase().trim().startsWith("npm warn")?C(T):R&&!R.toLowerCase().trim().startsWith("npm warn")?C(R):W(V.trim()));}));if(!valid(n,!0))throw clearTimeout(s),new Error(D(n).startsWith("[WARN] Request took")?`A timeout occurred while fetching the version for package "${t}" with tag "${r}".`:`Invalid version "${n}" fetched for package "${t}" with tag "${r}"`);return clearTimeout(s),n}catch(c){if(g=c,i<a){let s=Math.pow(2,i)*100;await new Promise(n=>setTimeout(n,s));}}throw g}async function J(t=e(process.cwd())){let r=await i(t);if(!r){a(`No package.json file found in workspace root: ${t}`,{logLevel:"all"});return}let o=j$1(r);if(o)return Object.fromEntries(Object.entries(o).map(([e,a])=>[e,a.replaceAll('"',"").replaceAll("'","")]));console.warn(`No catalog found in package.json file located in workspace root: ${t}
|
|
2
|
-
File content: ${JSON.stringify(r,null,2)}`);}async function j(t=e(process.cwd())){let r=await J(t);if(!r)throw new Error("No catalog entries found in workspace root package.json file");return r}async function B(t,r=e(process.cwd())){let o=await i(r);if(!o)throw new Error("No package.json file found in workspace root");k(o,Object.fromEntries(Object.entries(t).filter(([,e])=>e&&(e.startsWith("npm:")||valid(a$1(e),true))).map(([e,a])=>[e,a.replaceAll('"',"").replaceAll("'","")]))),await l(o,r);}async function $t(t,r,o={}){let{tag:e$1=d,prefix:a="^",workspaceRoot:f=e(),verbose:l=false}=o,g$1=await g(true,{workspaceRoot:f});l&&c(`Upgrading catalog entry for package "${r}" with tag "${e$1}"`,g$1);let i=await v(),c$1=await A(r,e$1,{executable:"bun pm",registry:i});if(!c$1)throw new Error(`Failed to fetch version for package "${r}" with tag "${e$1}"`);if(!valid(a$1(c$1),true))throw new Error(`Invalid version "${c$1}" fetched for package "${r}" with tag "${e$1}"`);let s=`${a||""}${a$1(c$1)}`,n=false;return t[r]?.startsWith("npm:")?(t[r]=s,b(`Writing version ${t[r]} to catalog for "${r}" package`,g$1)):!valid(coerce(t[r]))||coerce(t[r])&&coerce(s)&>(coerce(s),coerce(t[r]))?(t[r]=`${a||""}${a$1(s)}`,b(`Writing version ${t[r]} to catalog for "${r}" package`,g$1),n=true):l&&b(`The current version ${t[r]} for package "${r}" is greater than or equal to the version ${a$1(s)} fetched from the npm registry with tag "${e$1}". No update performed.`,g$1),{catalog:t,updated:n}}async function Tt(t,r={}){let{tag:o=d,prefix:e$1="^",throwIfMissingInCatalog:a$2=false,workspaceRoot:f=e(),verbose:l=false}=r,g$1=await g(true,{workspaceRoot:f}),i=await j(f);if(!i)throw new Error("No catalog found");if(a$2===true&&!i[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(i,null,2)}`);l&&c(`Upgrading catalog entry for package "${t}" with tag "${o}"`,g$1);let c$1=await v(),s=await A(t,o,{executable:"bun pm",registry:c$1});if(!s)throw new Error(`Failed to fetch version for package "${t}" with tag "${o}"`);if(!valid(a$1(s),true))throw new Error(`Invalid version "${s}" fetched for package "${t}" with tag "${o}"`);let n=`${e$1||""}${a$1(s)}`;n===i[t]?l&&c(`The version for package "${t}" is already up to date in the catalog: ${n}`,g$1):!valid(a$1(i[t]),true)||coerce(i[t])&&coerce(n)&>(coerce(n),coerce(i[t]))?(i[t]=`${e$1||""}${a$1(n)}`,b(`Writing version ${i[t]} to catalog for "${t}" package`,g$1),await B(i,f)):l&&a(`The current version "${i[t]}" for package "${t}" is greater than or equal to the version "${n}" fetched from the npm registry with tag "${o}". No update performed.`,g$1);}export{J as a,j as b,B as c,$t as d,Tt as e};
|
package/dist/chunk-YDODSPMC.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkWAL5SD4G_cjs=require('./chunk-WAL5SD4G.cjs'),chunk66TU3CP3_cjs=require('./chunk-66TU3CP3.cjs'),child_process=require('child_process'),semver=require('semver'),k=require('strip-ansi');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var k__default=/*#__PURE__*/_interopDefault(k);var M="https://registry.npmjs.org";var O="latest";var d=O;async function U(t="npm"){return new Promise((r,o)=>{child_process.exec(`${t} config get registry`,(e,a,f)=>e&&!e.message.toLowerCase().trim().startsWith("npm warn")?o(e):f&&!f.toLowerCase().trim().startsWith("npm warn")?o(f):r(a.trim()));})}async function _(){if(process.env.STORM_REGISTRY_NPM)return process.env.STORM_REGISTRY_NPM;let t=await chunk66TU3CP3_cjs.f();return t?.registry?.npm?t?.registry?.npm:M}async function v(t,r=d,o={}){let e=o.executable||"npm",a=o.retries??3,f=o.timeout??1e4,l=o.registry||await U(e),g;for(let i=0;i<=a;i++)try{let c=new AbortController,s=setTimeout(()=>{c.abort();},f),n=await Promise.resolve(new Promise((S,A)=>{child_process.exec(`${e} view ${t} version --registry=${l}`,{signal:c.signal,maxBuffer:1024*1024*10},(T,W,R)=>T&&!T.message.toLowerCase().trim().startsWith("npm warn")?A(T):R&&!R.toLowerCase().trim().startsWith("npm warn")?A(R):S(W.trim()));}));if(!semver.valid(n,!0))throw clearTimeout(s),new Error(k__default.default(n).startsWith("[WARN] Request took")?`A timeout occurred while fetching the version for package "${t}" with tag "${r}".`:`Invalid version "${n}" fetched for package "${t}" with tag "${r}"`);return clearTimeout(s),n}catch(c){if(g=c,i<a){let s=Math.pow(2,i)*100;await new Promise(n=>setTimeout(n,s));}}throw g}async function D(t=chunk66TU3CP3_cjs.e(process.cwd())){let r=await chunk66TU3CP3_cjs.i(t);if(!r){chunk66TU3CP3_cjs.a(`No package.json file found in workspace root: ${t}`,{logLevel:"all"});return}let o=chunk66TU3CP3_cjs.j(r);if(o)return Object.fromEntries(Object.entries(o).map(([e,a])=>[e,a.replaceAll('"',"").replaceAll("'","")]));console.warn(`No catalog found in package.json file located in workspace root: ${t}
|
|
2
|
-
File content: ${JSON.stringify(r,null,2)}`);}async function J(t=chunk66TU3CP3_cjs.e(process.cwd())){let r=await D(t);if(!r)throw new Error("No catalog entries found in workspace root package.json file");return r}async function j(t,r=chunk66TU3CP3_cjs.e(process.cwd())){let o=await chunk66TU3CP3_cjs.i(r);if(!o)throw new Error("No package.json file found in workspace root");chunk66TU3CP3_cjs.k(o,Object.fromEntries(Object.entries(t).filter(([,e])=>e&&(e.startsWith("npm:")||semver.valid(chunkWAL5SD4G_cjs.a(e),true))).map(([e,a])=>[e,a.replaceAll('"',"").replaceAll("'","")]))),await chunk66TU3CP3_cjs.l(o,r);}async function ht(t,r,o={}){let{tag:e=d,prefix:a="^",workspaceRoot:f=chunk66TU3CP3_cjs.e(),verbose:l=false}=o,g=await chunk66TU3CP3_cjs.g(true,{workspaceRoot:f});l&&chunk66TU3CP3_cjs.c(`Upgrading catalog entry for package "${r}" with tag "${e}"`,g);let i=await _(),c=await v(r,e,{executable:"bun pm",registry:i});if(!c)throw new Error(`Failed to fetch version for package "${r}" with tag "${e}"`);if(!semver.valid(chunkWAL5SD4G_cjs.a(c),true))throw new Error(`Invalid version "${c}" fetched for package "${r}" with tag "${e}"`);let s=`${a||""}${chunkWAL5SD4G_cjs.a(c)}`,n=false;return t[r]?.startsWith("npm:")?(t[r]=s,chunk66TU3CP3_cjs.b(`Writing version ${t[r]} to catalog for "${r}" package`,g)):!semver.valid(semver.coerce(t[r]))||semver.coerce(t[r])&&semver.coerce(s)&&semver.gt(semver.coerce(s),semver.coerce(t[r]))?(t[r]=`${a||""}${chunkWAL5SD4G_cjs.a(s)}`,chunk66TU3CP3_cjs.b(`Writing version ${t[r]} to catalog for "${r}" package`,g),n=true):l&&chunk66TU3CP3_cjs.b(`The current version ${t[r]} for package "${r}" is greater than or equal to the version ${chunkWAL5SD4G_cjs.a(s)} fetched from the npm registry with tag "${e}". No update performed.`,g),{catalog:t,updated:n}}async function $t(t,r={}){let{tag:o=d,prefix:e="^",throwIfMissingInCatalog:a=false,workspaceRoot:f=chunk66TU3CP3_cjs.e(),verbose:l=false}=r,g=await chunk66TU3CP3_cjs.g(true,{workspaceRoot:f}),i=await J(f);if(!i)throw new Error("No catalog found");if(a===true&&!i[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(i,null,2)}`);l&&chunk66TU3CP3_cjs.c(`Upgrading catalog entry for package "${t}" with tag "${o}"`,g);let c=await _(),s=await v(t,o,{executable:"bun pm",registry:c});if(!s)throw new Error(`Failed to fetch version for package "${t}" with tag "${o}"`);if(!semver.valid(chunkWAL5SD4G_cjs.a(s),true))throw new Error(`Invalid version "${s}" fetched for package "${t}" with tag "${o}"`);let n=`${e||""}${chunkWAL5SD4G_cjs.a(s)}`;n===i[t]?l&&chunk66TU3CP3_cjs.c(`The version for package "${t}" is already up to date in the catalog: ${n}`,g):!semver.valid(chunkWAL5SD4G_cjs.a(i[t]),true)||semver.coerce(i[t])&&semver.coerce(n)&&semver.gt(semver.coerce(n),semver.coerce(i[t]))?(i[t]=`${e||""}${chunkWAL5SD4G_cjs.a(n)}`,chunk66TU3CP3_cjs.b(`Writing version ${i[t]} to catalog for "${t}" package`,g),await j(i,f)):l&&chunk66TU3CP3_cjs.a(`The current version "${i[t]}" for package "${t}" is greater than or equal to the version "${n}" fetched from the npm registry with tag "${o}". No update performed.`,g);}exports.a=D;exports.b=J;exports.c=j;exports.d=ht;exports.e=$t;
|