This commit is contained in:
@@ -87,7 +87,9 @@ async function sha256ForPath(filePath) {
|
||||
async function computeRemoteSha256(url) {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Unable to download artifact (${response.status} ${response.statusText}).`);
|
||||
throw new Error(
|
||||
`Unable to download artifact (${response.status} ${response.statusText}).`
|
||||
);
|
||||
}
|
||||
|
||||
if (!response.body) {
|
||||
@@ -132,7 +134,9 @@ function command(cwd) {
|
||||
child.on('exit', (code) =>
|
||||
code === 0
|
||||
? resolve(undefined)
|
||||
: reject(new Error(`${name} ${args.join(' ')} failed with code ${code}`))
|
||||
: reject(
|
||||
new Error(`${name} ${args.join(' ')} failed with code ${code}`)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -150,7 +154,9 @@ async function run() {
|
||||
${usage()}`);
|
||||
}
|
||||
if (!SEMVER.test(options.releaseVersion)) {
|
||||
throw new Error(`--release-version must be semver: ${options.releaseVersion}`);
|
||||
throw new Error(
|
||||
`--release-version must be semver: ${options.releaseVersion}`
|
||||
);
|
||||
}
|
||||
if (!SEMVER.test(options.appVersion)) {
|
||||
throw new Error(`--app-version must be semver: ${options.appVersion}`);
|
||||
@@ -160,7 +166,8 @@ ${usage()}`);
|
||||
const lockDir = path.dirname(lockPath);
|
||||
const lockJson = JSON.parse(await readFile(lockPath, 'utf8'));
|
||||
const lock = parseReleaseLock(lockJson);
|
||||
const nextReleaseVersion = options.releaseVersion ?? bumpPatch(lock.releaseVersion);
|
||||
const nextReleaseVersion =
|
||||
options.releaseVersion ?? bumpPatch(lock.releaseVersion);
|
||||
if (!SEMVER.test(nextReleaseVersion)) {
|
||||
throw new Error(`Invalid release version: ${nextReleaseVersion}`);
|
||||
}
|
||||
@@ -199,13 +206,17 @@ ${usage()}`);
|
||||
};
|
||||
if (options.portalVersion) {
|
||||
if (!SEMVER.test(options.portalVersion))
|
||||
throw new Error(`--portal-version must be semver: ${options.portalVersion}`);
|
||||
throw new Error(
|
||||
`--portal-version must be semver: ${options.portalVersion}`
|
||||
);
|
||||
nextLock.portalVersion = options.portalVersion;
|
||||
}
|
||||
|
||||
parseReleaseLock(nextLock);
|
||||
await writeFile(lockPath, `${JSON.stringify(nextLock, null, 2)}\n`, 'utf8');
|
||||
console.log(`Updated ${path.relative(process.cwd(), lockPath)} (${options.appId})`);
|
||||
console.log(
|
||||
`Updated ${path.relative(process.cwd(), lockPath)} (${options.appId})`
|
||||
);
|
||||
|
||||
if (!options.assemble) return;
|
||||
const runCommand = command(process.cwd());
|
||||
@@ -229,7 +240,11 @@ ${usage()}`);
|
||||
console.log(`Assembled release -> ${archive}`);
|
||||
const releaseChecksum = `${archive}.sha256`;
|
||||
const releaseSha256 = await sha256ForPath(archive);
|
||||
await writeFile(releaseChecksum, `${releaseSha256} ${path.basename(archive)}\n`, 'utf8');
|
||||
await writeFile(
|
||||
releaseChecksum,
|
||||
`${releaseSha256} ${path.basename(archive)}\n`,
|
||||
'utf8'
|
||||
);
|
||||
console.log(`Assembled release checksum: ${releaseSha256}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user