feat: 更新去除之前的打包后端的模式

This commit is contained in:
2025-03-20 18:22:24 +08:00
parent f3f6d93b64
commit 3d45a83129
6 changed files with 412 additions and 304 deletions

View File

@@ -18,9 +18,10 @@ const command = new Command('deploy')
.option('-y, --yes <yes>', 'yes')
.option('-o, --org <org>', 'org')
.option('-u, --update', 'load current app. set current version in product')
.option('-s, --showBackend', 'show backend url')
.action(async (filePath, options) => {
try {
let { version, key, yes, update, org } = options;
let { version, key, yes, update, org, showBackend } = options;
if (!version || !key) {
const answers = await inquirer.prompt([
{
@@ -80,18 +81,24 @@ const command = new Command('deploy')
if (id && !update) {
console.log(chalk.green('id: '), id);
if (!org) {
console.log(chalk.green(`run to load: envision deploy-load ${id}`));
console.log(chalk.green(`更新为最新版本: envision deploy-load ${id}`));
} else {
console.log(chalk.green(`run to load: envision deploy-load ${id} -o ${org}`));
console.log(chalk.green(`更新为最新版本: envision deploy-load ${id} -o ${org}`));
}
} else if (id && update) {
deployLoadFn(id);
} else {
console.log('rest', JSON.stringify(rest, null, 2));
console.log('rest error', JSON.stringify(rest, null, 2));
}
if (id && showBackend) {
console.log('\n');
console.log(chalk.blue('服务端应用部署: '), 'envision pack-deploy', id, '-k <key>');
console.log('\n');
}
} else {
console.error('File upload failed', res?.message);
}
return res;
} catch (error) {
console.error('error', error);
}
@@ -171,13 +178,13 @@ const deployLoadFn = async (id: string, org?: string) => {
},
});
if (res.code === 200) {
console.log('deploy-load success. current version:', res.data?.version);
console.log(chalk.green('deploy-load success. current version:', res.data?.version));
// /:username/:appName
try {
const { user, key } = res.data;
const baseURL = getBaseURL();
const deployURL = new URL(`/${user}/${key}`, baseURL);
console.log('deployURL', deployURL.href);
const deployURL = new URL(`/${user}/${key}/`, baseURL);
console.log(chalk.blue('deployURL', deployURL.href));
} catch (error) {}
} else {
console.error('deploy-load failed', res.message);