@storm-software/pnpm-tools 0.1.1 → 0.1.4

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 CHANGED
@@ -2,6 +2,49 @@
2
2
 
3
3
  # Changelog for Storm Ops - Pnpm Tools
4
4
 
5
+ ## [0.1.3](https://github.com/storm-software/storm-ops/releases/tag/pnpm-tools%400.1.3) (2025-09-15)
6
+
7
+ ### Miscellaneous
8
+
9
+ - **monorepo:** Update workspace package links
10
+ ([cc9535d62](https://github.com/storm-software/storm-ops/commit/cc9535d62))
11
+ - **pnpm-tools:** Update script file name and write workspace contents to
12
+ warning message
13
+ ([ac72547b3](https://github.com/storm-software/storm-ops/commit/ac72547b3))
14
+ - **monorepo:** Regenerate README markdown files
15
+ ([beeeb4edc](https://github.com/storm-software/storm-ops/commit/beeeb4edc))
16
+
17
+ ### Updated Dependencies
18
+
19
+ - Updated config-tools to 1.183.3
20
+ - Updated npm-tools to 0.1.3
21
+ - Updated config to 1.130.2
22
+
23
+ ## [0.1.2](https://github.com/storm-software/storm-ops/releases/tag/pnpm-tools%400.1.2) (2025-09-15)
24
+
25
+ ### Bug Fixes
26
+
27
+ - **pnpm-tools:** Resolve issue returning pnpm catalog entries
28
+ ([9155e1657](https://github.com/storm-software/storm-ops/commit/9155e1657))
29
+
30
+ ### Miscellaneous
31
+
32
+ - **monorepo:** Update workspace package links
33
+ ([dd47cb757](https://github.com/storm-software/storm-ops/commit/dd47cb757))
34
+
35
+ ### Updated Dependencies
36
+
37
+ - Updated config-tools to 1.183.2
38
+ - Updated npm-tools to 0.1.2
39
+
40
+ ## [0.1.1](https://github.com/storm-software/storm-ops/releases/tag/pnpm-tools%400.1.1) (2025-09-13)
41
+
42
+ ### Bug Fixes
43
+
44
+ - **pnpm-tools:** Resolve issue with incorrectly tracking `pnpm-workspace` file
45
+ existance
46
+ ([20e630d0d](https://github.com/storm-software/storm-ops/commit/20e630d0d))
47
+
5
48
  ## [0.1.0](https://github.com/storm-software/storm-ops/releases/tag/pnpm-tools%400.1.0) (2025-09-13)
6
49
 
7
50
  ### Features
package/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.0.1-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.1.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
@@ -40,7 +40,6 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
40
40
 
41
41
  <!-- START doctoc -->
42
42
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
43
-
44
43
  ## Table of Contents
45
44
 
46
45
  - [Storm Configuration Package](#storm-configuration-package)
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // bin/storm-pnpm.ts
3
+ // bin/pnpm.ts
4
4
  var import_get_config = require("@storm-software/config-tools/get-config");
5
5
  var import_console = require("@storm-software/config-tools/logger/console");
6
6
  var import_process_handler = require("@storm-software/config-tools/utilities/process-handler");
@@ -19,9 +19,9 @@ var import_semver = require("semver");
19
19
  // src/helpers/pnpm-workspace.ts
20
20
  var import_correct_paths = require("@storm-software/config-tools/utilities/correct-paths");
21
21
  var import_find_workspace_root = require("@storm-software/config-tools/utilities/find-workspace-root");
22
- var import_js_yaml = require("js-yaml");
23
22
  var import_node_fs = require("fs");
24
23
  var import_promises = require("fs/promises");
24
+ var import_yaml = require("yaml");
25
25
  function getPnpmWorkspaceFilePath(workspaceRoot = (0, import_find_workspace_root.findWorkspaceRoot)(process.cwd())) {
26
26
  const pnpmWorkspacePath = (0, import_correct_paths.joinPaths)(workspaceRoot, "pnpm-workspace.yaml");
27
27
  if (!(0, import_node_fs.existsSync)(pnpmWorkspacePath)) {
@@ -32,34 +32,52 @@ function getPnpmWorkspaceFilePath(workspaceRoot = (0, import_find_workspace_root
32
32
  return pnpmWorkspacePath;
33
33
  }
34
34
  async function readPnpmWorkspaceFile(workspaceRoot = (0, import_find_workspace_root.findWorkspaceRoot)(process.cwd())) {
35
- return (0, import_js_yaml.load)(getPnpmWorkspaceFilePath(workspaceRoot));
35
+ const result = await (0, import_promises.readFile)(
36
+ getPnpmWorkspaceFilePath(workspaceRoot),
37
+ "utf8"
38
+ );
39
+ if (!result) {
40
+ return void 0;
41
+ }
42
+ return (0, import_yaml.parse)(result);
36
43
  }
37
44
  async function writePnpmWorkspaceFile(pnpmWorkspaceFile, workspaceRoot = (0, import_find_workspace_root.findWorkspaceRoot)(process.cwd())) {
38
45
  await (0, import_promises.writeFile)(
39
46
  getPnpmWorkspaceFilePath(workspaceRoot),
40
- (0, import_js_yaml.dump)(pnpmWorkspaceFile)
47
+ (0, import_yaml.stringify)(pnpmWorkspaceFile)
41
48
  );
42
49
  }
43
50
 
44
51
  // src/helpers/catalog.ts
45
- async function getCatalog(workspaceRoot = (0, import_find_workspace_root2.findWorkspaceRoot)(process.cwd())) {
52
+ async function getCatalogSafe(workspaceRoot = (0, import_find_workspace_root2.findWorkspaceRoot)(process.cwd())) {
46
53
  const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
54
+ if (!pnpmWorkspaceFile) {
55
+ throw new Error("No pnpm-workspace.yaml file found");
56
+ }
47
57
  if (pnpmWorkspaceFile?.catalog) {
48
58
  return Object.fromEntries(
49
59
  Object.entries(pnpmWorkspaceFile.catalog).map(([key, value]) => {
50
60
  return [key, value.replaceAll(/^"/g, "").replaceAll(/"$/g, "")];
51
61
  })
52
62
  );
53
- }
54
- if (!pnpmWorkspaceFile) {
55
- throw new Error("No pnpm-workspace.yaml file found");
56
- }
57
- if (!pnpmWorkspaceFile.catalog) {
63
+ } else {
58
64
  console.warn(
59
- `No catalog found in pnpm-workspace.yaml file located in workspace root: ${workspaceRoot}`
65
+ `No catalog found in pnpm-workspace.yaml file located in workspace root: ${workspaceRoot}
66
+ File content: ${JSON.stringify(
67
+ pnpmWorkspaceFile,
68
+ null,
69
+ 2
70
+ )}`
60
71
  );
61
72
  }
62
- return;
73
+ return void 0;
74
+ }
75
+ async function getCatalog(workspaceRoot = (0, import_find_workspace_root2.findWorkspaceRoot)(process.cwd())) {
76
+ const catalog = await getCatalogSafe(workspaceRoot);
77
+ if (!catalog) {
78
+ throw new Error("No catalog entries found in pnpm-workspace.yaml file");
79
+ }
80
+ return catalog;
63
81
  }
64
82
  async function setCatalog(catalog, workspaceRoot = (0, import_find_workspace_root2.findWorkspaceRoot)(process.cwd())) {
65
83
  const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
@@ -179,7 +197,7 @@ ${error.message}`,
179
197
  }
180
198
  }
181
199
 
182
- // bin/storm-pnpm.ts
200
+ // bin/pnpm.ts
183
201
  void (async () => {
184
202
  const config = await (0, import_get_config.getConfig)();
185
203
  try {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // bin/storm-pnpm.ts
3
+ // bin/pnpm.ts
4
4
  import { getConfig } from "@storm-software/config-tools/get-config";
5
5
  import { writeSuccess as writeSuccess2 } from "@storm-software/config-tools/logger/console";
6
6
  import {
@@ -28,9 +28,9 @@ import { coerce, gt, valid } from "semver";
28
28
  // src/helpers/pnpm-workspace.ts
29
29
  import { joinPaths } from "@storm-software/config-tools/utilities/correct-paths";
30
30
  import { findWorkspaceRoot } from "@storm-software/config-tools/utilities/find-workspace-root";
31
- import { dump, load } from "js-yaml";
32
31
  import { existsSync } from "node:fs";
33
- import { writeFile } from "node:fs/promises";
32
+ import { readFile, writeFile } from "node:fs/promises";
33
+ import { parse, stringify } from "yaml";
34
34
  function getPnpmWorkspaceFilePath(workspaceRoot = findWorkspaceRoot(process.cwd())) {
35
35
  const pnpmWorkspacePath = joinPaths(workspaceRoot, "pnpm-workspace.yaml");
36
36
  if (!existsSync(pnpmWorkspacePath)) {
@@ -41,34 +41,52 @@ function getPnpmWorkspaceFilePath(workspaceRoot = findWorkspaceRoot(process.cwd(
41
41
  return pnpmWorkspacePath;
42
42
  }
43
43
  async function readPnpmWorkspaceFile(workspaceRoot = findWorkspaceRoot(process.cwd())) {
44
- return load(getPnpmWorkspaceFilePath(workspaceRoot));
44
+ const result = await readFile(
45
+ getPnpmWorkspaceFilePath(workspaceRoot),
46
+ "utf8"
47
+ );
48
+ if (!result) {
49
+ return void 0;
50
+ }
51
+ return parse(result);
45
52
  }
46
53
  async function writePnpmWorkspaceFile(pnpmWorkspaceFile, workspaceRoot = findWorkspaceRoot(process.cwd())) {
47
54
  await writeFile(
48
55
  getPnpmWorkspaceFilePath(workspaceRoot),
49
- dump(pnpmWorkspaceFile)
56
+ stringify(pnpmWorkspaceFile)
50
57
  );
51
58
  }
52
59
 
53
60
  // src/helpers/catalog.ts
54
- async function getCatalog(workspaceRoot = findWorkspaceRoot2(process.cwd())) {
61
+ async function getCatalogSafe(workspaceRoot = findWorkspaceRoot2(process.cwd())) {
55
62
  const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
63
+ if (!pnpmWorkspaceFile) {
64
+ throw new Error("No pnpm-workspace.yaml file found");
65
+ }
56
66
  if (pnpmWorkspaceFile?.catalog) {
57
67
  return Object.fromEntries(
58
68
  Object.entries(pnpmWorkspaceFile.catalog).map(([key, value]) => {
59
69
  return [key, value.replaceAll(/^"/g, "").replaceAll(/"$/g, "")];
60
70
  })
61
71
  );
62
- }
63
- if (!pnpmWorkspaceFile) {
64
- throw new Error("No pnpm-workspace.yaml file found");
65
- }
66
- if (!pnpmWorkspaceFile.catalog) {
72
+ } else {
67
73
  console.warn(
68
- `No catalog found in pnpm-workspace.yaml file located in workspace root: ${workspaceRoot}`
74
+ `No catalog found in pnpm-workspace.yaml file located in workspace root: ${workspaceRoot}
75
+ File content: ${JSON.stringify(
76
+ pnpmWorkspaceFile,
77
+ null,
78
+ 2
79
+ )}`
69
80
  );
70
81
  }
71
- return;
82
+ return void 0;
83
+ }
84
+ async function getCatalog(workspaceRoot = findWorkspaceRoot2(process.cwd())) {
85
+ const catalog = await getCatalogSafe(workspaceRoot);
86
+ if (!catalog) {
87
+ throw new Error("No catalog entries found in pnpm-workspace.yaml file");
88
+ }
89
+ return catalog;
72
90
  }
73
91
  async function setCatalog(catalog, workspaceRoot = findWorkspaceRoot2(process.cwd())) {
74
92
  const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
@@ -188,7 +206,7 @@ ${error.message}`,
188
206
  }
189
207
  }
190
208
 
191
- // bin/storm-pnpm.ts
209
+ // bin/pnpm.ts
192
210
  void (async () => {
193
211
  const config = await getConfig();
194
212
  try {
@@ -0,0 +1,4 @@
1
+ import {existsSync}from'node:fs';import {join}from'node:path';import {readFile,writeFile}from'node:fs/promises';import {parse,stringify}from'yaml';var x=/^[A-Za-z]:\//;function _(e=""){return e&&e.replace(/\\/g,"/").replace(x,n=>n.toUpperCase())}var P=/^[/\\]{2}/,R=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,E=/^[A-Za-z]:$/;var l=function(e){if(!e||e.length===0)return ".";e=_(e);let n=e.match(P),t=d(e),o=e[e.length-1]==="/";return e=j(e,!t),e.length===0?t?"/":o?"./":".":(o&&(e+="/"),E.test(e)&&(e+="/"),n?t?`//${e}`:`//./${e}`:t&&!d(e)?`/${e}`:e)},k=function(...e){let n="";for(let t of e)if(t)if(n.length>0){let o=n[n.length-1]==="/",r=t[0]==="/";o&&r?n+=t.slice(1):n+=o||r?t:`/${t}`;}else n+=t;return l(n)};function j(e,n){let t="",o=0,r=-1,c=0,i=null;for(let s=0;s<=e.length;++s){if(s<e.length)i=e[s];else {if(i==="/")break;i="/";}if(i==="/"){if(!(r===s-1||c===1))if(c===2){if(t.length<2||o!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let g=t.lastIndexOf("/");g===-1?(t="",o=0):(t=t.slice(0,g),o=t.length-1-t.lastIndexOf("/")),r=s,c=0;continue}else if(t.length>0){t="",o=0,r=s,c=0;continue}}n&&(t+=t.length>0?"/..":"..",o=2);}else t.length>0?t+=`/${e.slice(r+1,s)}`:t=e.slice(r+1,s),o=s-r-1;r=s,c=0;}else i==="."&&c!==-1?++c:c=-1;}return t}var d=function(e){return R.test(e)};var A=30,O=0;function u(e,n=[],t=[]){let o=e??process.cwd();if(t.some(r=>existsSync(join(o,r)))||n.some(r=>existsSync(join(o,r))))return o;if(o!=="/"&&O++<A){let r=join(o,"..");return u(r,n,t)}}var w=["storm-workspace.json","storm-workspace.yaml","storm-workspace.yml","storm-workspace.js","storm-workspace.ts",".storm-workspace.json",".storm-workspace.yaml",".storm-workspace.yml",".storm-workspace.js",".storm-workspace.ts","lerna.json","nx.json","turbo.json","npm-workspace.json","yarn-workspace.json","pnpm-workspace.json","npm-workspace.yaml","yarn-workspace.yaml","pnpm-workspace.yaml","npm-workspace.yml","yarn-workspace.yml","pnpm-workspace.yml","npm-lock.json","yarn-lock.json","pnpm-lock.json","npm-lock.yaml","yarn-lock.yaml","pnpm-lock.yaml","npm-lock.yml","yarn-lock.yml","pnpm-lock.yml","bun.lockb"],T=[".storm-workspace",".nx",".github",".vscode",".verdaccio"];function S(e){return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH?l(process.env.STORM_WORKSPACE_ROOT??process.env.NX_WORKSPACE_ROOT_PATH):l(u(e??process.cwd(),w,T))}function a(e){let n=S(e);if(!n)throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
2
+ ${w.join(`
3
+ `)}
4
+ Path: ${e||process.cwd()}`);return n}function y(e=a(process.cwd())){let n=k(e,"pnpm-workspace.yaml");if(!existsSync(n))throw new Error(`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${n}).`);return n}async function q(e=a(process.cwd())){let n=await readFile(y(e),"utf8");if(n)return parse(n)}async function J(e,n=a(process.cwd())){await writeFile(y(n),stringify(e));}export{k as a,a as b,y as c,q as d,J as e};
@@ -0,0 +1,2 @@
1
+ import {b,d as d$1,e}from'./chunk-7MJHUWVF.js';import {exec}from'node:child_process';import {valid,coerce,gt}from'semver';var T="latest";var g=T;async function w(){return new Promise((t,r)=>{exec("npm config get registry",(n,o,i)=>n?r(n):i?r(i):t(o.trim()));})}async function _(t,r=g,n={}){let{registry:o=w()}=n;return new Promise((i,e)=>{exec(`npm view ${t} version --registry=${o} --tag=${r}`,(s,R,u)=>s?e(s):u?e(u):i(R.trim()));})}async function A(t=b(process.cwd())){let r=await d$1(t);if(!r)throw new Error("No pnpm-workspace.yaml file found");if(r?.catalog)return Object.fromEntries(Object.entries(r.catalog).map(([n,o])=>[n,o.replaceAll(/^"/g,"").replaceAll(/"$/g,"")]));console.warn(`No catalog found in pnpm-workspace.yaml file located in workspace root: ${t}
2
+ File content: ${JSON.stringify(r,null,2)}`);}async function x(t=b(process.cwd())){let r=await A(t);if(!r)throw new Error("No catalog entries found in pnpm-workspace.yaml file");return r}async function d(t,r=b(process.cwd())){let n=await d$1(r);if(!n)throw new Error("No pnpm-workspace.yaml file found");n.catalog=Object.fromEntries(Object.entries(t).map(([o,i])=>[o,`"${i}"`])),await e(n,r);}async function j(t,r={}){let{tag:n=g,throwIfMissingInCatalog:o=false,workspaceRoot:i=b()}=r,e=await x(i);if(!e)throw new Error("No catalog found");if(o===true&&!e[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(e,null,2)}`);let s=await _(t,n);(!valid(coerce(e[t]))||coerce(e[t])&&coerce(s)&&gt(coerce(s),coerce(e[t])))&&(e[t]=s),await d(e,i);}export{A as a,x as b,d as c,j as d};
@@ -0,0 +1,4 @@
1
+ 'use strict';var fs=require('fs'),path=require('path'),promises=require('fs/promises'),yaml=require('yaml');var y=/^[A-Za-z]:\//;function x(e=""){return e&&e.replace(/\\/g,"/").replace(y,n=>n.toUpperCase())}var _=/^[/\\]{2}/,P=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,R=/^[A-Za-z]:$/;var l=function(e){if(!e||e.length===0)return ".";e=x(e);let n=e.match(_),t=g(e),o=e[e.length-1]==="/";return e=E(e,!t),e.length===0?t?"/":o?"./":".":(o&&(e+="/"),R.test(e)&&(e+="/"),n?t?`//${e}`:`//./${e}`:t&&!g(e)?`/${e}`:e)},d=function(...e){let n="";for(let t of e)if(t)if(n.length>0){let o=n[n.length-1]==="/",r=t[0]==="/";o&&r?n+=t.slice(1):n+=o||r?t:`/${t}`;}else n+=t;return l(n)};function E(e,n){let t="",o=0,r=-1,c=0,i=null;for(let s=0;s<=e.length;++s){if(s<e.length)i=e[s];else {if(i==="/")break;i="/";}if(i==="/"){if(!(r===s-1||c===1))if(c===2){if(t.length<2||o!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let u=t.lastIndexOf("/");u===-1?(t="",o=0):(t=t.slice(0,u),o=t.length-1-t.lastIndexOf("/")),r=s,c=0;continue}else if(t.length>0){t="",o=0,r=s,c=0;continue}}n&&(t+=t.length>0?"/..":"..",o=2);}else t.length>0?t+=`/${e.slice(r+1,s)}`:t=e.slice(r+1,s),o=s-r-1;r=s,c=0;}else i==="."&&c!==-1?++c:c=-1;}return t}var g=function(e){return P.test(e)};var j=30,A=0;function m(e,n=[],t=[]){let o=e??process.cwd();if(t.some(r=>fs.existsSync(path.join(o,r)))||n.some(r=>fs.existsSync(path.join(o,r))))return o;if(o!=="/"&&A++<j){let r=path.join(o,"..");return m(r,n,t)}}var h=["storm-workspace.json","storm-workspace.yaml","storm-workspace.yml","storm-workspace.js","storm-workspace.ts",".storm-workspace.json",".storm-workspace.yaml",".storm-workspace.yml",".storm-workspace.js",".storm-workspace.ts","lerna.json","nx.json","turbo.json","npm-workspace.json","yarn-workspace.json","pnpm-workspace.json","npm-workspace.yaml","yarn-workspace.yaml","pnpm-workspace.yaml","npm-workspace.yml","yarn-workspace.yml","pnpm-workspace.yml","npm-lock.json","yarn-lock.json","pnpm-lock.json","npm-lock.yaml","yarn-lock.yaml","pnpm-lock.yaml","npm-lock.yml","yarn-lock.yml","pnpm-lock.yml","bun.lockb"],O=[".storm-workspace",".nx",".github",".vscode",".verdaccio"];function T(e){return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH?l(process.env.STORM_WORKSPACE_ROOT??process.env.NX_WORKSPACE_ROOT_PATH):l(m(e??process.cwd(),h,O))}function a(e){let n=T(e);if(!n)throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
2
+ ${h.join(`
3
+ `)}
4
+ Path: ${e||process.cwd()}`);return n}function w(e=a(process.cwd())){let n=d(e,"pnpm-workspace.yaml");if(!fs.existsSync(n))throw new Error(`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${n}).`);return n}async function G(e=a(process.cwd())){let n=await promises.readFile(w(e),"utf8");if(n)return yaml.parse(n)}async function q(e,n=a(process.cwd())){await promises.writeFile(w(n),yaml.stringify(e));}exports.a=d;exports.b=a;exports.c=w;exports.d=G;exports.e=q;
@@ -1 +1 @@
1
- 'use strict';var chunkIGOMTZVA_cjs=require('./chunk-IGOMTZVA.cjs'),chunk4VKPMCQD_cjs=require('./chunk-4VKPMCQD.cjs'),devkit=require('@nx/devkit'),fs=require('fs'),promises=require('fs/promises'),prettier=require('prettier');async function C(c=process.cwd(),i=chunk4VKPMCQD_cjs.b(c)){let l=chunk4VKPMCQD_cjs.a(c,"package.json"),m=await promises.readFile(l,"utf8");if(!m)throw new Error("No package.json file found in package root: "+c);let p=await chunkIGOMTZVA_cjs.a(i),r=JSON.parse(m),g=chunk4VKPMCQD_cjs.a(i,"pnpm-workspace.yaml");if(!fs.existsSync(g))return console.warn(`No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${g}). Skipping pnpm catalog read for now.`),r;if(!p){console.warn("No pnpm catalog found. Skipping dependencies replacement for now.");return}for(let a of ["dependencies","devDependencies","peerDependencies"]){let o=r[a];if(o){for(let e of Object.keys(o))if(o[e]==="catalog:"){if(!p)throw new Error(`Dependency ${e} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`pnpm-workspace.yaml\` file.`);let t=p[e];if(!t)throw new Error("Missing pnpm catalog version for "+e);o[e]=t;}else if(o[e].startsWith("catalog:"))throw new Error("multiple named catalogs not supported")}}let n;try{n=devkit.readCachedProjectGraph();}catch{await devkit.createProjectGraphAsync(),n=devkit.readCachedProjectGraph();}let d={};n&&await Promise.all(Object.keys(n.nodes).map(async a=>{let o=n.nodes[a];if(o?.data.root){let e=chunk4VKPMCQD_cjs.a(i,o.data.root,"package.json");if(fs.existsSync(e)){let t=await promises.readFile(e,"utf8"),f=JSON.parse(t);f.private!==true&&(d[f.name]=f.version);}}}));for(let a of ["dependencies","devDependencies","peerDependencies"]){let o=r[a];if(o){for(let e of Object.keys(o))if(o[e].startsWith("workspace:"))if(d[e])o[e]=`^${d[e]}`;else throw new Error(`Workspace dependency ${e} not found in workspace packages.`)}}return promises.writeFile(l,await prettier.format(JSON.stringify(r),{parser:"json",proseWrap:"always",trailingComma:"none",tabWidth:2,semi:true,singleQuote:false,quoteProps:"as-needed",insertPragma:false,bracketSameLine:true,printWidth:80,bracketSpacing:true,arrowParens:"avoid",endOfLine:"lf",plugins:["prettier-plugin-pkg"]}))}exports.a=C;
1
+ 'use strict';var chunkW4TJXJ3L_cjs=require('./chunk-W4TJXJ3L.cjs'),chunkMJEKZAJO_cjs=require('./chunk-MJEKZAJO.cjs'),devkit=require('@nx/devkit'),fs=require('fs'),promises=require('fs/promises'),prettier=require('prettier');async function C(c=process.cwd(),i=chunkMJEKZAJO_cjs.b(c)){let l=chunkMJEKZAJO_cjs.a(c,"package.json"),m=await promises.readFile(l,"utf8");if(!m)throw new Error("No package.json file found in package root: "+c);let p=await chunkW4TJXJ3L_cjs.b(i),r=JSON.parse(m),g=chunkMJEKZAJO_cjs.a(i,"pnpm-workspace.yaml");if(!fs.existsSync(g))return console.warn(`No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${g}). Skipping pnpm catalog read for now.`),r;if(!p){console.warn("No pnpm catalog found. Skipping dependencies replacement for now.");return}for(let a of ["dependencies","devDependencies","peerDependencies"]){let o=r[a];if(o){for(let e of Object.keys(o))if(o[e]==="catalog:"){if(!p)throw new Error(`Dependency ${e} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`pnpm-workspace.yaml\` file.`);let t=p[e];if(!t)throw new Error("Missing pnpm catalog version for "+e);o[e]=t;}else if(o[e].startsWith("catalog:"))throw new Error("multiple named catalogs not supported")}}let n;try{n=devkit.readCachedProjectGraph();}catch{await devkit.createProjectGraphAsync(),n=devkit.readCachedProjectGraph();}let d={};n&&await Promise.all(Object.keys(n.nodes).map(async a=>{let o=n.nodes[a];if(o?.data.root){let e=chunkMJEKZAJO_cjs.a(i,o.data.root,"package.json");if(fs.existsSync(e)){let t=await promises.readFile(e,"utf8"),f=JSON.parse(t);f.private!==true&&(d[f.name]=f.version);}}}));for(let a of ["dependencies","devDependencies","peerDependencies"]){let o=r[a];if(o){for(let e of Object.keys(o))if(o[e].startsWith("workspace:"))if(d[e])o[e]=`^${d[e]}`;else throw new Error(`Workspace dependency ${e} not found in workspace packages.`)}}return promises.writeFile(l,await prettier.format(JSON.stringify(r),{parser:"json",proseWrap:"always",trailingComma:"none",tabWidth:2,semi:true,singleQuote:false,quoteProps:"as-needed",insertPragma:false,bracketSameLine:true,printWidth:80,bracketSpacing:true,arrowParens:"avoid",endOfLine:"lf",plugins:["prettier-plugin-pkg"]}))}exports.a=C;
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkMJEKZAJO_cjs=require('./chunk-MJEKZAJO.cjs'),child_process=require('child_process'),semver=require('semver');var l="latest";var g=l;async function T(){return new Promise((t,r)=>{child_process.exec("npm config get registry",(n,o,i)=>n?r(n):i?r(i):t(o.trim()));})}async function w(t,r=g,n={}){let{registry:o=T()}=n;return new Promise((i,e)=>{child_process.exec(`npm view ${t} version --registry=${o} --tag=${r}`,(s,_,m)=>s?e(s):m?e(m):i(_.trim()));})}async function G(t=chunkMJEKZAJO_cjs.b(process.cwd())){let r=await chunkMJEKZAJO_cjs.d(t);if(!r)throw new Error("No pnpm-workspace.yaml file found");if(r?.catalog)return Object.fromEntries(Object.entries(r.catalog).map(([n,o])=>[n,o.replaceAll(/^"/g,"").replaceAll(/"$/g,"")]));console.warn(`No catalog found in pnpm-workspace.yaml file located in workspace root: ${t}
2
+ File content: ${JSON.stringify(r,null,2)}`);}async function A(t=chunkMJEKZAJO_cjs.b(process.cwd())){let r=await G(t);if(!r)throw new Error("No catalog entries found in pnpm-workspace.yaml file");return r}async function x(t,r=chunkMJEKZAJO_cjs.b(process.cwd())){let n=await chunkMJEKZAJO_cjs.d(r);if(!n)throw new Error("No pnpm-workspace.yaml file found");n.catalog=Object.fromEntries(Object.entries(t).map(([o,i])=>[o,`"${i}"`])),await chunkMJEKZAJO_cjs.e(n,r);}async function B(t,r={}){let{tag:n=g,throwIfMissingInCatalog:o=false,workspaceRoot:i=chunkMJEKZAJO_cjs.b()}=r,e=await A(i);if(!e)throw new Error("No catalog found");if(o===true&&!e[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(e,null,2)}`);let s=await w(t,n);(!semver.valid(semver.coerce(e[t]))||semver.coerce(e[t])&&semver.coerce(s)&&semver.gt(semver.coerce(s),semver.coerce(e[t])))&&(e[t]=s),await x(e,i);}exports.a=G;exports.b=A;exports.c=x;exports.d=B;
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-HMZUSSXI.js';import {b,a}from'./chunk-ZK5RQIOO.js';import {readCachedProjectGraph,createProjectGraphAsync}from'@nx/devkit';import {existsSync}from'node:fs';import {readFile,writeFile}from'node:fs/promises';import {format}from'prettier';async function $(c=process.cwd(),i=b(c)){let l=a(c,"package.json"),m=await readFile(l,"utf8");if(!m)throw new Error("No package.json file found in package root: "+c);let p=await a$1(i),r=JSON.parse(m),g=a(i,"pnpm-workspace.yaml");if(!existsSync(g))return console.warn(`No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${g}). Skipping pnpm catalog read for now.`),r;if(!p){console.warn("No pnpm catalog found. Skipping dependencies replacement for now.");return}for(let a of ["dependencies","devDependencies","peerDependencies"]){let o=r[a];if(o){for(let e of Object.keys(o))if(o[e]==="catalog:"){if(!p)throw new Error(`Dependency ${e} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`pnpm-workspace.yaml\` file.`);let t=p[e];if(!t)throw new Error("Missing pnpm catalog version for "+e);o[e]=t;}else if(o[e].startsWith("catalog:"))throw new Error("multiple named catalogs not supported")}}let n;try{n=readCachedProjectGraph();}catch{await createProjectGraphAsync(),n=readCachedProjectGraph();}let d={};n&&await Promise.all(Object.keys(n.nodes).map(async a$1=>{let o=n.nodes[a$1];if(o?.data.root){let e=a(i,o.data.root,"package.json");if(existsSync(e)){let t=await readFile(e,"utf8"),f=JSON.parse(t);f.private!==true&&(d[f.name]=f.version);}}}));for(let a of ["dependencies","devDependencies","peerDependencies"]){let o=r[a];if(o){for(let e of Object.keys(o))if(o[e].startsWith("workspace:"))if(d[e])o[e]=`^${d[e]}`;else throw new Error(`Workspace dependency ${e} not found in workspace packages.`)}}return writeFile(l,await format(JSON.stringify(r),{parser:"json",proseWrap:"always",trailingComma:"none",tabWidth:2,semi:true,singleQuote:false,quoteProps:"as-needed",insertPragma:false,bracketSameLine:true,printWidth:80,bracketSpacing:true,arrowParens:"avoid",endOfLine:"lf",plugins:["prettier-plugin-pkg"]}))}export{$ as a};
1
+ import {b as b$1}from'./chunk-ETQM4AGR.js';import {b,a}from'./chunk-7MJHUWVF.js';import {readCachedProjectGraph,createProjectGraphAsync}from'@nx/devkit';import {existsSync}from'node:fs';import {readFile,writeFile}from'node:fs/promises';import {format}from'prettier';async function $(c=process.cwd(),i=b(c)){let l=a(c,"package.json"),m=await readFile(l,"utf8");if(!m)throw new Error("No package.json file found in package root: "+c);let p=await b$1(i),r=JSON.parse(m),g=a(i,"pnpm-workspace.yaml");if(!existsSync(g))return console.warn(`No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${g}). Skipping pnpm catalog read for now.`),r;if(!p){console.warn("No pnpm catalog found. Skipping dependencies replacement for now.");return}for(let a of ["dependencies","devDependencies","peerDependencies"]){let o=r[a];if(o){for(let e of Object.keys(o))if(o[e]==="catalog:"){if(!p)throw new Error(`Dependency ${e} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`pnpm-workspace.yaml\` file.`);let t=p[e];if(!t)throw new Error("Missing pnpm catalog version for "+e);o[e]=t;}else if(o[e].startsWith("catalog:"))throw new Error("multiple named catalogs not supported")}}let n;try{n=readCachedProjectGraph();}catch{await createProjectGraphAsync(),n=readCachedProjectGraph();}let d={};n&&await Promise.all(Object.keys(n.nodes).map(async a$1=>{let o=n.nodes[a$1];if(o?.data.root){let e=a(i,o.data.root,"package.json");if(existsSync(e)){let t=await readFile(e,"utf8"),f=JSON.parse(t);f.private!==true&&(d[f.name]=f.version);}}}));for(let a of ["dependencies","devDependencies","peerDependencies"]){let o=r[a];if(o){for(let e of Object.keys(o))if(o[e].startsWith("workspace:"))if(d[e])o[e]=`^${d[e]}`;else throw new Error(`Workspace dependency ${e} not found in workspace packages.`)}}return writeFile(l,await format(JSON.stringify(r),{parser:"json",proseWrap:"always",trailingComma:"none",tabWidth:2,semi:true,singleQuote:false,quoteProps:"as-needed",insertPragma:false,bracketSameLine:true,printWidth:80,bracketSpacing:true,arrowParens:"avoid",endOfLine:"lf",plugins:["prettier-plugin-pkg"]}))}export{$ as a};
@@ -1 +1 @@
1
- 'use strict';var chunkIGOMTZVA_cjs=require('../chunk-IGOMTZVA.cjs');require('../chunk-4VKPMCQD.cjs');Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkIGOMTZVA_cjs.a}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkIGOMTZVA_cjs.b}});Object.defineProperty(exports,"upgradeCatalogPackage",{enumerable:true,get:function(){return chunkIGOMTZVA_cjs.c}});
1
+ 'use strict';var chunkW4TJXJ3L_cjs=require('../chunk-W4TJXJ3L.cjs');require('../chunk-MJEKZAJO.cjs');Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.b}});Object.defineProperty(exports,"getCatalogSafe",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.a}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.c}});Object.defineProperty(exports,"upgradeCatalogPackage",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.d}});
@@ -1,8 +1,15 @@
1
1
  /**
2
- * Retrieve the pnpm catalog from the workspace's `pnpm-workspace.yaml` file.
2
+ * Safely retrieve the pnpm catalog from the workspace's `pnpm-workspace.yaml` file.
3
3
  *
4
4
  * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
5
5
  * @returns A promise that resolves to the catalog object if found, or undefined if no catalog exists or the `pnpm-workspace.yaml` file is not found.
6
+ */
7
+ declare function getCatalogSafe(workspaceRoot?: string): Promise<Record<string, string> | undefined>;
8
+ /**
9
+ * Retrieve the pnpm catalog from the workspace's `pnpm-workspace.yaml` file.
10
+ *
11
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
12
+ * @returns A promise that resolves to the catalog object if found, or throws an error if no catalog exists or the `pnpm-workspace.yaml` file is not found.
6
13
  * @throws Will throw an error if the `pnpm-workspace.yaml` file is found but cannot be read.
7
14
  */
