UNPKG

@ycmd/creds

Version:

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

52 lines (49 loc) 1.54 kB
'use strict'; var chunkT4HZI5FC_js = require('./chunk-T4HZI5FC.js'); var chunkOUWLP2VE_js = require('./chunk-OUWLP2VE.js'); var chunkPOLJ2ZZ2_js = require('./chunk-POLJ2ZZ2.js'); var promises = require('fs/promises'); var err = require('@lsk4/err'); var fishbird = require('fishbird'); async function upload(serviceDirname, options) { const buildDirDir = options.buildDir || `${serviceDirname}/build`; const config = chunkPOLJ2ZZ2_js.__require(`${serviceDirname}/config.js`); const serviceName = config.service?.serviceName; if (!serviceName) throw new err.Err("!serviceName"); let service; if (serviceName === "github") { service = new chunkT4HZI5FC_js.GithubService({ ...config.service, ...options }); } else if (serviceName === "gitlab") { service = new chunkOUWLP2VE_js.GitlabService({ ...config.service, ...options }); } else { throw new err.Err("incorrect serviceName", { serviceName }); } const { files: rawFiles = [], variables, secrets, hooks } = config; const files = await fishbird.map(rawFiles, async (fileOptions) => { const { filename } = fileOptions; const content = await promises.readFile(`${buildDirDir}/${filename}`).then((f) => f.toString()); return { ...fileOptions, content }; }); await service.uploadAll({ files, variables, secrets, hooks }); } chunkPOLJ2ZZ2_js.__name(upload, "upload"); exports.upload = upload; //# sourceMappingURL=out.js.map //# sourceMappingURL=chunk-QJX6S3FA.js.map