add public fix and pnpm init asst

This commit is contained in:
2025-05-19 22:13:02 +08:00
parent a05f2cd291
commit 5cc1e33b29
9 changed files with 175 additions and 9 deletions

View File

@@ -43,3 +43,11 @@ const deleteCommand = new Command('delete')
logger.debug(info);
});
appManagerCommand.addCommand(deleteCommand);
const uploadCommand = new Command('upload')
.description('上传应用')
.option('-i, --id <id>', '应用名称 root/app-name 的格式,如果是后端,会自动解析为 app-name')
.option('-t, --type <type>', '应用类型', 'web')
.action(async (options) => {
//
});

View File

@@ -63,3 +63,27 @@ const removeCommand = new Command('remove')
}
});
program.addCommand(removeCommand);
const npmCommand = new Command('pnpm')
.description('助手pnpm命令')
.option('-p --path <path>', '助手路径,默认为执行命令的目录,如果助手路径不存在则创建。')
.action((opts) => {
if (opts.path && !opts.path.startsWith('/')) {
opts.path = path.join(process.cwd(), opts.path);
} else if (opts.path) {
opts.path = path.resolve(opts.path);
}
const configDir = AssistantInit.detectConfigDir(opts.path);
console.log('configDir', configDir);
const assistantInit = new AssistantInit({
path: configDir,
});
const initRes = assistantInit.initPnpm();
if (initRes?.create) {
console.log(chalk.blue('助手pnpm命令初始化成功,创建了新文件'));
} else {
console.log(chalk.green('助手pnpm命令初始化成功'));
}
});
Init.addCommand(npmCommand);