build: write abi version to published npm package (#47598)

This commit is contained in:
Samuel Attard
2025-06-30 15:01:09 -07:00
committed by GitHub
parent 4f69c5835e
commit d347632046

View File

@@ -136,6 +136,20 @@ new Promise<string>((resolve, reject) => {
return release;
})
.then(async (release) => {
const gnArgs = await fs.promises.readFile(path.resolve(ELECTRON_DIR, 'build/args/all.gn'), 'utf8');
const abiVersionLine = gnArgs.split('\n').find((line) => line.startsWith('node_module_version = '));
const abiVersion = abiVersionLine ? abiVersionLine.split('=')[1].trim() : null;
if (!abiVersion) {
throw new Error('Could not find node_module_version in GN args');
}
const abiVersionFile = path.join(tempDir, 'abi_version');
await fs.promises.writeFile(abiVersionFile, abiVersion);
return release;
})
.then(async (release) => {
const currentBranch = await getCurrentBranch();