|
@@ -103,6 +103,27 @@ new Promise((resolve, reject) => {
|
|
|
|
|
|
return release;
|
|
|
})
|
|
|
+ .then(async (release) => {
|
|
|
+ const checksumsAsset = release.assets.find((asset) => asset.name === 'SHASUMS256.txt');
|
|
|
+ if (!checksumsAsset) {
|
|
|
+ throw new Error(`cannot find SHASUMS256.txt from v${rootPackageJson.version} release assets`);
|
|
|
+ }
|
|
|
+
|
|
|
+ const checksumsContent = await getAssetContents(
|
|
|
+ rootPackageJson.version.indexOf('nightly') > 0 ? 'nightlies' : 'electron',
|
|
|
+ checksumsAsset.id
|
|
|
+ );
|
|
|
+
|
|
|
+ const checksumsObject = {};
|
|
|
+ for (const line of checksumsContent.trim().split('\n')) {
|
|
|
+ const [checksum, file] = line.split(' *');
|
|
|
+ checksumsObject[file] = checksum;
|
|
|
+ }
|
|
|
+
|
|
|
+ fs.writeFileSync(path.join(tempDir, 'checksums.json'), JSON.stringify(checksumsObject, null, 2));
|
|
|
+
|
|
|
+ return release;
|
|
|
+ })
|
|
|
.then(async (release) => {
|
|
|
const currentBranch = await getCurrentBranch();
|
|
|
|
|
@@ -145,10 +166,26 @@ new Promise((resolve, reject) => {
|
|
|
// test that the package can install electron prebuilt from github release
|
|
|
const tarballPath = path.join(tempDir, `${rootPackageJson.name}-${rootPackageJson.version}.tgz`);
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- childProcess.execSync(`npm install ${tarballPath} --force --silent`, {
|
|
|
+ const result = childProcess.spawnSync('npm', ['install', tarballPath, '--force', '--silent'], {
|
|
|
env: Object.assign({}, process.env, { electron_config_cache: tempDir }),
|
|
|
- cwd: tempDir
|
|
|
+ cwd: tempDir,
|
|
|
+ stdio: 'inherit'
|
|
|
});
|
|
|
+ if (result.status !== 0) {
|
|
|
+ return reject(new Error(`npm install failed with status ${result.status}`));
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const electronPath = require(path.resolve(tempDir, 'node_modules', rootPackageJson.name));
|
|
|
+ if (typeof electronPath !== 'string') {
|
|
|
+ return reject(new Error(`path to electron binary (${electronPath}) returned by the ${rootPackageJson.name} module is not a string`));
|
|
|
+ }
|
|
|
+ if (!fs.existsSync(electronPath)) {
|
|
|
+ return reject(new Error(`path to electron binary (${electronPath}) returned by the ${rootPackageJson.name} module does not exist on disk`));
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error(e);
|
|
|
+ return reject(new Error(`loading the generated ${rootPackageJson.name} module failed with an error`));
|
|
|
+ }
|
|
|
resolve(tarballPath);
|
|
|
});
|
|
|
})
|
|
@@ -181,6 +218,6 @@ new Promise((resolve, reject) => {
|
|
|
}
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
- console.error(`Error: ${err}`);
|
|
|
+ console.error('Error:', err);
|
|
|
process.exit(1);
|
|
|
});
|