electron/spec/fixtures/test.asar/repack.js
Milan Burda d78f37ec8f
refactor: use node scheme imports in spec (#38487)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-06-15 10:42:27 -04:00

22 lines
657 B
JavaScript

// Use this script to regenerate these fixture files
// using a new version of the asar package
const asar = require('@electron/asar');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const archives = [];
for (const child of fs.readdirSync(__dirname)) {
if (child.endsWith('.asar')) {
archives.push(path.resolve(__dirname, child));
}
}
for (const archive of archives) {
const tmp = fs.mkdtempSync(path.resolve(os.tmpdir(), 'asar-spec-'));
asar.extractAll(archive, tmp);
asar.createPackageWithOptions(tmp, archive, {
unpack: fs.existsSync(archive + '.unpacked') ? '*' : undefined
});
}