@turbo/workspaces 2.7.3 → 2.7.4-canary.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/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as s,b as u,c as D,d as W,e as A,f as d,h as k,i as h,l as I}from"./chunk-2WSM2AFM.mjs";s();import S from"picocolors";import{Command as G}from"commander";var C={name:"@turbo/workspaces",version:"2.7.3",description:"Tools for working with package managers",homepage:"https://turborepo.com",license:"MIT",repository:{type:"git",url:"https://github.com/vercel/turborepo",directory:"packages/turbo-workspaces"},bugs:{url:"https://github.com/vercel/turborepo/issues"},bin:"dist/cli.js",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",scripts:{build:"tsup",dev:"tsup --watch",test:"jest",lint:"eslint src/","check-types":"tsc --noEmit","lint:prettier":"prettier -c . --cache --ignore-path=../../.prettierignore"},dependencies:{commander:"10.0.0",execa:"5.1.1","fast-glob":"3.2.12","fs-extra":"10.1.0","gradient-string":"2.0.1",inquirer:"8.2.4","js-yaml":"4.1.0",ora:"4.1.1",picocolors:"1.0.1",semver:"7.6.2","update-check":"1.5.4"},devDependencies:{"@jest/globals":"29.7.0","@turbo/eslint-config":"workspace:*","@turbo/test-utils":"workspace:*","@turbo/tsconfig":"workspace:*","@turbo/utils":"workspace:*","@types/fs-extra":"9.0.13","@types/gradient-string":"1.1.2","@types/inquirer":"7.3.3","@types/js-yaml":"4.0.5","@types/node":"18.17.4","@types/semver":"7.5.8",jest:"29.7.0","ts-jest":"29.2.5",tsup:"5.12.9",typescript:"5.5.4"},files:["dist"],publishConfig:{access:"public"}};s();s();import x from"path";import R from"inquirer";import i from"picocolors";async function j(t){let r=new h;r.hero();let p=await R.prompt({type:"input",name:"directoryInput",message:"Where is the root of the repo?",when:!t,default:".",validate:e=>{let{exists:o,absolute:n}=d({directory:e});return o?!0:`Directory ${i.dim(`(${n})`)} does not exist`},filter:e=>e.trim()}),{directoryInput:c=t}=p,{exists:v,absolute:m}=d({directory:c});if(!v)return r.error(`Directory ${i.dim(`(${m})`)} does not exist`),process.exit(1);let g=await k({root:m}),l=g.workspaceData.workspaces.length,y=l>0,a={};g.workspaceData.workspaces.forEach(e=>{let n=x.relative(m,e.paths.root).split(x.sep)[0];n in a||(a[n]=[]),a[n].push(e)});let w=e=>`${e.name} (${i.italic(`./${x.relative(m,e.paths.root)}`)})`,f=({number:e,dir:o,workspaces:n})=>{r.indented(2,`${e}. ${i.bold(o)}`),n.forEach((L,T)=>{r.indented(3,`${T+1}. ${w(L)}`)})};r.header("Repository Summary"),r.indented(1,`${i.underline(g.name)}:`),r.indented(1,`Package Manager: ${i.bold(i.italic(g.packageManager))}`),y&&(r.indented(1,`Workspaces (${i.bold(l.toString())}):`),Object.keys(a).forEach((e,o)=>{f({number:o+1,workspaces:a[e],dir:e})}),r.blankLine())}s();import E from"inquirer";import O from"picocolors";function U({packageManager:t,currentWorkspaceManger:r,availablePackageManagers:p}){return r===t?"already in use":p[t]?!1:"not installed"}async function $(t,r,p){let c=new h(p);c.hero(),c.header("Welcome, let's convert your project."),c.blankLine();let v=await E.prompt({type:"input",name:"directoryInput",message:"Where is the root of your repo?",when:!t,default:".",validate:e=>{let{exists:o,absolute:n}=d({directory:e});return o?!0:`Directory ${O.dim(`(${n})`)} does not exist`},filter:e=>e.trim()}),{directoryInput:m=t}=v,{exists:g,absolute:l}=d({directory:m});if(!g)return c.error(`Directory ${O.dim(`(${l})`)} does not exist`),process.exit(1);let[y,a]=await Promise.all([k({root:l}),D()]),w=await E.prompt({name:"packageManagerInput",type:"list",message:`Convert from ${y.packageManager} to:`,when:!r||!Object.keys(a).includes(r),choices:[{pm:"npm",label:"npm"},{pm:"pnpm",label:"pnpm"},{pm:"yarn",label:"yarn"},{pm:"bun",label:"Bun (beta)"}].map(({pm:e,label:o})=>({name:o,value:e,disabled:U({packageManager:e,currentWorkspaceManger:y.packageManager,availablePackageManagers:a})}))}),{packageManagerInput:f=r}=w;await I({project:y,convertTo:{name:f,version:a[f]},logger:c,options:p})}var q=W({packageInfo:C}),b=new G;b.name("@turbo/workspaces").description("Tools for working with package manager workspaces").version(C.version,"-v, --version","output the current version");b.command("convert").description("Convert project between workspace managers").argument("[path]","Project root").argument("[package-manager]","Package manager to convert to").option("--skip-install","Do not run a package manager install after conversion",!1).option("--ignore-unchanged-package-manager","Prevent script failure if the package manager is unchanged",!1).option("--dry","Dry run (no changes are made to files)",!1).option("--force","Bypass Git safety checks and forcibly run conversion",!1).action($);b.command("summary").description("Display a summary of the specified project").argument("[path]","Project root").action(j);b.parseAsync().then(()=>q()).catch(async t=>{u.log(),t instanceof A?u.log(S.red(t.message)):(u.log(S.red("Unexpected error. Please report it as a bug:")),u.log(t)),u.log(),await q(1)});
2
+ import{a as s,b as d,c as D,d as W,e as A,f as u,h as k,i as h,l as I}from"./chunk-ZZWIIAJT.mjs";s();import S from"picocolors";import{Command as G}from"commander";var C={name:"@turbo/workspaces",version:"2.7.4-canary.1",description:"Tools for working with package managers",homepage:"https://turborepo.com",license:"MIT",repository:{type:"git",url:"https://github.com/vercel/turborepo",directory:"packages/turbo-workspaces"},bugs:{url:"https://github.com/vercel/turborepo/issues"},bin:"dist/cli.js",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",scripts:{build:"tsup",dev:"tsup --watch",test:"jest","check-types":"tsc --noEmit","lint:prettier":"prettier -c . --cache --ignore-path=../../.prettierignore"},dependencies:{commander:"10.0.0",execa:"5.1.1","fast-glob":"3.2.12","fs-extra":"10.1.0","gradient-string":"2.0.1",inquirer:"8.2.4","js-yaml":"4.1.0",ora:"4.1.1",picocolors:"1.0.1",semver:"7.6.2","update-check":"1.5.4"},devDependencies:{"@jest/globals":"29.7.0","@turbo/test-utils":"workspace:*","@turbo/tsconfig":"workspace:*","@turbo/utils":"workspace:*","@types/fs-extra":"9.0.13","@types/gradient-string":"1.1.2","@types/inquirer":"7.3.3","@types/js-yaml":"4.0.5","@types/node":"18.17.4","@types/semver":"7.5.8",jest:"29.7.0","ts-jest":"29.2.5",tsup:"5.12.9",typescript:"5.5.4"},files:["dist"],publishConfig:{access:"public"}};s();s();import x from"path";import R from"inquirer";import i from"picocolors";async function j(t){let r=new h;r.hero();let p=await R.prompt({type:"input",name:"directoryInput",message:"Where is the root of the repo?",when:!t,default:".",validate:e=>{let{exists:o,absolute:n}=u({directory:e});return o?!0:`Directory ${i.dim(`(${n})`)} does not exist`},filter:e=>e.trim()}),{directoryInput:c=t}=p,{exists:v,absolute:m}=u({directory:c});if(!v)return r.error(`Directory ${i.dim(`(${m})`)} does not exist`),process.exit(1);let g=await k({root:m}),l=g.workspaceData.workspaces.length,y=l>0,a={};g.workspaceData.workspaces.forEach(e=>{let n=x.relative(m,e.paths.root).split(x.sep)[0];n in a||(a[n]=[]),a[n].push(e)});let w=e=>`${e.name} (${i.italic(`./${x.relative(m,e.paths.root)}`)})`,f=({number:e,dir:o,workspaces:n})=>{r.indented(2,`${e}. ${i.bold(o)}`),n.forEach((L,T)=>{r.indented(3,`${T+1}. ${w(L)}`)})};r.header("Repository Summary"),r.indented(1,`${i.underline(g.name)}:`),r.indented(1,`Package Manager: ${i.bold(i.italic(g.packageManager))}`),y&&(r.indented(1,`Workspaces (${i.bold(l.toString())}):`),Object.keys(a).forEach((e,o)=>{f({number:o+1,workspaces:a[e],dir:e})}),r.blankLine())}s();import E from"inquirer";import O from"picocolors";function U({packageManager:t,currentWorkspaceManger:r,availablePackageManagers:p}){return r===t?"already in use":p[t]?!1:"not installed"}async function $(t,r,p){let c=new h(p);c.hero(),c.header("Welcome, let's convert your project."),c.blankLine();let v=await E.prompt({type:"input",name:"directoryInput",message:"Where is the root of your repo?",when:!t,default:".",validate:e=>{let{exists:o,absolute:n}=u({directory:e});return o?!0:`Directory ${O.dim(`(${n})`)} does not exist`},filter:e=>e.trim()}),{directoryInput:m=t}=v,{exists:g,absolute:l}=u({directory:m});if(!g)return c.error(`Directory ${O.dim(`(${l})`)} does not exist`),process.exit(1);let[y,a]=await Promise.all([k({root:l}),D()]),w=await E.prompt({name:"packageManagerInput",type:"list",message:`Convert from ${y.packageManager} to:`,when:!r||!Object.keys(a).includes(r),choices:[{pm:"npm",label:"npm"},{pm:"pnpm",label:"pnpm"},{pm:"yarn",label:"yarn"},{pm:"bun",label:"Bun (beta)"}].map(({pm:e,label:o})=>({name:o,value:e,disabled:U({packageManager:e,currentWorkspaceManger:y.packageManager,availablePackageManagers:a})}))}),{packageManagerInput:f=r}=w;await I({project:y,convertTo:{name:f,version:a[f]},logger:c,options:p})}var q=W({packageInfo:C}),b=new G;b.name("@turbo/workspaces").description("Tools for working with package manager workspaces").version(C.version,"-v, --version","output the current version");b.command("convert").description("Convert project between workspace managers").argument("[path]","Project root").argument("[package-manager]","Package manager to convert to").option("--skip-install","Do not run a package manager install after conversion",!1).option("--ignore-unchanged-package-manager","Prevent script failure if the package manager is unchanged",!1).option("--dry","Dry run (no changes are made to files)",!1).option("--force","Bypass Git safety checks and forcibly run conversion",!1).action($);b.command("summary").description("Display a summary of the specified project").argument("[path]","Project root").action(j);b.parseAsync().then(()=>q()).catch(async t=>{d.log(),t instanceof A?d.log(S.red(t.message)):(d.log(S.red("Unexpected error. Please report it as a bug:")),d.log(t)),d.log(),await q(1)});
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ declare class Logger {
4
4
  interactive: boolean;
5
5
  dry: boolean;
6
6
  step: number;
7
- constructor({ interactive, dry, }?: {
7
+ constructor({ interactive, dry }?: {
8
8
  interactive?: boolean;
9
9
  dry?: boolean;
10
10
  });
@@ -125,7 +125,7 @@ interface ManagerHandler {
125
125
  convertLock: ManagerConvert;
126
126
  }
127
127
 
128
- declare function getWorkspaceDetails({ root, }: {
128
+ declare function getWorkspaceDetails({ root }: {
129
129
  root: string;
130
130
  }): Promise<Project>;
131
131
 
@@ -143,7 +143,7 @@ declare class ConvertError extends Error {
143
143
 
144
144
  declare const MANAGERS: Record<PackageManager, ManagerHandler>;
145
145
 
146
- declare function convert({ root, to, options, }: {
146
+ declare function convert({ root, to, options }: {
147
147
  root: string;
148
148
  to: PackageManager;
149
149
  options?: Options;