bun-scripty
Advanced tools
Comparing version 1.0.1 to 1.0.2
#!/usr/bin/env bun | ||
// @bun | ||
var{file:p}=globalThis.Bun;class n extends Error{constructor(e){super(`Environment variable '${e}' is not defined`);this.name="EnvVarNotDefinedError"}}var r=(...e)=>e.join("/").replace(/\/+/g,"/");var s=async()=>{const{npm_config_local_prefix:e,npm_package_json:t,npm_lifecycle_event:o}=process.env;if(!o)throw new n("npm_lifecycle_event");if(!t)throw new n("npm_package_json");if(!e)throw new n("npm_config_local_prefix");if(!await import(t))throw new Error("Failed to import package.json");const i=o.replaceAll(":","/"),a=r(e,"scripts");return{named:r(a,`${i}.ts`),indexed:r(a,i,"index.ts")}};try{const e=await s(),t=["bun","run"];if(await p(e.named).exists())t.push(e.named);else if(await p(e.indexed).exists())t.push(e.indexed);else throw new Error(`No script file found at ${e.named} or ${e.indexed}`);await Bun.spawn(t).exited}catch(e){console.error(e)}export{s as mapScriptPathSegmentToFilePaths}; | ||
var{file:p}=globalThis.Bun;class o extends Error{constructor(e){super(`Environment variable '${e}' is not defined`);this.name="EnvVarNotDefinedError"}}var r=(...e)=>e.join("/").replace(/\/+/g,"/");var c=async()=>{const{npm_config_local_prefix:e,npm_package_json:t,npm_lifecycle_event:n}=process.env;if(!n)throw new o("npm_lifecycle_event");if(!t)throw new o("npm_package_json");if(!e)throw new o("npm_config_local_prefix");if(!await import(t))throw new Error("Failed to import package.json");const s=n.replaceAll(":","/"),a=r(e,"scripts");return{named:r(a,`${s}.ts`),indexed:r(a,s,"index.ts")}};try{const e=await c(),t=["bun","run"];if(await p(e.named).exists())t.push(e.named);else if(await p(e.indexed).exists())t.push(e.indexed);else throw new Error(`No script file found at ${e.named} or ${e.indexed}`);const n=Bun.spawn(t),i=await new Response(n.stdout).text();console.log(i),await n.exited}catch(e){console.error(e)}export{c as mapScriptPathSegmentToFilePaths}; |
#!/usr/bin/env bun | ||
// @bun | ||
var{file:p}=globalThis.Bun;class n extends Error{constructor(e){super(`Environment variable '${e}' is not defined`);this.name="EnvVarNotDefinedError"}}var r=(...e)=>e.join("/").replace(/\/+/g,"/");var s=async()=>{const{npm_config_local_prefix:e,npm_package_json:t,npm_lifecycle_event:o}=process.env;if(!o)throw new n("npm_lifecycle_event");if(!t)throw new n("npm_package_json");if(!e)throw new n("npm_config_local_prefix");if(!await import(t))throw new Error("Failed to import package.json");const i=o.replaceAll(":","/"),a=r(e,"scripts");return{named:r(a,`${i}.ts`),indexed:r(a,i,"index.ts")}};try{const e=await s(),t=["bun","run"];if(await p(e.named).exists())t.push(e.named);else if(await p(e.indexed).exists())t.push(e.indexed);else throw new Error(`No script file found at ${e.named} or ${e.indexed}`);await Bun.spawn(t).exited}catch(e){console.error(e)}export{s as mapScriptPathSegmentToFilePaths}; | ||
var{file:p}=globalThis.Bun;class o extends Error{constructor(e){super(`Environment variable '${e}' is not defined`);this.name="EnvVarNotDefinedError"}}var r=(...e)=>e.join("/").replace(/\/+/g,"/");var c=async()=>{const{npm_config_local_prefix:e,npm_package_json:t,npm_lifecycle_event:n}=process.env;if(!n)throw new o("npm_lifecycle_event");if(!t)throw new o("npm_package_json");if(!e)throw new o("npm_config_local_prefix");if(!await import(t))throw new Error("Failed to import package.json");const s=n.replaceAll(":","/"),a=r(e,"scripts");return{named:r(a,`${s}.ts`),indexed:r(a,s,"index.ts")}};try{const e=await c(),t=["bun","run"];if(await p(e.named).exists())t.push(e.named);else if(await p(e.indexed).exists())t.push(e.indexed);else throw new Error(`No script file found at ${e.named} or ${e.indexed}`);const n=Bun.spawn(t),i=await new Response(n.stdout).text();console.log(i),await n.exited}catch(e){console.error(e)}export{c as mapScriptPathSegmentToFilePaths}; |
#!/usr/bin/env bun | ||
// @bun | ||
var{file:p}=globalThis.Bun;class n extends Error{constructor(e){super(`Environment variable '${e}' is not defined`);this.name="EnvVarNotDefinedError"}}var r=(...e)=>e.join("/").replace(/\/+/g,"/");var s=async()=>{const{npm_config_local_prefix:e,npm_package_json:t,npm_lifecycle_event:o}=process.env;if(!o)throw new n("npm_lifecycle_event");if(!t)throw new n("npm_package_json");if(!e)throw new n("npm_config_local_prefix");if(!await import(t))throw new Error("Failed to import package.json");const i=o.replaceAll(":","/"),a=r(e,"scripts");return{named:r(a,`${i}.ts`),indexed:r(a,i,"index.ts")}};try{const e=await s(),t=["bun","run"];if(await p(e.named).exists())t.push(e.named);else if(await p(e.indexed).exists())t.push(e.indexed);else throw new Error(`No script file found at ${e.named} or ${e.indexed}`);await Bun.spawn(t).exited}catch(e){console.error(e)}export{s as mapScriptPathSegmentToFilePaths}; | ||
var{file:p}=globalThis.Bun;class o extends Error{constructor(e){super(`Environment variable '${e}' is not defined`);this.name="EnvVarNotDefinedError"}}var r=(...e)=>e.join("/").replace(/\/+/g,"/");var c=async()=>{const{npm_config_local_prefix:e,npm_package_json:t,npm_lifecycle_event:n}=process.env;if(!n)throw new o("npm_lifecycle_event");if(!t)throw new o("npm_package_json");if(!e)throw new o("npm_config_local_prefix");if(!await import(t))throw new Error("Failed to import package.json");const s=n.replaceAll(":","/"),a=r(e,"scripts");return{named:r(a,`${s}.ts`),indexed:r(a,s,"index.ts")}};try{const e=await c(),t=["bun","run"];if(await p(e.named).exists())t.push(e.named);else if(await p(e.indexed).exists())t.push(e.indexed);else throw new Error(`No script file found at ${e.named} or ${e.indexed}`);const n=Bun.spawn(t),i=await new Response(n.stdout).text();console.log(i),await n.exited}catch(e){console.error(e)}export{c as mapScriptPathSegmentToFilePaths}; |
#!/usr/bin/env bun | ||
// @bun | ||
var{file:p}=globalThis.Bun;class n extends Error{constructor(e){super(`Environment variable '${e}' is not defined`);this.name="EnvVarNotDefinedError"}}var r=(...e)=>e.join("/").replace(/\/+/g,"/");var s=async()=>{const{npm_config_local_prefix:e,npm_package_json:t,npm_lifecycle_event:o}=process.env;if(!o)throw new n("npm_lifecycle_event");if(!t)throw new n("npm_package_json");if(!e)throw new n("npm_config_local_prefix");if(!await import(t))throw new Error("Failed to import package.json");const i=o.replaceAll(":","/"),a=r(e,"scripts");return{named:r(a,`${i}.ts`),indexed:r(a,i,"index.ts")}};try{const e=await s(),t=["bun","run"];if(await p(e.named).exists())t.push(e.named);else if(await p(e.indexed).exists())t.push(e.indexed);else throw new Error(`No script file found at ${e.named} or ${e.indexed}`);await Bun.spawn(t).exited}catch(e){console.error(e)}export{s as mapScriptPathSegmentToFilePaths}; | ||
var{file:p}=globalThis.Bun;class o extends Error{constructor(e){super(`Environment variable '${e}' is not defined`);this.name="EnvVarNotDefinedError"}}var r=(...e)=>e.join("/").replace(/\/+/g,"/");var c=async()=>{const{npm_config_local_prefix:e,npm_package_json:t,npm_lifecycle_event:n}=process.env;if(!n)throw new o("npm_lifecycle_event");if(!t)throw new o("npm_package_json");if(!e)throw new o("npm_config_local_prefix");if(!await import(t))throw new Error("Failed to import package.json");const s=n.replaceAll(":","/"),a=r(e,"scripts");return{named:r(a,`${s}.ts`),indexed:r(a,s,"index.ts")}};try{const e=await c(),t=["bun","run"];if(await p(e.named).exists())t.push(e.named);else if(await p(e.indexed).exists())t.push(e.indexed);else throw new Error(`No script file found at ${e.named} or ${e.indexed}`);const n=Bun.spawn(t),i=await new Response(n.stdout).text();console.log(i),await n.exited}catch(e){console.error(e)}export{c as mapScriptPathSegmentToFilePaths}; |
{ | ||
"name": "bun-scripty", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Scripty for Bun", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
9917