fix bugs and change version

This commit is contained in:
2024-10-10 02:10:16 +08:00
parent 2d2cabde75
commit edb0d56094
5 changed files with 84 additions and 15 deletions

View File

@@ -12,9 +12,10 @@ const command = new Command('deploy')
.argument('<filePath>', 'Path to the file to be uploaded') // 定义文件路径参数
.option('-v, --version <version>', 'verbose')
.option('-k, --key <key>', 'key')
.option('-y, --yes <yes>', 'yes')
.action(async (filePath, options) => {
try {
let { version, key } = options;
let { version, key, yes } = options;
if (!version || !key) {
const answers = await inquirer.prompt([
{
@@ -36,20 +37,22 @@ const command = new Command('deploy')
const pwd = process.cwd();
const directory = path.join(pwd, filePath);
const gPath = path.join(directory, '**/*');
const files = await glob(gPath, { cwd: pwd, ignore: ['node_modules/**/*'] });
const files = await glob(gPath, { cwd: pwd, ignore: ['node_modules/**/*'], nodir: true });
const _relativeFiles = files.map((file) => file.replace(directory + '/', ''));
console.log('upload Files', _relativeFiles);
console.log('upload Files Key', key, version);
// 确认是否上传
const confirm = await inquirer.prompt([
{
type: 'confirm',
name: 'confirm',
message: 'Do you want to upload these files?',
},
]);
if (!confirm.confirm) {
return;
if (!yes) {
// 确认是否上传
const confirm = await inquirer.prompt([
{
type: 'confirm',
name: 'confirm',
message: 'Do you want to upload these files?',
},
]);
if (!confirm.confirm) {
return;
}
}
const res = await uploadFiles(_relativeFiles, directory, { key, version });