@lcap/cli
Version:
utils for lcap
54 lines • 1.88 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerCommand = void 0;
const utils_1 = require("../utils");
const publish_1 = require("./api/publish");
function registerCommand(yargs) {
yargs.command('publish', '发布前端资源', (yargs) => {
yargs
.options(utils_1.tokenOptions)
.option('platform', {
type: 'array',
string: true,
describe: '发布平台',
choices: ['dev', 'test', 'ci'],
default: 'dev',
})
.option('type', {
type: 'string',
describe: '发布资源类型',
choices: ['ide', 'vue3', 'sandbox'],
default: 'ide',
})
.option('mode', {
type: 'string',
describe: '发布模式,独立发布模式时将会按照分支名称独立发布',
choices: ['normal', 'independent'],
default: 'normal',
})
.option('publisher', {
alias: 'p',
type: 'string',
describe: '发布人账号,它将会附加到资源的 Headers 中',
})
.option('branch', {
type: 'string',
describe: '当前发布分支名称,它将会附加到资源的 Headers 中',
})
.option('publishAt', {
alias: 't',
type: 'string',
describe: '发布时间,它将会附加到资源的 Headers 中',
})
.check((argv) => {
return (0, utils_1.tokenCheck)(argv);
});
}, (argv) => {
return (0, publish_1.publish)(process.cwd(), argv).catch((err) => {
utils_1.logger.error(err.message);
process.exit(1);
});
});
}
exports.registerCommand = registerCommand;
//# sourceMappingURL=command.js.map