UNPKG

@ycmd/commands

Version:

LSK.js CLI Creds is the easiest way to manage GitHub / Gitlab secrets and credentials

12 lines (10 loc) 2.52 kB
import { fileURLToPath } from 'url'; import D from 'path'; import { join } from 'node:path'; import { Err } from '@lsk4/err'; import { map } from 'fishbird'; import { isCI, isDev, createCommand, shellParallel, readJson, isFileExist, shell } from 'ycmd'; var z=Object.defineProperty;var a=(i,e)=>z(i,"name",{value:e,configurable:!0});var x=a(()=>fileURLToPath(import.meta.url),"getFilename"),E=a(()=>D.dirname(x()),"getDirname"),o=E();var p={watch:{alias:"w",describe:"monitor files for changes",type:"boolean",default:!1},prod:{alias:"p",describe:"enable code optimization for production",type:"boolean",default:!1},silent:{alias:["s","q","quiet"],describe:"run in silent mode, show errors only",type:"boolean",default:!1},exec:{alias:"e",describe:"executes after compilation",type:["boolean","string"],default:!1},dry:{alias:["d","dry-run","without-publish"],describe:"run in dry mode, without publishing",type:"boolean",default:!1},dist:{describe:"specify the output directory",type:"string"},force:{alias:["f"],describe:"force to run",type:"boolean",default:!1},dts:{describe:"generate dts files",type:"boolean",default:!0},yes:{alias:["y"],describe:"automatically say yes to all prompts",type:"boolean",default:!1},bail:{alias:"b",describe:"stop running after the first failure",type:"boolean",default:!1},clean:{alias:"c",describe:"clean the output directory before building",type:"boolean",default:!1}};var b={isSilent:!!+process.env.YCMD_SILENT||isCI,isBail:isCI,isProd:!!+process.env.YCMD_PROD||!isDev,isCjs:!0,libDir:"lib",cjsDir:"cjs"};var J=createCommand({command:"test:size-limit [-s]",describe:"check size of your JS files",builder:i=>i.options({silent:p.silent}),async main({isRoot:i,ctx:e,argv:r,cwd:h,log:l}){if(i){await shellParallel("ycmd test:size-limit",{ctx:e,argv:r});return}let w=join(h,"package.json");if(!(await readJson(w))["size-limit"]){l.debug("[skip] size-limit rc not found - size-limit skiped");return}let g=Array.from({length:10}).map((m,s)=>"/..".repeat(s).substr(1)),c=(await map(g,async m=>{let s=join(o,m,"node_modules","size-limit","bin.js");return await isFileExist(s)?s:null})).filter(Boolean)[0];if(!c)throw new Err("size-limit not found in node_modules");let f=!!+process.env.YCMD_SILENT||r.silent||b.isSilent,t=c;f?await shell(`${t} --silent`,{ctx:e,silence:f?"all":!1}).catch(async()=>{l.error("Error while running",t),await shell(t,{ctx:e});}):await shell(t,{ctx:e});}}),X=J; export { X as default }; //# sourceMappingURL=out.js.map //# sourceMappingURL=test-size-limit.js.map