@storm-software/pnpm-tools 0.1.0 → 0.1.1

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 ADDED
@@ -0,0 +1,23 @@
1
+ ![Storm Software's logo banner](https://public.storm-cdn.com/brand-banner.png)
2
+
3
+ # Changelog for Storm Ops - Pnpm Tools
4
+
5
+ ## [0.1.0](https://github.com/storm-software/storm-ops/releases/tag/pnpm-tools%400.1.0) (2025-09-13)
6
+
7
+ ### Features
8
+
9
+ - **pnpm-tools:** Added the `storm-pnpm` CLI binary
10
+ ([1b34382c9](https://github.com/storm-software/storm-ops/commit/1b34382c9))
11
+ - **pnpm-tools:** Initial check-in of `pnpm-tools` utility package
12
+ ([3bb1916af](https://github.com/storm-software/storm-ops/commit/3bb1916af))
13
+
14
+ ### Miscellaneous
15
+
16
+ - **monorepo:** Regenerate README markdown files
17
+ ([f6d595334](https://github.com/storm-software/storm-ops/commit/f6d595334))
18
+
19
+ ### Updated Dependencies
20
+
21
+ - Updated config-tools to 1.183.1
22
+ - Updated npm-tools to 0.1.1
23
+ - Updated config to 1.130.1
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // bin/storm-pnpm.ts
4
- var import_config_tools2 = require("@storm-software/config-tools");
4
+ var import_get_config = require("@storm-software/config-tools/get-config");
5
+ var import_console = require("@storm-software/config-tools/logger/console");
6
+ var import_process_handler = require("@storm-software/config-tools/utilities/process-handler");
5
7
 
6
8
  // src/cli/index.ts
7
9
  var import_config_tools = require("@storm-software/config-tools");
@@ -20,25 +22,23 @@ var import_find_workspace_root = require("@storm-software/config-tools/utilities
20
22
  var import_js_yaml = require("js-yaml");
21
23
  var import_node_fs = require("fs");
22
24
  var import_promises = require("fs/promises");
23
- async function readPnpmWorkspaceFile(workspaceRoot = (0, import_find_workspace_root.findWorkspaceRoot)(process.cwd())) {
25
+ function getPnpmWorkspaceFilePath(workspaceRoot = (0, import_find_workspace_root.findWorkspaceRoot)(process.cwd())) {
24
26
  const pnpmWorkspacePath = (0, import_correct_paths.joinPaths)(workspaceRoot, "pnpm-workspace.yaml");
25
27
  if (!(0, import_node_fs.existsSync)(pnpmWorkspacePath)) {
26
- console.warn(
28
+ throw new Error(
27
29
  `No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${pnpmWorkspacePath}).`
28
30
  );
29
- return;
30
31
  }
31
- return (0, import_js_yaml.load)(pnpmWorkspacePath);
32
+ return pnpmWorkspacePath;
33
+ }
34
+ async function readPnpmWorkspaceFile(workspaceRoot = (0, import_find_workspace_root.findWorkspaceRoot)(process.cwd())) {
35
+ return (0, import_js_yaml.load)(getPnpmWorkspaceFilePath(workspaceRoot));
32
36
  }
33
37
  async function writePnpmWorkspaceFile(pnpmWorkspaceFile, workspaceRoot = (0, import_find_workspace_root.findWorkspaceRoot)(process.cwd())) {
34
- const pnpmWorkspacePath = (0, import_correct_paths.joinPaths)(workspaceRoot, "pnpm-workspace.yaml");
35
- if (!(0, import_node_fs.existsSync)(pnpmWorkspacePath)) {
36
- console.warn(
37
- `No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${pnpmWorkspacePath}).`
38
- );
39
- return;
40
- }
41
- await (0, import_promises.writeFile)(pnpmWorkspacePath, (0, import_js_yaml.dump)(pnpmWorkspaceFile));
38
+ await (0, import_promises.writeFile)(
39
+ getPnpmWorkspaceFilePath(workspaceRoot),
40
+ (0, import_js_yaml.dump)(pnpmWorkspaceFile)
41
+ );
42
42
  }
43
43
 
44
44
  // src/helpers/catalog.ts
@@ -51,6 +51,14 @@ async function getCatalog(workspaceRoot = (0, import_find_workspace_root2.findWo
51
51
  })
52
52
  );
53
53
  }
54
+ if (!pnpmWorkspaceFile) {
55
+ throw new Error("No pnpm-workspace.yaml file found");
56
+ }
57
+ if (!pnpmWorkspaceFile.catalog) {
58
+ console.warn(
59
+ `No catalog found in pnpm-workspace.yaml file located in workspace root: ${workspaceRoot}`
60
+ );
61
+ }
54
62
  return;
55
63
  }
56
64
  async function setCatalog(catalog, workspaceRoot = (0, import_find_workspace_root2.findWorkspaceRoot)(process.cwd())) {
@@ -173,18 +181,18 @@ ${error.message}`,
173
181
 
174
182
  // bin/storm-pnpm.ts
175
183
  void (async () => {
176
- const config = await (0, import_config_tools2.getConfig)();
184
+ const config = await (0, import_get_config.getConfig)();
177
185
  try {
178
- (0, import_config_tools2.handleProcess)(config);
186
+ (0, import_process_handler.handleProcess)(config);
179
187
  const program = createProgram(config);
180
188
  await program.parseAsync(process.argv);
181
- (0, import_config_tools2.writeSuccess)(
189
+ (0, import_console.writeSuccess)(
182
190
  `\u{1F389} Git ${process.argv && process.argv.length >= 3 && process.argv[2] ? process.argv[2] : "tool"} processing completed successfully!`,
183
191
  config
184
192
  );
185
- (0, import_config_tools2.exitWithSuccess)(config);
193
+ (0, import_process_handler.exitWithSuccess)(config);
186
194
  } catch (error) {
187
- (0, import_config_tools2.exitWithError)(config);
195
+ (0, import_process_handler.exitWithError)(config);
188
196
  process.exit(1);
189
197
  }
190
198
  })();
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // bin/storm-pnpm.ts
4
+ import { getConfig } from "@storm-software/config-tools/get-config";
5
+ import { writeSuccess as writeSuccess2 } from "@storm-software/config-tools/logger/console";
4
6
  import {
5
7
  exitWithError,
6
8
  exitWithSuccess,
7
- getConfig,
8
- handleProcess,
9
- writeSuccess as writeSuccess2
10
- } from "@storm-software/config-tools";
9
+ handleProcess
10
+ } from "@storm-software/config-tools/utilities/process-handler";
11
11
 
12
12
  // src/cli/index.ts
13
13
  import {
@@ -31,25 +31,23 @@ import { findWorkspaceRoot } from "@storm-software/config-tools/utilities/find-w
31
31
  import { dump, load } from "js-yaml";
32
32
  import { existsSync } from "node:fs";
33
33
  import { writeFile } from "node:fs/promises";
34
- async function readPnpmWorkspaceFile(workspaceRoot = findWorkspaceRoot(process.cwd())) {
34
+ function getPnpmWorkspaceFilePath(workspaceRoot = findWorkspaceRoot(process.cwd())) {
35
35
  const pnpmWorkspacePath = joinPaths(workspaceRoot, "pnpm-workspace.yaml");
36
36
  if (!existsSync(pnpmWorkspacePath)) {
37
- console.warn(
37
+ throw new Error(
38
38
  `No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${pnpmWorkspacePath}).`
39
39
  );
40
- return;
41
40
  }
42
- return load(pnpmWorkspacePath);
41
+ return pnpmWorkspacePath;
42
+ }
43
+ async function readPnpmWorkspaceFile(workspaceRoot = findWorkspaceRoot(process.cwd())) {
44
+ return load(getPnpmWorkspaceFilePath(workspaceRoot));
43
45
  }
44
46
  async function writePnpmWorkspaceFile(pnpmWorkspaceFile, workspaceRoot = findWorkspaceRoot(process.cwd())) {
45
- const pnpmWorkspacePath = joinPaths(workspaceRoot, "pnpm-workspace.yaml");
46
- if (!existsSync(pnpmWorkspacePath)) {
47
- console.warn(
48
- `No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${pnpmWorkspacePath}).`
49
- );
50
- return;
51
- }
52
- await writeFile(pnpmWorkspacePath, dump(pnpmWorkspaceFile));
47
+ await writeFile(
48
+ getPnpmWorkspaceFilePath(workspaceRoot),
49
+ dump(pnpmWorkspaceFile)
50
+ );
53
51
  }
54
52
 
55
53
  // src/helpers/catalog.ts
@@ -62,6 +60,14 @@ async function getCatalog(workspaceRoot = findWorkspaceRoot2(process.cwd())) {
62
60
  })
63
61
  );
64
62
  }
63
+ if (!pnpmWorkspaceFile) {
64
+ throw new Error("No pnpm-workspace.yaml file found");
65
+ }
66
+ if (!pnpmWorkspaceFile.catalog) {
67
+ console.warn(
68
+ `No catalog found in pnpm-workspace.yaml file located in workspace root: ${workspaceRoot}`
69
+ );
70
+ }
65
71
  return;
66
72
  }
67
73
  async function setCatalog(catalog, workspaceRoot = findWorkspaceRoot2(process.cwd())) {
@@ -0,0 +1,4 @@
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 +1 @@
1
- 'use strict';var chunkA7CA5CJR_cjs=require('./chunk-A7CA5CJR.cjs'),chunkPTW7Z2XZ_cjs=require('./chunk-PTW7Z2XZ.cjs'),devkit=require('@nx/devkit'),fs=require('fs'),promises=require('fs/promises'),prettier=require('prettier');async function C(c=process.cwd(),i=chunkPTW7Z2XZ_cjs.b(c)){let l=chunkPTW7Z2XZ_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 chunkA7CA5CJR_cjs.a(i),r=JSON.parse(m),g=chunkPTW7Z2XZ_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=chunkPTW7Z2XZ_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 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;
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
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 +1 @@
1
- import {a as a$1}from'./chunk-37NNBVUD.js';import {b,a}from'./chunk-E5PO4ZUE.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 {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};
@@ -0,0 +1,4 @@
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};
@@ -1 +1 @@
1
- 'use strict';var chunkA7CA5CJR_cjs=require('../chunk-A7CA5CJR.cjs');require('../chunk-PTW7Z2XZ.cjs');Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkA7CA5CJR_cjs.a}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkA7CA5CJR_cjs.b}});Object.defineProperty(exports,"upgradeCatalogPackage",{enumerable:true,get:function(){return chunkA7CA5CJR_cjs.c}});
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 +1 @@
1
- export{a as getCatalog,b as setCatalog,c as upgradeCatalogPackage}from'../chunk-37NNBVUD.js';import'../chunk-E5PO4ZUE.js';
1
+ export{a as getCatalog,b as setCatalog,c as upgradeCatalogPackage}from'../chunk-HMZUSSXI.js';import'../chunk-ZK5RQIOO.js';
@@ -1 +1 @@
1
- 'use strict';require('../chunk-QNTSKZUU.cjs');var chunkMIMRANFI_cjs=require('../chunk-MIMRANFI.cjs'),chunkA7CA5CJR_cjs=require('../chunk-A7CA5CJR.cjs'),chunkPTW7Z2XZ_cjs=require('../chunk-PTW7Z2XZ.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkMIMRANFI_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkA7CA5CJR_cjs.a}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkA7CA5CJR_cjs.b}});Object.defineProperty(exports,"upgradeCatalogPackage",{enumerable:true,get:function(){return chunkA7CA5CJR_cjs.c}});Object.defineProperty(exports,"getPnpmWorkspaceFilePath",{enumerable:true,get:function(){return chunkPTW7Z2XZ_cjs.c}});Object.defineProperty(exports,"readPnpmWorkspaceFile",{enumerable:true,get:function(){return chunkPTW7Z2XZ_cjs.d}});Object.defineProperty(exports,"writePnpmWorkspaceFile",{enumerable:true,get:function(){return chunkPTW7Z2XZ_cjs.e}});
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 +1 @@
1
- import'../chunk-GV6YH6UO.js';export{a as replaceDepsAliases}from'../chunk-OOW4ISC7.js';export{a as getCatalog,b as setCatalog,c as upgradeCatalogPackage}from'../chunk-37NNBVUD.js';export{c as getPnpmWorkspaceFilePath,d as readPnpmWorkspaceFile,e as writePnpmWorkspaceFile}from'../chunk-E5PO4ZUE.js';
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 +1 @@
1
- 'use strict';var chunkPTW7Z2XZ_cjs=require('../chunk-PTW7Z2XZ.cjs');Object.defineProperty(exports,"getPnpmWorkspaceFilePath",{enumerable:true,get:function(){return chunkPTW7Z2XZ_cjs.c}});Object.defineProperty(exports,"readPnpmWorkspaceFile",{enumerable:true,get:function(){return chunkPTW7Z2XZ_cjs.d}});Object.defineProperty(exports,"writePnpmWorkspaceFile",{enumerable:true,get:function(){return chunkPTW7Z2XZ_cjs.e}});
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}});
@@ -7,7 +7,7 @@ import { PnpmWorkspaceFile } from '../types.cjs';
7
7
  * @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.
8
8
  * @throws Will throw an error if the `pnpm-workspace.yaml` file is found but cannot be read.
9
9
  */
10
- declare function getPnpmWorkspaceFilePath(workspaceRoot?: string): Promise<string | undefined>;
10
+ declare function getPnpmWorkspaceFilePath(workspaceRoot?: string): string;
11
11
  /**
12
12
  * Retrieve the pnpm catalog from the workspace's `pnpm-workspace.yaml` file.
13
13
  *
@@ -7,7 +7,7 @@ import { PnpmWorkspaceFile } from '../types.js';
7
7
  * @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.
8
8
  * @throws Will throw an error if the `pnpm-workspace.yaml` file is found but cannot be read.
9
9
  */
10
- declare function getPnpmWorkspaceFilePath(workspaceRoot?: string): Promise<string | undefined>;
10
+ declare function getPnpmWorkspaceFilePath(workspaceRoot?: string): string;
11
11
  /**
12
12
  * Retrieve the pnpm catalog from the workspace's `pnpm-workspace.yaml` file.
13
13
  *
@@ -1 +1 @@
1
- export{c as getPnpmWorkspaceFilePath,d as readPnpmWorkspaceFile,e as writePnpmWorkspaceFile}from'../chunk-E5PO4ZUE.js';
1
+ export{c as getPnpmWorkspaceFilePath,d as readPnpmWorkspaceFile,e as writePnpmWorkspaceFile}from'../chunk-ZK5RQIOO.js';
@@ -1 +1 @@
1
- 'use strict';var chunkMIMRANFI_cjs=require('../chunk-MIMRANFI.cjs');require('../chunk-A7CA5CJR.cjs'),require('../chunk-PTW7Z2XZ.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkMIMRANFI_cjs.a}});
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 +1 @@
1
- export{a as replaceDepsAliases}from'../chunk-OOW4ISC7.js';import'../chunk-37NNBVUD.js';import'../chunk-E5PO4ZUE.js';
1
+ export{a as replaceDepsAliases}from'../chunk-M5HKR2UU.js';import'../chunk-HMZUSSXI.js';import'../chunk-ZK5RQIOO.js';
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';require('./chunk-SFZRYJZ2.cjs'),require('./chunk-QNTSKZUU.cjs');var chunkMIMRANFI_cjs=require('./chunk-MIMRANFI.cjs'),chunkA7CA5CJR_cjs=require('./chunk-A7CA5CJR.cjs'),chunkPTW7Z2XZ_cjs=require('./chunk-PTW7Z2XZ.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkMIMRANFI_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkA7CA5CJR_cjs.a}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkA7CA5CJR_cjs.b}});Object.defineProperty(exports,"upgradeCatalogPackage",{enumerable:true,get:function(){return chunkA7CA5CJR_cjs.c}});Object.defineProperty(exports,"getPnpmWorkspaceFilePath",{enumerable:true,get:function(){return chunkPTW7Z2XZ_cjs.c}});Object.defineProperty(exports,"readPnpmWorkspaceFile",{enumerable:true,get:function(){return chunkPTW7Z2XZ_cjs.d}});Object.defineProperty(exports,"writePnpmWorkspaceFile",{enumerable:true,get:function(){return chunkPTW7Z2XZ_cjs.e}});
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}});
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import'./chunk-GGNOJ77I.js';import'./chunk-GV6YH6UO.js';export{a as replaceDepsAliases}from'./chunk-OOW4ISC7.js';export{a as getCatalog,b as setCatalog,c as upgradeCatalogPackage}from'./chunk-37NNBVUD.js';export{c as getPnpmWorkspaceFilePath,d as readPnpmWorkspaceFile,e as writePnpmWorkspaceFile}from'./chunk-E5PO4ZUE.js';
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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/pnpm-tools",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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": {
@@ -106,5 +106,5 @@
106
106
  "tsup": "catalog:"
107
107
  },
108
108
  "publishConfig": { "access": "public" },
109
- "gitHead": "512d1169996114a42d66c6fbbcd38bb04b5fc695"
109
+ "gitHead": "ce21e70a6ec68591a79ef01d305b936f8c7a7746"
110
110
  }
@@ -1 +0,0 @@
1
- import {b,d,e}from'./chunk-E5PO4ZUE.js';import {exec}from'node:child_process';import {valid,coerce,gt}from'semver';var _="latest";var p=_;async function l(){return new Promise((t,r)=>{exec("npm config get registry",(n,o,i)=>n?r(n):i?r(i):t(o.trim()));})}async function R(t,r=p,n={}){let{registry:o=l()}=n;return new Promise((i,e)=>{exec(`npm view ${t} version --registry=${o} --tag=${r}`,(s,E,u)=>s?e(s):u?e(u):i(E.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,o])=>[n,o.replaceAll(/^"/g,"").replaceAll(/"$/g,"")]))}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(([o,i])=>[o,`"${i}"`])),await e(n,r);}async function B(t,r={}){let{tag:n=p,throwIfMissingInCatalog:o=false,workspaceRoot:i=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 R(t,n);(!valid(coerce(e[t]))||coerce(e[t])&&coerce(s)&&gt(coerce(s),coerce(e[t])))&&(e[t]=s),await x(e,i);}export{A as a,x as b,B as c};
@@ -1 +0,0 @@
1
- 'use strict';var chunkPTW7Z2XZ_cjs=require('./chunk-PTW7Z2XZ.cjs'),child_process=require('child_process'),semver=require('semver');var T="latest";var p=T;async function _(){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 l(t,r=p,n={}){let{registry:o=_()}=n;return new Promise((i,e)=>{child_process.exec(`npm view ${t} version --registry=${o} --tag=${r}`,(s,R,m)=>s?e(s):m?e(m):i(R.trim()));})}async function y(t=chunkPTW7Z2XZ_cjs.b(process.cwd())){let r=await chunkPTW7Z2XZ_cjs.d(t);if(r?.catalog)return Object.fromEntries(Object.entries(r.catalog).map(([n,o])=>[n,o.replaceAll(/^"/g,"").replaceAll(/"$/g,"")]))}async function A(t,r=chunkPTW7Z2XZ_cjs.b(process.cwd())){let n=await chunkPTW7Z2XZ_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 chunkPTW7Z2XZ_cjs.e(n,r);}async function W(t,r={}){let{tag:n=p,throwIfMissingInCatalog:o=false,workspaceRoot:i=chunkPTW7Z2XZ_cjs.b()}=r,e=await y(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 l(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 A(e,i);}exports.a=y;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 P(e=""){return e&&e.replace(/\\/g,"/").replace(x,n=>n.toUpperCase())}var _=/^[/\\]{2}/,R=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,E=/^[A-Za-z]:$/;var a=function(e){if(!e||e.length===0)return ".";e=P(e);let n=e.match(_),t=h(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&&!h(e)?`/${e}`:e)},l=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 a(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 k=t.lastIndexOf("/");k===-1?(t="",o=0):(t=t.slice(0,k),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 h=function(e){return R.test(e)};var A=30,O=0;function d(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 d(r,n,t)}}var y=["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 W(e){return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH?a(process.env.STORM_WORKSPACE_ROOT??process.env.NX_WORKSPACE_ROOT_PATH):a(d(e??process.cwd(),y,T))}function p(e){let n=W(e);if(!n)throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
2
- ${y.join(`
3
- `)}
4
- Path: ${e||process.cwd()}`);return n}async function V(e=p(process.cwd())){let n=l(e,"pnpm-workspace.yaml");if(!existsSync(n)){console.warn(`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${n}).`);return}return n}async function G(e=p(process.cwd())){let n=l(e,"pnpm-workspace.yaml");if(!existsSync(n)){console.warn(`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${n}).`);return}return load(n)}async function q(e,n=p(process.cwd())){let t=l(n,"pnpm-workspace.yaml");if(!existsSync(t)){console.warn(`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${t}).`);return}await writeFile(t,dump(e));}export{l as a,p as b,V as c,G as d,q as e};
@@ -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,n=>n.toUpperCase())}var P=/^[/\\]{2}/,_=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,R=/^[A-Za-z]:$/;var a=function(e){if(!e||e.length===0)return ".";e=x(e);let n=e.match(P),t=k(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&&!k(e)?`/${e}`:e)},l=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 a(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 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 k=function(e){return _.test(e)};var j=30,A=0;function u(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 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"],O=[".storm-workspace",".nx",".github",".vscode",".verdaccio"];function T(e){return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH?a(process.env.STORM_WORKSPACE_ROOT??process.env.NX_WORKSPACE_ROOT_PATH):a(u(e??process.cwd(),w,O))}function p(e){let n=T(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}async function M(e=p(process.cwd())){let n=l(e,"pnpm-workspace.yaml");if(!fs.existsSync(n)){console.warn(`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${n}).`);return}return n}async function V(e=p(process.cwd())){let n=l(e,"pnpm-workspace.yaml");if(!fs.existsSync(n)){console.warn(`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${n}).`);return}return jsYaml.load(n)}async function G(e,n=p(process.cwd())){let t=l(n,"pnpm-workspace.yaml");if(!fs.existsSync(t)){console.warn(`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${t}).`);return}await promises.writeFile(t,jsYaml.dump(e));}exports.a=l;exports.b=p;exports.c=M;exports.d=V;exports.e=G;