@yunarch/config-web 0.2.3 → 0.2.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import{c as p}from"../chunk-PWSW557X.js";import{styleText as h}from"util";import{styleText as
|
|
3
|
-
`))}function g({index:t,script:e,continueOnError:n,reportTime:
|
|
4
|
-
`);for(let u of c)console.log(
|
|
5
|
-
`);for(let u of c)console.log(
|
|
2
|
+
import{c as p}from"../chunk-PWSW557X.js";import{styleText as h}from"util";import{styleText as i}from"util";var d=["blue","green","yellow","grey","white","cyan"],m=t=>`${(Number(Bun.nanoseconds()-t)/1e6/1e3).toFixed(2)}s`;function b({start:t,tasks:e,failedTasks:n}){let l=e-n,r=m(t),s=n>0?i("red",`${n} failed`):"",a=l>0?i("green",`${l} successful`):"";console.log(""),console.log(i(["white","bold"],"Tasks: "),`${s}${s&&a?"/":""}${a}`,i("gray",`-- ${e} total`)),console.log(i(["white","bold"],"Time: "),i("gray",`${r}
|
|
3
|
+
`))}function g({index:t,script:e,continueOnError:n,reportTime:l}){let r=d[t%d.length],s=Bun.nanoseconds(),a=Bun.spawn(["bun","run",e],{stdout:"pipe",stderr:"pipe",env:{...Bun.env,FORCE_COLOR:"1"},onExit(o,c){c===1&&!n&&process.exit(1)}});return a.stdout.pipeTo(new WritableStream({write(o){let c=new TextDecoder().decode(o).split(`
|
|
4
|
+
`);for(let u of c)console.log(i([r,"bold"],`${e}:`),u)}})),a.stderr.pipeTo(new WritableStream({write(o){let c=new TextDecoder().decode(o).split(`
|
|
5
|
+
`);for(let u of c)console.log(i([r,"bold"],`${e}:`),u)}})),a.exited.then(o=>{o===0&&l&&console.log(i([r,"bold"],`${e}:`),i(["gray"],"Finished in"),i(["white","bold"],m(s)))}),a}async function f(t,e){let{continueOnError:n,reportTime:l}=e,r=Bun.nanoseconds(),s=t.map((o,c)=>g({index:c,script:o,continueOnError:n,reportTime:l})),a=await Promise.allSettled(s.map(o=>o.exited));b({start:r,tasks:t.length,failedTasks:a.filter(o=>o.status==="rejected"||o.value!==0).length})}async function x(t,e){let{continueOnError:n,reportTime:l}=e,r=Bun.nanoseconds(),s=0;for(let[a,o]of t.entries())await g({index:a,script:o,continueOnError:n,reportTime:l}).exited!==0&&s++;b({start:r,tasks:t.length,failedTasks:s})}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.").action(async(t,e)=>{try{console.log(h("magenta",`
|
|
6
6
|
\u{1F680} bun-run-all
|
|
7
|
-
`));let n=e.sequential??!1,
|
|
7
|
+
`));let n=e.sequential??!1,l=e.parallel??!n,r=e.continueOnError??!1,s=e.time??!1;l===n&&(console.error("You cannot use both --parallel and --sequential options at the same time."),process.exit(1)),n&&(await x(t,{continueOnError:r,reportTime:s}),process.exit(0)),await f(t,{continueOnError:r,reportTime:s}),process.exit(0)}catch(n){console.error(n),process.exit(1)}}).parseAsync(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"name": "@yunarch/config-web",
|
|
5
5
|
"description": "Shared configurations for web projects.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"bun-run-all": "bun ./src/cli/bun-run-all/index.ts",
|
|
51
51
|
"gen": "bun bun-run-all gen:eslint-typegen gen:oxlint-compatgen",
|
|
52
52
|
"gen:eslint-typegen": "bun run ./scripts/eslint-typegen.ts",
|
|
53
|
-
"gen:oxlint-compatgen": "bun run ./scripts/oxlint-compatgen.ts",
|
|
53
|
+
"gen:oxlint-compatgen": "bun run ./scripts/oxlint-compatgen.ts && biome format --write ./src/linters/oxlint.config.jsonc",
|
|
54
54
|
"lint": "bun bun-run-all lint:code lint:ts -t",
|
|
55
55
|
"lint:code": "oxlint && eslint .",
|
|
56
56
|
"lint:ts": "tsc --noEmit",
|