update: 优化部署

This commit is contained in:
2025-06-18 22:42:39 +08:00
parent c021beb576
commit b239dae9e3
5 changed files with 32 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ const syncUpload = new Command('upload')
.option('-d --dir <dir>', '配置目录')
.option('-c --config <config>', '配置文件的名字', 'kevisual.json')
.option('-f --file <file>', '操作的对应的文件名')
.description('上传项目')
.description('上传项目, 上传需要和registry的地址同步。')
.action(async (opts) => {
console.log('上传项目');
const sync = new SyncBase({ dir: opts.dir, baseURL: baseURL, configFilename: opts.config });
@@ -32,6 +32,8 @@ const syncUpload = new Command('upload')
...sync.config.metadata,
};
const filepath = sync.getRelativePath(opts.file);
const newInfos = [];
for (const item of syncList) {
if (!item.auth || !item.exist) {
nodonwArr.push(item);
@@ -54,15 +56,22 @@ const syncUpload = new Command('upload')
});
if (res.code === 200) {
if (res.data?.isNew) {
logger.info('上传成功', item.key, chalk.green(item.url), chalk.green('文件上传'));
newInfos.push(['上传成功', item.key, chalk.green(item.url), chalk.green('文件上传')]);
} else if (res.data?.isNewMeta) {
logger.info('上传成功', item.key, chalk.green(item.url), chalk.green('元数据更新'));
newInfos.push(['上传成功', item.key, chalk.green(item.url), chalk.green('元数据更新')]);
} else {
// 文件未更新
logger.info('上传成功', item.key, chalk.green(item.url), chalk.blue('文件未更新'));
}
}
logger.debug(res);
}
if (newInfos.length) {
logger.info('上传成功的文件\n');
newInfos.forEach((item) => {
logger.info(...item);
});
}
if (nodonwArr.length && !filepath) {
logger.warn('以下文件未上传\n', nodonwArr.map((item) => item.key).join(','));
}