@yunarch/config-web 0.5.0 → 0.5.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/bun-run-all/bun-run-all.cli.js +5 -5
- package/dist/cli/chunk-3QWYGBKZ.js +1 -0
- package/dist/cli/openapi-sync/openapi-sync-lint-msw-handlers.cli.js +2 -454
- package/dist/cli/openapi-sync/openapi-sync.cli.js +124 -7
- package/dist/cli/turbo-select/turbo-select.cli.js +4 -4
- package/package.json +2 -1
- package/dist/cli/chunk-OOETI6RK.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import{
|
|
3
|
-
`))}function
|
|
2
|
+
import{c as p}from"../chunk-3QWYGBKZ.js";import{styleText as h}from"util";import{styleText as l}from"util";var d=["blue","green","yellow","grey","white","cyan"],m=o=>`${(Number(Bun.nanoseconds()-o)/1e6/1e3).toFixed(2)}s`;function b({start:o,tasks:e,failedTasks:n}){let c=e-n,a=m(o),t=n>0?l("red",`${n} failed`):"",i=c>0?l("green",`${c} successful`):"";console.log(""),console.log(l(["white","bold"],"Tasks: "),`${t}${t&&i?"|":""}${i}`,l("gray",`-- ${e} total`)),console.log(l(["white","bold"],"Time: "),l("gray",`${a}
|
|
3
|
+
`))}function g({index:o,script:e,continueOnError:n,reportTime:c}){let a=d[o%d.length],t=Bun.nanoseconds(),i=Bun.spawn(["bun","run",e],{stdout:"pipe",stderr:"pipe",env:{...Bun.env,FORCE_COLOR:"1"},onExit(r,s){s===1&&!n&&process.exit(1)}});return i.stdout.pipeTo(new WritableStream({write(r){let s=new TextDecoder().decode(r).split(`
|
|
4
4
|
`);for(let u of s)console.log(l([a,"bold"],`${e}:`),u)}})),i.stderr.pipeTo(new WritableStream({write(r){let s=new TextDecoder().decode(r).split(`
|
|
5
|
-
`);for(let u of s)console.log(l([a,"bold"],`${e}:`),u)}})),i.exited.then(r=>{r===0&&c&&console.log(l([a,"bold"],`${e}:`),l(["gray"],"Finished in"),l(["white","bold"],
|
|
5
|
+
`);for(let u of s)console.log(l([a,"bold"],`${e}:`),u)}})),i.exited.then(r=>{r===0&&c&&console.log(l([a,"bold"],`${e}:`),l(["gray"],"Finished in"),l(["white","bold"],m(t)))}),i}async function f(o,e){let{continueOnError:n,reportTime:c}=e,a=Bun.nanoseconds(),t=o.map((s,u)=>g({index:u,script:s,continueOnError:n,reportTime:c})),r=(await Promise.allSettled(t.map(s=>s.exited))).filter(s=>s.status==="rejected"||s.value!==0).length;return b({start:a,tasks:o.length,failedTasks:r}),r>0?1:0}async function x(o,e){let{continueOnError:n,reportTime:c}=e,a=Bun.nanoseconds(),t=0;for(let[i,r]of o.entries())await g({index:i,script:r,continueOnError:n,reportTime:c}).exited!==0&&t++;return b({start:a,tasks:o.length,failedTasks:t}),t>0?1:0}p().name("bun-run-all").description("Run given package scripts in parallel or sequential by using bun.").argument("<scripts...>","A list of package scripts' names.").option("-c, --continue-on-error","Continue executing other/subsequent tasks even if a task threw an error").option("-p, --parallel","Run a group of tasks in parallel.").option("-s, --sequential","Run a group of tasks sequentially.").option("-t, --time","Report execution time for each task.").addHelpText("after",`
|
|
6
6
|
Example usage:
|
|
7
7
|
|
|
8
|
-
$ bun-run-all script1 script2`).action(async(o,e)=>{try{console.log(
|
|
8
|
+
$ bun-run-all script1 script2`).action(async(o,e)=>{try{console.log(h("magenta",`
|
|
9
9
|
\u{1F680} bun-run-all
|
|
10
|
-
`));let n=e.sequential??!1,c=e.parallel??!n,a=e.continueOnError??!1,t=e.time??!1;if(c===n&&(console.error("You cannot use both --parallel and --sequential options at the same time."),process.exit(1)),n){let r=await
|
|
10
|
+
`));let n=e.sequential??!1,c=e.parallel??!n,a=e.continueOnError??!1,t=e.time??!1;if(c===n&&(console.error("You cannot use both --parallel and --sequential options at the same time."),process.exit(1)),n){let r=await x(o,{continueOnError:a,reportTime:t});process.exit(r)}let i=await f(o,{continueOnError:a,reportTime:t});process.exit(i)}catch(n){console.error(n),process.exit(1)}}).parseAsync(process.argv);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{exec as c}from"child_process";import{promisify as p,styleText as e,types as u}from"util";import{Command as l}from"commander";import y from"ora";var d=p(c);async function h(n){let{command:t,name:r,options:a}=n,s=y(r);s.spinner=a?.spinner??"aesthetic";let m=Date.now();s.start();try{let o=typeof t=="string"?await d(t):u.isPromise(t)?await t:await t();return s.succeed(a?.showTime?`${e("dim",`${Date.now()-m}ms`)} ${r}`:void 0),await new Promise(i=>{setTimeout(i,0)}),typeof o=="object"&&o&&"stdout"in o?o.stdout:o}catch(o){let i=o;throw s.fail(e("red",i.stderr??i.message??"")),o}}function P(){let n=new l;return n.configureHelp({styleTitle:t=>e("bold",t),styleCommandText:t=>e("cyan",t),styleCommandDescription:t=>e("magenta",t),styleDescriptionText:t=>e("italic",t),styleOptionText:t=>e("green",t),styleArgumentText:t=>e("yellow",t),styleSubcommandText:t=>e("blue",t)}).configureOutput({outputError:(t,r)=>{r(e("red",t))}}),n}export{d as a,h as b,P as c};
|