fix: 更新部署

This commit is contained in:
2024-11-24 02:07:13 +08:00
parent 01680b39c2
commit 4bbc531ac7
3 changed files with 55 additions and 6 deletions

View File

@@ -57,8 +57,25 @@ export const installApp = async (opts: InstallAppOpts) => {
if (!name || !version || !app) {
throw new Error('Invalid package.json');
}
const readmeFile = path.join(extractPath, 'README.md');
let readmeDesc = '';
if (fileIsExist(readmeFile)) {
readmeDesc = fs.readFileSync(readmeFile, 'utf-8');
}
let showAppInfo = {
key,
status: 'inactive',
type: app?.type || 'system-app',
description: readmeDesc || '',
version,
//
entry: app?.entry || '',
path: extractPath,
origin: app,
};
app.key = key;
fs.writeFileSync(pkgs, JSON.stringify(pkg, null, 2));
// fs.unlinkSync(filePath);
return { path: filePath, pkg };
return { path: filePath, pkg, showAppInfo };
};