This commit is contained in:
2025-12-01 02:24:16 +08:00
parent 59fd7a6411
commit b1f54cf813
2 changed files with 4 additions and 21 deletions

View File

@@ -23,7 +23,7 @@ export const getPackageJson = (opts?: { version?: string; appKey?: string }) =>
const packageJson = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
const basename = packageJson.basename || '';
const version = packageJson.version || '';
const app = packageJson.app as { key: string };
const app = packageJson.app;
const userAppArry = basename.split('/');
if (userAppArry.length <= 2 && !opts?.appKey) {
console.error(chalk.red('basename is error, 请输入正确的路径, packages.json中basename例如 /root/appKey'));
@@ -154,13 +154,7 @@ const command = new Command('deploy')
logger.debug('deploy success', res2.data);
if (id && showBackend) {
console.log('\n');
// 获取当前应用的key
const pkKey = pkgInfo?.app?.key || pkgInfo?.appKey;
console.log(chalk.blue('服务端应用部署: '), 'envision pack-deploy', id, '-k <key>');
if (pkKey) {
console.log('\n');
console.log(chalk.blue('命令推荐: '), 'envision pack-deploy', id, `-k ${pkKey} -f`);
}
console.log(chalk.blue('服务端应用部署: '), 'envision pack-deploy', id);
console.log('\n');
}
} else {
@@ -186,7 +180,7 @@ const uploadFiles = async (files: string[], directory: string, opts: UploadFileO
for (const file of files) {
const filePath = path.join(directory, file);
const hash = getHash(filePath);
if(!hash){
if (!hash) {
console.error('文件', filePath, '不存在');
console.error('请检查文件是否存在');
}
@@ -274,7 +268,7 @@ const deployLoadFn = async (id: string, org?: string) => {
const baseURL = getBaseURL();
const deployURL = new URL(`/${user}/${key}/`, baseURL);
console.log(chalk.blue('deployURL', deployURL.href));
} catch (error) {}
} catch (error) { }
} else {
console.error('deploy-load failed', res.message);
}

View File

@@ -316,17 +316,6 @@ const packDeployCommand = new Command('pack-deploy')
.option('-i, --install ', 'install dependencies')
.action(async (id, opts) => {
let { force, key, install } = opts || {};
if (!key) {
const answers = await inquirer.prompt([
{
type: 'input',
name: 'key',
message: 'Enter your deploy to services fileKey:',
when: () => !key, // 当 username 为空时,提示用户输入
},
]);
key = answers.key || key;
}
const res = await deployLoadFn(id, key, force, install);
});