feat: update publish for install pkgs

This commit is contained in:
熊潇 2025-03-06 19:42:53 +08:00
parent e525833fc8
commit 9f5b3a61c0
3 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@kevisual/envision-cli", "name": "@kevisual/envision-cli",
"version": "0.0.27", "version": "0.0.28",
"description": "envision command tools", "description": "envision command tools",
"main": "dist/index.js", "main": "dist/index.js",
"type": "module", "type": "module",

View File

@ -6,6 +6,9 @@ export { sequelize };
export const app = new App({ export const app = new App({
serverOptions: { serverOptions: {
cors: {
origin: '*', // 允许所有来源
},
httpType: 'https', httpType: 'https',
}, },
}); });

View File

@ -291,7 +291,7 @@ const uploadFiles = async (filePath: string, collection: any): Promise<any> => {
); );
}); });
}; };
const deployLoadFn = async (id: string, fileKey: string, force = false) => { const deployLoadFn = async (id: string, fileKey: string, force = false, install = false) => {
if (!id) { if (!id) {
console.error(chalk.red('id is required')); console.error(chalk.red('id is required'));
return; return;
@ -318,11 +318,12 @@ const deployLoadFn = async (id: string, fileKey: string, force = false) => {
id: id, id: id,
key: fileKey, key: fileKey,
force: force, force: force,
install: !!install,
}, },
}); });
if (res.code === 200) { if (res.code === 200) {
console.log('deploy-load success. current version:', res.data?.pkg?.version); console.log('deploy-load success. current version:', res.data?.pkg?.version);
console.log('run: ', 'envision services restart', res.data?.pkg?.name); console.log('run: ', 'envision services -r', res.data?.pkg?.name);
} else { } else {
console.error('deploy-load failed', res.message); console.error('deploy-load failed', res.message);
} }
@ -358,8 +359,9 @@ const packDeployCommand = new Command('pack-deploy')
.argument('<id>', 'id') .argument('<id>', 'id')
.option('-k, --key <key>', 'fileKey, 服务器的部署文件夹的列表') .option('-k, --key <key>', 'fileKey, 服务器的部署文件夹的列表')
.option('-f --force', 'force') .option('-f --force', 'force')
.option('-i, --install ', 'install dependencies')
.action(async (id, opts) => { .action(async (id, opts) => {
let { force, key } = opts || {}; let { force, key, install } = opts || {};
if (!key) { if (!key) {
const answers = await inquirer.prompt([ const answers = await inquirer.prompt([
{ {
@ -371,7 +373,7 @@ const packDeployCommand = new Command('pack-deploy')
]); ]);
key = answers.key || key; key = answers.key || key;
} }
const res = await deployLoadFn(id, key, force); const res = await deployLoadFn(id, key, force, install);
}); });
program.addCommand(packDeployCommand); program.addCommand(packDeployCommand);