@kitschpatrol/prettier-config 3.0.2 → 3.0.3
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/bin/cli.js +2 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -44,8 +44,8 @@ ${s}`,i=`${s||""}${i}
|
|
|
44
44
|
--print-config, -p <path> Print the effective configuration at a certain path.`;break}case"help":break;case"version":break;default:console.error(`Unknown command name in generateHelpText: ${n}`)}return r+=`
|
|
45
45
|
--help, -h Print this help info.`,r+=`
|
|
46
46
|
--version, -v Print the package version.
|
|
47
|
-
`,r}function Ip(e){return Object.keys(e).reduce((t,r)=>{let n={};switch(r){case"init":{n={shortFlag:"i",type:"boolean"};break}case"check":{n={aliases:["lint",""],shortFlag:"l",type:"boolean"};break}case"fix":{n={shortFlag:"f",type:"boolean"};break}case"printConfig":{n={shortFlag:"p",type:"boolean"};break}case"help":{n={
|
|
48
|
-
`),process.exit(1))}async function as(e,t,r,n){let i=rs({allowUnknownFlags:!1,booleanDefault:void 0,flags:Ip(n),help:xp(e,n),importMeta:import.meta}),{flags:s,input:o}=i,a=Object.keys(n).reduce((p,d)=>(s[d]&&(p[d]=n[d]),p),{}),l=Rp(t,r);l.pipe(process.stdout),Object.keys(a).length===0&&(n.check===void 0?l.write(`
|
|
47
|
+
`,r}function Ip(e){return Object.keys(e).reduce((t,r)=>{let n={};switch(r){case"init":{n={shortFlag:"i",type:"boolean"};break}case"check":{n={aliases:["lint",""],shortFlag:"l",type:"boolean"};break}case"fix":{n={shortFlag:"f",type:"boolean"};break}case"printConfig":{n={shortFlag:"p",type:"boolean"};break}case"help":{n={type:"boolean"};break}case"version":{n={type:"boolean"};break}default:console.error(`Unknown command name: ${r}`)}return t[r]=n,t},{})}async function ss(e,t,r=[]){if(t.command!==void 0&&typeof t.command=="string"){let n;try{let i=Cp(t.command,[...t.options??[],...r],{env:{FORCE_COLOR:"true"},stdin:"inherit"});i.stdout?.pipe(e,{end:!1}),i.stderr?.pipe(e,{end:!1}),await i,n=i.exitCode??1}catch(i){n=typeof i.exitCode=="number"?i.exitCode:1}return n}return e.write(`Error: Invalid optionCommand: ${JSON.stringify(t,void 0,2)}`),1}function os(e,t,r){e.length===0&&!t.defaultArguments&&(r.write(`Error: This command must be used with a file argument
|
|
48
|
+
`),process.exit(1))}async function as(e,t,r,n){let i=rs({allowUnknownFlags:!1,booleanDefault:void 0,flags:Ip(n),help:xp(e,n),importMeta:import.meta}),{flags:s,input:o}=i,a=Object.keys(n).reduce((p,d)=>(s[d]&&(p[d]=n[d]),p),{}),l=Rp(t,r);l.pipe(process.stdout),Object.keys(a).length===0&&(n.check===void 0?l.write(`This command requires options. Run ${e} --help for valid commands.
|
|
49
49
|
`):a.check=n.check);let u=0;for(let[p,d]of Object.entries(a))if(typeof d.command=="function"){os(o,d,l);let y=o.length===0?d.defaultArguments??[]:o,w=d.options??[];u+=await d.command(l,y,w)}else if(typeof d.command=="string")os(o,d,l),u+=await ss(l,d,o.length===0?d.defaultArguments:o);else switch(p){case"init":{let y=await br();if(y===void 0){l.write("Error: The `--init` flag must be used in a directory with a package.json file\n"),u+=1;break}let w=await br({cwd:Ap(import.meta.url)});if(w===void 0){l.write(`Error: The script being called was not in a package, weird.
|
|
50
50
|
`),u+=1;break}let b=yr.join(yr.dirname(w),"init/"),f=yr.dirname(y);l.write(`Copying initial configuration files from:
|
|
51
51
|
"${b}" \u2192 "${f}"
|