@ycmd/creds
Version:
LSK.js CLI Creds is the easiest way to manage GitHub / Gitlab secrets and credentials
17 lines (15 loc) • 1.61 kB
JavaScript
import { a as a$1 } from './chunk-6FJTHGBR.js';
import { a as a$3 } from './chunk-3EJAMWK5.js';
import { a as a$2 } from './chunk-3I5644NY.js';
import { a, b } from './chunk-CSGQ5YH5.js';
import { Err } from '@lsk4/err';
import { getComment, jsonToFile } from '@lskjs/stringify';
import { mapSeries } from 'fishbird';
import { unlink, mkdir } from 'fs/promises';
function U(o){let t=`${o}/config.js`;try{return b(t)}catch(i){throw Err.getCode(i)==="MODULE_NOT_FOUND"?(a$1.error(`${t} not found`),new Err(`${t} not found`)):i}}a(U,"loadConfig");async function O(o,t={}){let i=t.log||a$1,a=t.buildDir||`${o}/build`,r=await U(o);await unlink(`${a}`).catch(()=>{}),await mkdir(a,{recursive:!0});let c=r.service?.serviceName;if(!c)throw new Err("!serviceName");let e;if(c==="github")e=new a$2({...r.service,...t});else if(c==="gitlab")e=new a$3({...r.service,...t});else throw new Err("incorrect serviceName",{serviceName:c});let{files:w=[]}=r;await mapSeries(w,async g=>{let{type:h,filename:m,handler:v}=g,P=await v(g,r),j=getComment({filename:m,values:[["Server",e.getServiceLink()],["Project",e.getProjectPath()],["Project ID",e.getProjectId()],["Project Url",e.getProjectUrl()],["CI/CD Setting",e.getProjectCICDSettingURL()]],footer:e.getProjectCredsUrl()&&`
Auto generated by ${e.getProjectCredsUrl()}
If you want to change something, please contact admin repo.
`.trim()});await jsonToFile(`${a}/${m}`,P,{type:h,compare:!t.force,comment:j}),i.info(`[build] ${e.getProjectPath()} (${m})`);});}a(O,"build");
export { O as a };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-IZQ5FHHO.js.map