8
15
  declare function getCatalog(workspaceRoot?: string): Promise<Record<string, string> | undefined>;
@@ -43,4 +50,4 @@ interface UpgradeCatalogPackageOptions {
43
50
  */
44
51
  declare function upgradeCatalogPackage(packageName: string, options?: UpgradeCatalogPackageOptions): Promise<void>;
45
52
 
46
- export { type UpgradeCatalogPackageOptions, getCatalog, setCatalog, upgradeCatalogPackage };
53
+ export { type UpgradeCatalogPackageOptions, getCatalog, getCatalogSafe, setCatalog, upgradeCatalogPackage };
@@ -1,8 +1,15 @@
1
1
  /**
2
- * Retrieve the pnpm catalog from the workspace's `pnpm-workspace.yaml` file.
2
+ * Safely retrieve the pnpm catalog from the workspace's `pnpm-workspace.yaml` file.
3
3
  *
4
4
  * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
5
5
  * @returns A promise that resolves to the catalog object if found, or undefined if no catalog exists or the `pnpm-workspace.yaml` file is not found.
6
+ */
7
+ declare function getCatalogSafe(workspaceRoot?: string): Promise<Record<string, string> | undefined>;
8
+ /**
9
+ * Retrieve the pnpm catalog from the workspace's `pnpm-workspace.yaml` file.
10
+ *
11
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
12
+ * @returns A promise that resolves to the catalog object if found, or throws an error if no catalog exists or the `pnpm-workspace.yaml` file is not found.
6
13
  * @throws Will throw an error if the `pnpm-workspace.yaml` file is found but cannot be read.
7
14
  */
8
15
  declare function getCatalog(workspaceRoot?: string): Promise<Record<string, string> | undefined>;
@@ -43,4 +50,4 @@ interface UpgradeCatalogPackageOptions {
43
50
  */
44
51
  declare function upgradeCatalogPackage(packageName: string, options?: UpgradeCatalogPackageOptions): Promise<void>;
45
52
 
46
- export { type UpgradeCatalogPackageOptions, getCatalog, setCatalog, upgradeCatalogPackage };
53
+ export { type UpgradeCatalogPackageOptions, getCatalog, getCatalogSafe, setCatalog, upgradeCatalogPackage };
@@ -1 +1 @@
1
- export{a as getCatalog,b as setCatalog,c as upgradeCatalogPackage}from'../chunk-HMZUSSXI.js';import'../chunk-ZK5RQIOO.js';
1
+ export{b as getCatalog,a as getCatalogSafe,c as setCatalog,d as upgradeCatalogPackage}from'../chunk-ETQM4AGR.js';import'../chunk-7MJHUWVF.js';
@@ -1 +1 @@
1
- 'use strict';require('../chunk-QNTSKZUU.cjs');var chunkAEQRRF4Z_cjs=require('../chunk-AEQRRF4Z.cjs'),chunkIGOMTZVA_cjs=require('../chunk-IGOMTZVA.cjs'),chunk4VKPMCQD_cjs=require('../chunk-4VKPMCQD.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkAEQRRF4Z_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkIGOMTZVA_cjs.a}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkIGOMTZVA_cjs.b}});Object.defineProperty(exports,"upgradeCatalogPackage",{enumerable:true,get:function(){return chunkIGOMTZVA_cjs.c}});Object.defineProperty(exports,"getPnpmWorkspaceFilePath",{enumerable:true,get:function(){return chunk4VKPMCQD_cjs.c}});Object.defineProperty(exports,"readPnpmWorkspaceFile",{enumerable:true,get:function(){return chunk4VKPMCQD_cjs.d}});Object.defineProperty(exports,"writePnpmWorkspaceFile",{enumerable:true,get:function(){return chunk4VKPMCQD_cjs.e}});
1
+ 'use strict';require('../chunk-QNTSKZUU.cjs');var chunkPCTJLZIA_cjs=require('../chunk-PCTJLZIA.cjs'),chunkW4TJXJ3L_cjs=require('../chunk-W4TJXJ3L.cjs'),chunkMJEKZAJO_cjs=require('../chunk-MJEKZAJO.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkPCTJLZIA_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.b}});Object.defineProperty(exports,"getCatalogSafe",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.a}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.c}});Object.defineProperty(exports,"upgradeCatalogPackage",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.d}});Object.defineProperty(exports,"getPnpmWorkspaceFilePath",{enumerable:true,get:function(){return chunkMJEKZAJO_cjs.c}});Object.defineProperty(exports,"readPnpmWorkspaceFile",{enumerable:true,get:function(){return chunkMJEKZAJO_cjs.d}});Object.defineProperty(exports,"writePnpmWorkspaceFile",{enumerable:true,get:function(){return chunkMJEKZAJO_cjs.e}});
@@ -1,4 +1,4 @@
1
- export { UpgradeCatalogPackageOptions, getCatalog, setCatalog, upgradeCatalogPackage } from './catalog.cjs';
1
+ export { UpgradeCatalogPackageOptions, getCatalog, getCatalogSafe, setCatalog, upgradeCatalogPackage } from './catalog.cjs';
2
2
  export { getPnpmWorkspaceFilePath, readPnpmWorkspaceFile, writePnpmWorkspaceFile } from './pnpm-workspace.cjs';
3
3
  export { replaceDepsAliases } from './replace-deps-aliases.cjs';
4
4
  import '../types.cjs';
@@ -1,4 +1,4 @@
1
- export { UpgradeCatalogPackageOptions, getCatalog, setCatalog, upgradeCatalogPackage } from './catalog.js';
1
+ export { UpgradeCatalogPackageOptions, getCatalog, getCatalogSafe, setCatalog, upgradeCatalogPackage } from './catalog.js';
2
2
  export { getPnpmWorkspaceFilePath, readPnpmWorkspaceFile, writePnpmWorkspaceFile } from './pnpm-workspace.js';
3
3
  export { replaceDepsAliases } from './replace-deps-aliases.js';
4
4
  import '../types.js';
@@ -1 +1 @@
1
- import'../chunk-GV6YH6UO.js';export{a as replaceDepsAliases}from'../chunk-M5HKR2UU.js';export{a as getCatalog,b as setCatalog,c as upgradeCatalogPackage}from'../chunk-HMZUSSXI.js';export{c as getPnpmWorkspaceFilePath,d as readPnpmWorkspaceFile,e as writePnpmWorkspaceFile}from'../chunk-ZK5RQIOO.js';
1
+ import'../chunk-GV6YH6UO.js';export{a as replaceDepsAliases}from'../chunk-ZCIPFY7B.js';export{b as getCatalog,a as getCatalogSafe,c as setCatalog,d as upgradeCatalogPackage}from'../chunk-ETQM4AGR.js';export{c as getPnpmWorkspaceFilePath,d as readPnpmWorkspaceFile,e as writePnpmWorkspaceFile}from'../chunk-7MJHUWVF.js';
@@ -1 +1 @@
1
- 'use strict';var chunk4VKPMCQD_cjs=require('../chunk-4VKPMCQD.cjs');Object.defineProperty(exports,"getPnpmWorkspaceFilePath",{enumerable:true,get:function(){return chunk4VKPMCQD_cjs.c}});Object.defineProperty(exports,"readPnpmWorkspaceFile",{enumerable:true,get:function(){return chunk4VKPMCQD_cjs.d}});Object.defineProperty(exports,"writePnpmWorkspaceFile",{enumerable:true,get:function(){return chunk4VKPMCQD_cjs.e}});
1
+ 'use strict';var chunkMJEKZAJO_cjs=require('../chunk-MJEKZAJO.cjs');Object.defineProperty(exports,"getPnpmWorkspaceFilePath",{enumerable:true,get:function(){return chunkMJEKZAJO_cjs.c}});Object.defineProperty(exports,"readPnpmWorkspaceFile",{enumerable:true,get:function(){return chunkMJEKZAJO_cjs.d}});Object.defineProperty(exports,"writePnpmWorkspaceFile",{enumerable:true,get:function(){return chunkMJEKZAJO_cjs.e}});
@@ -1 +1 @@
1
- export{c as getPnpmWorkspaceFilePath,d as readPnpmWorkspaceFile,e as writePnpmWorkspaceFile}from'../chunk-ZK5RQIOO.js';
1
+ export{c as getPnpmWorkspaceFilePath,d as readPnpmWorkspaceFile,e as writePnpmWorkspaceFile}from'../chunk-7MJHUWVF.js';
@@ -1 +1 @@
1
- 'use strict';var chunkAEQRRF4Z_cjs=require('../chunk-AEQRRF4Z.cjs');require('../chunk-IGOMTZVA.cjs'),require('../chunk-4VKPMCQD.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkAEQRRF4Z_cjs.a}});
1
+ 'use strict';var chunkPCTJLZIA_cjs=require('../chunk-PCTJLZIA.cjs');require('../chunk-W4TJXJ3L.cjs'),require('../chunk-MJEKZAJO.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkPCTJLZIA_cjs.a}});
@@ -1 +1 @@
1
- export{a as replaceDepsAliases}from'../chunk-M5HKR2UU.js';import'../chunk-HMZUSSXI.js';import'../chunk-ZK5RQIOO.js';
1
+ export{a as replaceDepsAliases}from'../chunk-ZCIPFY7B.js';import'../chunk-ETQM4AGR.js';import'../chunk-7MJHUWVF.js';
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';require('./chunk-SFZRYJZ2.cjs'),require('./chunk-QNTSKZUU.cjs');var chunkAEQRRF4Z_cjs=require('./chunk-AEQRRF4Z.cjs'),chunkIGOMTZVA_cjs=require('./chunk-IGOMTZVA.cjs'),chunk4VKPMCQD_cjs=require('./chunk-4VKPMCQD.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkAEQRRF4Z_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkIGOMTZVA_cjs.a}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkIGOMTZVA_cjs.b}});Object.defineProperty(exports,"upgradeCatalogPackage",{enumerable:true,get:function(){return chunkIGOMTZVA_cjs.c}});Object.defineProperty(exports,"getPnpmWorkspaceFilePath",{enumerable:true,get:function(){return chunk4VKPMCQD_cjs.c}});Object.defineProperty(exports,"readPnpmWorkspaceFile",{enumerable:true,get:function(){return chunk4VKPMCQD_cjs.d}});Object.defineProperty(exports,"writePnpmWorkspaceFile",{enumerable:true,get:function(){return chunk4VKPMCQD_cjs.e}});
1
+ 'use strict';require('./chunk-SFZRYJZ2.cjs'),require('./chunk-QNTSKZUU.cjs');var chunkPCTJLZIA_cjs=require('./chunk-PCTJLZIA.cjs'),chunkW4TJXJ3L_cjs=require('./chunk-W4TJXJ3L.cjs'),chunkMJEKZAJO_cjs=require('./chunk-MJEKZAJO.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkPCTJLZIA_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.b}});Object.defineProperty(exports,"getCatalogSafe",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.a}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.c}});Object.defineProperty(exports,"upgradeCatalogPackage",{enumerable:true,get:function(){return chunkW4TJXJ3L_cjs.d}});Object.defineProperty(exports,"getPnpmWorkspaceFilePath",{enumerable:true,get:function(){return chunkMJEKZAJO_cjs.c}});Object.defineProperty(exports,"readPnpmWorkspaceFile",{enumerable:true,get:function(){return chunkMJEKZAJO_cjs.d}});Object.defineProperty(exports,"writePnpmWorkspaceFile",{enumerable:true,get:function(){return chunkMJEKZAJO_cjs.e}});
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { UpgradeCatalogPackageOptions, getCatalog, setCatalog, upgradeCatalogPackage } from './helpers/catalog.cjs';
1
+ export { UpgradeCatalogPackageOptions, getCatalog, getCatalogSafe, setCatalog, upgradeCatalogPackage } from './helpers/catalog.cjs';
2
2
  export { getPnpmWorkspaceFilePath, readPnpmWorkspaceFile, writePnpmWorkspaceFile } from './helpers/pnpm-workspace.cjs';
3
3
  export { replaceDepsAliases } from './helpers/replace-deps-aliases.cjs';
4
4
  export { PnpmWorkspaceFile } from './types.cjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { UpgradeCatalogPackageOptions, getCatalog, setCatalog, upgradeCatalogPackage } from './helpers/catalog.js';
1
+ export { UpgradeCatalogPackageOptions, getCatalog, getCatalogSafe, setCatalog, upgradeCatalogPackage } from './helpers/catalog.js';
2
2
  export { getPnpmWorkspaceFilePath, readPnpmWorkspaceFile, writePnpmWorkspaceFile } from './helpers/pnpm-workspace.js';
3
3
  export { replaceDepsAliases } from './helpers/replace-deps-aliases.js';
4
4
  export { PnpmWorkspaceFile } from './types.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import'./chunk-GGNOJ77I.js';import'./chunk-GV6YH6UO.js';export{a as replaceDepsAliases}from'./chunk-M5HKR2UU.js';export{a as getCatalog,b as setCatalog,c as upgradeCatalogPackage}from'./chunk-HMZUSSXI.js';export{c as getPnpmWorkspaceFilePath,d as readPnpmWorkspaceFile,e as writePnpmWorkspaceFile}from'./chunk-ZK5RQIOO.js';
1
+ import'./chunk-GGNOJ77I.js';import'./chunk-GV6YH6UO.js';export{a as replaceDepsAliases}from'./chunk-ZCIPFY7B.js';export{b as getCatalog,a as getCatalogSafe,c as setCatalog,d as upgradeCatalogPackage}from'./chunk-ETQM4AGR.js';export{c as getPnpmWorkspaceFilePath,d as readPnpmWorkspaceFile,e as writePnpmWorkspaceFile}from'./chunk-7MJHUWVF.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/pnpm-tools",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "A set of [pnpm](https://pnpm.io/) plugins and utilities for managing workspace packages/dependencies.",
6
6
  "repository": {
@@ -10,9 +10,9 @@
10
10
  },
11
11
  "private": false,
12
12
  "bin": {
13
- "storm-pnpm": "./bin/storm-pnpm.js",
14
- "storm-pnpm-cjs": "./bin/storm-pnpm.cjs",
15
- "storm-pnpm-esm": "./bin/storm-pnpm.js"
13
+ "storm-pnpm": "./bin/pnpm.js",
14
+ "storm-pnpm-cjs": "./bin/pnpm.cjs",
15
+ "storm-pnpm-esm": "./bin/pnpm.js"
16
16
  },
17
17
  "main": "./dist/index.cjs",
18
18
  "module": "./dist/index.js",
@@ -89,22 +89,21 @@
89
89
  "dependencies": {
90
90
  "@pnpm/plugin-better-defaults": "^0.2.1",
91
91
  "@pnpm/plugin-esm-node-path": "^0.1.2",
92
- "@storm-software/config": "workspace:*",
93
- "@storm-software/config-tools": "workspace:*",
94
- "@storm-software/npm-tools": "workspace:*",
95
- "commander": "catalog:",
96
- "defu": "catalog:",
97
- "js-yaml": "catalog:",
98
- "prettier": "catalog:",
92
+ "@storm-software/config": "^1.130.3",
93
+ "@storm-software/config-tools": "^1.183.4",
94
+ "@storm-software/npm-tools": "^0.1.4",
95
+ "commander": "^12.1.0",
96
+ "defu": "6.1.4",
97
+ "prettier": "^3.5.1",
99
98
  "prettier-plugin-pkg": "^0.18.1",
100
- "semver": "7.6.2"
99
+ "semver": "7.6.2",
100
+ "yaml": "^2.8.1"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@pnpm/types": "^1000.8.0",
104
- "@types/js-yaml": "catalog:",
105
- "@types/node": "catalog:",
106
- "tsup": "catalog:"
104
+ "@types/node": "^22.10.2",
105
+ "tsup": "8.4.0"
107
106
  },
108
107
  "publishConfig": { "access": "public" },
109
- "gitHead": "ce21e70a6ec68591a79ef01d305b936f8c7a7746"
108
+ "gitHead": "130c0445a406e976d0302d764282acc0b39bb1e2"
110
109
  }
@@ -1,4 +0,0 @@
1
- 'use strict';var fs=require('fs'),path=require('path'),jsYaml=require('js-yaml'),promises=require('fs/promises');var y=/^[A-Za-z]:\//;function x(e=""){return e&&e.replace(/\\/g,"/").replace(y,o=>o.toUpperCase())}var _=/^[/\\]{2}/,P=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,R=/^[A-Za-z]:$/;var l=function(e){if(!e||e.length===0)return ".";e=x(e);let o=e.match(_),t=g(e),n=e[e.length-1]==="/";return e=E(e,!t),e.length===0?t?"/":n?"./":".":(n&&(e+="/"),R.test(e)&&(e+="/"),o?t?`//${e}`:`//./${e}`:t&&!g(e)?`/${e}`:e)},d=function(...e){let o="";for(let t of e)if(t)if(o.length>0){let n=o[o.length-1]==="/",r=t[0]==="/";n&&r?o+=t.slice(1):o+=n||r?t:`/${t}`;}else o+=t;return l(o)};function E(e,o){let t="",n=0,r=-1,c=0,i=null;for(let s=0;s<=e.length;++s){if(s<e.length)i=e[s];else {if(i==="/")break;i="/";}if(i==="/"){if(!(r===s-1||c===1))if(c===2){if(t.length<2||n!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let u=t.lastIndexOf("/");u===-1?(t="",n=0):(t=t.slice(0,u),n=t.length-1-t.lastIndexOf("/")),r=s,c=0;continue}else if(t.length>0){t="",n=0,r=s,c=0;continue}}o&&(t+=t.length>0?"/..":"..",n=2);}else t.length>0?t+=`/${e.slice(r+1,s)}`:t=e.slice(r+1,s),n=s-r-1;r=s,c=0;}else i==="."&&c!==-1?++c:c=-1;}return t}var g=function(e){return P.test(e)};var j=30,A=0;function m(e,o=[],t=[]){let n=e??process.cwd();if(t.some(r=>fs.existsSync(path.join(n,r)))||o.some(r=>fs.existsSync(path.join(n,r))))return n;if(n!=="/"&&A++<j){let r=path.join(n,"..");return m(r,o,t)}}var h=["storm-workspace.json","storm-workspace.yaml","storm-workspace.yml","storm-workspace.js","storm-workspace.ts",".storm-workspace.json",".storm-workspace.yaml",".storm-workspace.yml",".storm-workspace.js",".storm-workspace.ts","lerna.json","nx.json","turbo.json","npm-workspace.json","yarn-workspace.json","pnpm-workspace.json","npm-workspace.yaml","yarn-workspace.yaml","pnpm-workspace.yaml","npm-workspace.yml","yarn-workspace.yml","pnpm-workspace.yml","npm-lock.json","yarn-lock.json","pnpm-lock.json","npm-lock.yaml","yarn-lock.yaml","pnpm-lock.yaml","npm-lock.yml","yarn-lock.yml","pnpm-lock.yml","bun.lockb"],O=[".storm-workspace",".nx",".github",".vscode",".verdaccio"];function T(e){return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH?l(process.env.STORM_WORKSPACE_ROOT??process.env.NX_WORKSPACE_ROOT_PATH):l(m(e??process.cwd(),h,O))}function a(e){let o=T(e);if(!o)throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
2
- ${h.join(`
3
- `)}
4
- Path: ${e||process.cwd()}`);return o}function w(e=a(process.cwd())){let o=d(e,"pnpm-workspace.yaml");if(!fs.existsSync(o))throw new Error(`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${o}).`);return o}async function V(e=a(process.cwd())){return jsYaml.load(w(e))}async function G(e,o=a(process.cwd())){await promises.writeFile(w(o),jsYaml.dump(e));}exports.a=d;exports.b=a;exports.c=w;exports.d=V;exports.e=G;
@@ -1 +0,0 @@
1
- import {b,d,e}from'./chunk-ZK5RQIOO.js';import {exec}from'node:child_process';import {valid,coerce,gt}from'semver';var T="latest";var p=T;async function _(){return new Promise((t,r)=>{exec("npm config get registry",(n,e,i)=>n?r(n):i?r(i):t(e.trim()));})}async function w(t,r=p,n={}){let{registry:e=_()}=n;return new Promise((i,o)=>{exec(`npm view ${t} version --registry=${e} --tag=${r}`,(s,R,u)=>s?o(s):u?o(u):i(R.trim()));})}async function A(t=b(process.cwd())){let r=await d(t);if(r?.catalog)return Object.fromEntries(Object.entries(r.catalog).map(([n,e])=>[n,e.replaceAll(/^"/g,"").replaceAll(/"$/g,"")]));if(!r)throw new Error("No pnpm-workspace.yaml file found");r.catalog||console.warn(`No catalog found in pnpm-workspace.yaml file located in workspace root: ${t}`);}async function x(t,r=b(process.cwd())){let n=await d(r);if(!n)throw new Error("No pnpm-workspace.yaml file found");n.catalog=Object.fromEntries(Object.entries(t).map(([e,i])=>[e,`"${i}"`])),await e(n,r);}async function B(t,r={}){let{tag:n=p,throwIfMissingInCatalog:e=false,workspaceRoot:i=b()}=r,o=await A(i);if(!o)throw new Error("No catalog found");if(e===true&&!o[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(o,null,2)}`);let s=await w(t,n);(!valid(coerce(o[t]))||coerce(o[t])&&coerce(s)&&gt(coerce(s),coerce(o[t])))&&(o[t]=s),await x(o,i);}export{A as a,x as b,B as c};
@@ -1 +0,0 @@
1
- 'use strict';var chunk4VKPMCQD_cjs=require('./chunk-4VKPMCQD.cjs'),child_process=require('child_process'),semver=require('semver');var l="latest";var p=l;async function T(){return new Promise((t,r)=>{child_process.exec("npm config get registry",(n,e,i)=>n?r(n):i?r(i):t(e.trim()));})}async function _(t,r=p,n={}){let{registry:e=T()}=n;return new Promise((i,o)=>{child_process.exec(`npm view ${t} version --registry=${e} --tag=${r}`,(s,w,m)=>s?o(s):m?o(m):i(w.trim()));})}async function G(t=chunk4VKPMCQD_cjs.b(process.cwd())){let r=await chunk4VKPMCQD_cjs.d(t);if(r?.catalog)return Object.fromEntries(Object.entries(r.catalog).map(([n,e])=>[n,e.replaceAll(/^"/g,"").replaceAll(/"$/g,"")]));if(!r)throw new Error("No pnpm-workspace.yaml file found");r.catalog||console.warn(`No catalog found in pnpm-workspace.yaml file located in workspace root: ${t}`);}async function A(t,r=chunk4VKPMCQD_cjs.b(process.cwd())){let n=await chunk4VKPMCQD_cjs.d(r);if(!n)throw new Error("No pnpm-workspace.yaml file found");n.catalog=Object.fromEntries(Object.entries(t).map(([e,i])=>[e,`"${i}"`])),await chunk4VKPMCQD_cjs.e(n,r);}async function W(t,r={}){let{tag:n=p,throwIfMissingInCatalog:e=false,workspaceRoot:i=chunk4VKPMCQD_cjs.b()}=r,o=await G(i);if(!o)throw new Error("No catalog found");if(e===true&&!o[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(o,null,2)}`);let s=await _(t,n);(!semver.valid(semver.coerce(o[t]))||semver.coerce(o[t])&&semver.coerce(s)&&semver.gt(semver.coerce(s),semver.coerce(o[t])))&&(o[t]=s),await A(o,i);}exports.a=G;exports.b=A;exports.c=W;
@@ -1,4 +0,0 @@
1
- import {existsSync}from'node:fs';import {join}from'node:path';import {load,dump}from'js-yaml';import {writeFile}from'node:fs/promises';var x=/^[A-Za-z]:\//;function _(e=""){return e&&e.replace(/\\/g,"/").replace(x,o=>o.toUpperCase())}var P=/^[/\\]{2}/,R=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,E=/^[A-Za-z]:$/;var l=function(e){if(!e||e.length===0)return ".";e=_(e);let o=e.match(P),t=d(e),n=e[e.length-1]==="/";return e=j(e,!t),e.length===0?t?"/":n?"./":".":(n&&(e+="/"),E.test(e)&&(e+="/"),o?t?`//${e}`:`//./${e}`:t&&!d(e)?`/${e}`:e)},k=function(...e){let o="";for(let t of e)if(t)if(o.length>0){let n=o[o.length-1]==="/",r=t[0]==="/";n&&r?o+=t.slice(1):o+=n||r?t:`/${t}`;}else o+=t;return l(o)};function j(e,o){let t="",n=0,r=-1,c=0,i=null;for(let s=0;s<=e.length;++s){if(s<e.length)i=e[s];else {if(i==="/")break;i="/";}if(i==="/"){if(!(r===s-1||c===1))if(c===2){if(t.length<2||n!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let g=t.lastIndexOf("/");g===-1?(t="",n=0):(t=t.slice(0,g),n=t.length-1-t.lastIndexOf("/")),r=s,c=0;continue}else if(t.length>0){t="",n=0,r=s,c=0;continue}}o&&(t+=t.length>0?"/..":"..",n=2);}else t.length>0?t+=`/${e.slice(r+1,s)}`:t=e.slice(r+1,s),n=s-r-1;r=s,c=0;}else i==="."&&c!==-1?++c:c=-1;}return t}var d=function(e){return R.test(e)};var A=30,O=0;function u(e,o=[],t=[]){let n=e??process.cwd();if(t.some(r=>existsSync(join(n,r)))||o.some(r=>existsSync(join(n,r))))return n;if(n!=="/"&&O++<A){let r=join(n,"..");return u(r,o,t)}}var w=["storm-workspace.json","storm-workspace.yaml","storm-workspace.yml","storm-workspace.js","storm-workspace.ts",".storm-workspace.json",".storm-workspace.yaml",".storm-workspace.yml",".storm-workspace.js",".storm-workspace.ts","lerna.json","nx.json","turbo.json","npm-workspace.json","yarn-workspace.json","pnpm-workspace.json","npm-workspace.yaml","yarn-workspace.yaml","pnpm-workspace.yaml","npm-workspace.yml","yarn-workspace.yml","pnpm-workspace.yml","npm-lock.json","yarn-lock.json","pnpm-lock.json","npm-lock.yaml","yarn-lock.yaml","pnpm-lock.yaml","npm-lock.yml","yarn-lock.yml","pnpm-lock.yml","bun.lockb"],T=[".storm-workspace",".nx",".github",".vscode",".verdaccio"];function S(e){return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH?l(process.env.STORM_WORKSPACE_ROOT??process.env.NX_WORKSPACE_ROOT_PATH):l(u(e??process.cwd(),w,T))}function a(e){let o=S(e);if(!o)throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
2
- ${w.join(`
3
- `)}
4
- Path: ${e||process.cwd()}`);return o}function y(e=a(process.cwd())){let o=k(e,"pnpm-workspace.yaml");if(!existsSync(o))throw new Error(`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${o}).`);return o}async function G(e=a(process.cwd())){return load(y(e))}async function q(e,o=a(process.cwd())){await writeFile(y(o),dump(e));}export{k as a,a as b,y as c,G as d,q as e};