install: rollback resolution field

pull/449/head
undefined 2 years ago
parent fcc4eedd9f
commit 63f3202241

@ -120,11 +120,12 @@ uid: 1536
gid: 1536 gid: 1536
`; `;
let data;
function removeOptionalEsbuildDeps() { function removeOptionalEsbuildDeps() {
const yarnGlobalPath = exec('yarn global dir').output?.trim() || ''; const yarnGlobalPath = exec('yarn global dir').output?.trim() || '';
if (!yarnGlobalPath) return false; if (!yarnGlobalPath) return false;
const pkgjson = `${yarnGlobalPath}/package.json`; const pkgjson = `${yarnGlobalPath}/package.json`;
const data = existsSync(pkgjson) ? require(pkgjson) : {}; data = existsSync(pkgjson) ? require(pkgjson) : {};
data.resolutions = data.resolutions || {}; data.resolutions = data.resolutions || {};
Object.assign(data.resolutions, Object.fromEntries([ Object.assign(data.resolutions, Object.fromEntries([
'@esbuild/linux-loong64', '@esbuild/linux-loong64',
@ -142,6 +143,15 @@ function removeOptionalEsbuildDeps() {
return true; 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 = [ const steps = [
{ {
init: 'install.preparing', init: 'install.preparing',
@ -259,6 +269,7 @@ const steps = [
}, },
() => log.info('extra.dbUser'), () => log.info('extra.dbUser'),
() => log.info('extra.dbPassword', password), () => log.info('extra.dbPassword', password),
() => rollbackResolveField(),
], ],
}, },
]; ];

Loading…
Cancel
Save