UNPKG

@ycmd/creds

Version:

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

75 lines (73 loc) 2.05 kB
import { log } from './chunk-CHOKACPI.js'; import { createService } from './chunk-J73W5VC6.js'; import { __name } from './chunk-U2DZE3DI.js'; import { getComment, jsonToFile } from '@lsk4/stringify'; import { mapSeries } from 'fishbird'; import { unlink, mkdir } from 'fs/promises'; async function build(serviceDirname, options = {}) { const log2 = options.log || log; const buildDir = options.buildDir || `${serviceDirname}/build`; const service = await createService(serviceDirname, options); await unlink(`${buildDir}`).catch(() => { }); await mkdir(buildDir, { recursive: true }); const { config } = service; const { files = [] } = config; await mapSeries(files, async (fileOptions) => { const { type, filename, handler } = fileOptions; const res = await handler(fileOptions, config); const comment = getComment({ filename, values: [ [ "File type", fileOptions.type ], [ "Cred type", fileOptions.credType ], [ "Cred name", fileOptions.name ], [ "Server", service.getServiceHostname() ], [ "Project", service.getProjectPath() ], [ "Project ID", service.getProjectId() ], [ "Project Url", service.getProjectUrl() ], [ "CI/CD Setting", service.getProjectCICDSettingURL() ] ], footer: service.getProjectCredsUrl() && ` Auto generated by ${service.getProjectCredsUrl()} If you want to change something, please contact admin repo: ${service.getProjectCredsOwner()}. `.trim() }); await jsonToFile(`${buildDir}/${filename}`, res, { type, compare: !options.force, comment }); log2.info(`[build] ${service.getProjectPath()} (${filename})`); }); } __name(build, "build"); export { build }; //# sourceMappingURL=out.js.map //# sourceMappingURL=chunk-BKCUPKZB.js.map