From 9f5b3a61c089ca3a30f4275fc57d9379b3cf709f Mon Sep 17 00:00:00 2001 From: xion Date: Thu, 6 Mar 2025 19:42:53 +0800 Subject: [PATCH] feat: update publish for install pkgs --- package.json | 2 +- src/app.ts | 3 +++ src/command/publish.ts | 10 ++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 64e6705..2645a86 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/envision-cli", - "version": "0.0.27", + "version": "0.0.28", "description": "envision command tools", "main": "dist/index.js", "type": "module", diff --git a/src/app.ts b/src/app.ts index 97a0343..b007170 100644 --- a/src/app.ts +++ b/src/app.ts @@ -6,6 +6,9 @@ export { sequelize }; export const app = new App({ serverOptions: { + cors: { + origin: '*', // 允许所有来源 + }, httpType: 'https', }, }); diff --git a/src/command/publish.ts b/src/command/publish.ts index e269bea..ad16262 100644 --- a/src/command/publish.ts +++ b/src/command/publish.ts @@ -291,7 +291,7 @@ const uploadFiles = async (filePath: string, collection: any): Promise => { ); }); }; -const deployLoadFn = async (id: string, fileKey: string, force = false) => { +const deployLoadFn = async (id: string, fileKey: string, force = false, install = false) => { if (!id) { console.error(chalk.red('id is required')); return; @@ -318,11 +318,12 @@ const deployLoadFn = async (id: string, fileKey: string, force = false) => { id: id, key: fileKey, force: force, + install: !!install, }, }); if (res.code === 200) { 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 { console.error('deploy-load failed', res.message); } @@ -358,8 +359,9 @@ const packDeployCommand = new Command('pack-deploy') .argument('', 'id') .option('-k, --key ', 'fileKey, 服务器的部署文件夹的列表') .option('-f --force', 'force') + .option('-i, --install ', 'install dependencies') .action(async (id, opts) => { - let { force, key } = opts || {}; + let { force, key, install } = opts || {}; if (!key) { const answers = await inquirer.prompt([ { @@ -371,7 +373,7 @@ const packDeployCommand = new Command('pack-deploy') ]); key = answers.key || key; } - const res = await deployLoadFn(id, key, force); + const res = await deployLoadFn(id, key, force, install); }); program.addCommand(packDeployCommand);