install: rollback resolution field

This commit is contained in:
undefined committed 2022-10-20 01:35:14 +08:00
1 parent fcc4eedd9f
commit 63f3202241
1 file changed
+12 -1
+12 -1
View File
@@ -120,11 +120,12 @@ uid: 1536
gid: 1536
`;
let data;
function removeOptionalEsbuildDeps() {
const yarnGlobalPath = exec('yarn global dir').output?.trim() || '';
if (!yarnGlobalPath) return false;
const pkgjson = `${yarnGlobalPath}/package.json`;
const data = existsSync(pkgjson) ? require(pkgjson) : {};
data = existsSync(pkgjson) ? require(pkgjson) : {};
data.resolutions = data.resolutions || {};
Object.assign(data.resolutions, Object.fromEntries([
'@esbuild/linux-loong64',
@@ -142,6 +143,15 @@ function removeOptionalEsbuildDeps() {
return true;
}
function rollbackResolveField() {
const yarnGlobalPath = exec('yarn global dir').output?.trim() || '';
if (!yarnGlobalPath) return false;
const pkgjson = `${yarnGlobalPath}/package.json`;
delete data.resolutions;
writeFileSync(pkgjson, JSON.stringify(data, null, 2));
return true;
}
const steps = [
{
init: 'install.preparing',
@@ -259,6 +269,7 @@ const steps = [
},
() => log.info('extra.dbUser'),
() => log.info('extra.dbPassword', password),
() => rollbackResolveField(),
],
},
];