Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions src/engines/boa.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@

const binaryName = platform.startsWith('win') ? 'boa.exe' : 'boa';

function getFilename() {
function isNightly(version) {
return version.startsWith('nightly');
}

function getReleaseTag(version) {
return isNightly(version) ? 'nightly' : version;
}

function getFilename(version) {
switch (platform) {
case 'darwin-x64':
return 'boa-macos-amd64';
return isNightly(version) ? 'boa-x86_64-apple-darwin' : 'boa-macos-amd64';
case 'linux-x64':
return 'boa-linux-amd64';
return isNightly(version) ? 'boa-x86_64-unknown-linux-gnu' : 'boa-linux-amd64';
case 'win32-x64':
return 'boa-windows-amd64.exe';
return isNightly(version) ? 'boa-x86_64-pc-windows-msvc.exe' : 'boa-windows-amd64.exe';
case 'darwin-arm64':
if (isNightly(version)) return 'boa-aarch64-apple-darwin';

Check failure on line 30 in src/engines/boa.js

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20)

Expected { after 'if' condition

Check failure on line 30 in src/engines/boa.js

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 21)

Expected { after 'if' condition
// fall through
default:
throw new Error(`No Boa builds available for ${platform}`);
}
Expand All @@ -31,15 +42,18 @@

static resolveVersion(version) {
if (version === 'latest') {
return fetch('https://api.github.com/repos/boa-dev/boa/releases/latest')
// Boa has nightly releases under the 'nightly' tag on GitHub, which are
// updated instead of making a new release for each one. Tag the version
// with the time the tag was last updated.
return fetch('https://api.github.com/repos/boa-dev/boa/releases/tags/nightly')
.then((r) => r.json())
.then((r) => r.tag_name);
.then((r) => `nightly-${r.updated_at}`);
}
return version;
}

getDownloadURL(version) {
return `https://github.com/boa-dev/boa/releases/download/${version}/${getFilename()}`;
return `https://github.com/boa-dev/boa/releases/download/${getReleaseTag(version)}/${getFilename(version)}`;
}

async extract() {
Expand Down Expand Up @@ -75,6 +89,7 @@
'linux-x64',
'win32-x64',
'darwin-x64',
'darwin-arm64'

Check failure on line 92 in src/engines/boa.js

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20)

Missing trailing comma

Check failure on line 92 in src/engines/boa.js

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 21)

Missing trailing comma
],
};

Expand Down
Loading