Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Apple Silicon and other ARM builds #115

Merged
merged 3 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions lib/aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ const aliases = {
dmg: ['dmg']
}

for (const _platform of Object.keys(aliases)) {
const platform = _platform + '_arm64';
aliases[platform] = aliases[_platform].map(alias => `${alias}_arm64`);
}
LabhanshAgrawal marked this conversation as resolved.
Show resolved Hide resolved

module.exports = platform => {
if (typeof aliases[platform] !== 'undefined') {
return platform
Expand Down
5 changes: 3 additions & 2 deletions lib/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ const { extname } = require('path')

module.exports = fileName => {
const extension = extname(fileName).slice(1)
const arch = fileName.includes('arm64') | fileName.includes('aarch64') ? '_arm64' : ''
LabhanshAgrawal marked this conversation as resolved.
Show resolved Hide resolved

if (
(fileName.includes('mac') || fileName.includes('darwin')) &&
extension === 'zip'
) {
return 'darwin'
return 'darwin' + arch
}

const directCache = ['exe', 'dmg', 'rpm', 'deb', 'AppImage']
return directCache.find(ext => ext === extension) || false
return directCache.includes(extension) ? extension + arch : false
LabhanshAgrawal marked this conversation as resolved.
Show resolved Hide resolved
}
4 changes: 4 additions & 0 deletions lib/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ module.exports = ({ cache, config }) => {
platform = 'dmg'
}

if (platform === 'mac_arm64' && !isUpdate) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for the zip issue on mac os
Similar to lines 80-82 for x64

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

platform = 'dmg_arm64'
}

// Get the latest version from the cache
const latest = await loadCache()

Expand Down