Compare commits

...

6 Commits

Author SHA1 Message Date
Alexis Svinartchouk
e96129d857 beaglebone wip 2021-03-02 14:47:05 +01:00
Alexis Svinartchouk
cc9b063f16 Update spectron to v13
Change-type: patch
2021-02-16 18:47:00 +01:00
Alexis Svinartchouk
079140a23b Update dependencies, use aws4-axios@2.2.1 to avoid adding more dependiencies
Also filter out dmg-license dependencies from the shrinkwrap file
aws4-axios@2.3.0 brings in react-native, see aws/aws-sdk-js-v3#1797

Change-type: patch
2021-02-16 18:47:00 +01:00
Alexis Svinartchouk
8e4473a14a Update scripts to build universal mac dmgs on the ci
Change-type: patch
2021-02-16 18:47:00 +01:00
Alexis Svinartchouk
81b5c67a3b Fix beforeBuild.js script to also work on mac
Change-type: patch
2021-02-16 15:49:18 +01:00
Alexis Svinartchouk
e42debd183 Support building universal dmgs (x64 and arm64) for mac
Change-type: patch
2021-02-16 15:49:18 +01:00
8 changed files with 1403 additions and 2759 deletions

View File

@@ -6,15 +6,15 @@ const process = require('process');
// Rebuild native modules for ia32 and run webpack again for the ia32 part of windows packages // Rebuild native modules for ia32 and run webpack again for the ia32 part of windows packages
exports.default = function(context) { exports.default = function(context) {
if (context.platform.name === 'windows') { if (['windows', 'mac'].includes(context.platform.name)) {
cp.execFileSync( cp.execFileSync(
'bash', 'npx',
['./node_modules/.bin/electron-rebuild', '--types', 'dev', '--arch', context.arch], ['electron-rebuild', '--types', 'dev', '--arch', context.arch],
); );
rimraf.sync('generated'); rimraf.sync('generated');
cp.execFileSync( cp.execFileSync(
'bash', 'npx',
['./node_modules/.bin/webpack'], ['webpack'],
{ {
env: { env: {
...process.env, ...process.env,

View File

@@ -187,16 +187,16 @@ function prepareDrive(drive: Drive) {
if (drive instanceof sdk.sourceDestination.BlockDevice) { if (drive instanceof sdk.sourceDestination.BlockDevice) {
// @ts-ignore (BlockDevice.drive is private) // @ts-ignore (BlockDevice.drive is private)
return drive.drive; return drive.drive;
} else if (drive instanceof sdk.sourceDestination.UsbbootDrive) { } else if (
// This is a workaround etcher expecting a device string and a size drive instanceof sdk.sourceDestination.UsbbootDrive ||
drive instanceof sdk.sourceDestination.UsbBBbootDrive
) {
// This is a workaround etcher expecting a device string
// @ts-ignore // @ts-ignore
drive.device = drive.usbDevice.portId; drive.device = drive.usbDevice.portId;
drive.size = null; const debouncedUpdateDriveProgress = _.throttle(updateDriveProgress, 100);
// @ts-ignore
drive.progress = 0;
drive.disabled = true;
drive.on('progress', (progress) => { drive.on('progress', (progress) => {
updateDriveProgress(drive, progress); debouncedUpdateDriveProgress(drive, progress);
}); });
return drive; return drive;
} else if (drive instanceof sdk.sourceDestination.DriverlessDevice) { } else if (drive instanceof sdk.sourceDestination.DriverlessDevice) {
@@ -266,7 +266,9 @@ function removeDrive(drive: Drive) {
} }
function updateDriveProgress( function updateDriveProgress(
drive: sdk.sourceDestination.UsbbootDrive, drive:
| sdk.sourceDestination.UsbbootDrive
| sdk.sourceDestination.UsbBBbootDrive,
progress: number, progress: number,
) { ) {
const drives = getDrives(); const drives = getDrives();

View File

@@ -26,7 +26,10 @@ const adapters: sdk.scanner.adapters.Adapter[] = [
// Can't use permissions.isElevated() here as it returns a promise and we need to set // Can't use permissions.isElevated() here as it returns a promise and we need to set
// module.exports = scanner right now. // module.exports = scanner right now.
if (platform !== 'linux' || geteuid() === 0) { if (platform !== 'linux' || geteuid() === 0) {
adapters.push(new sdk.scanner.adapters.UsbbootDeviceAdapter()); adapters.push(
new sdk.scanner.adapters.UsbbootDeviceAdapter(),
new sdk.scanner.adapters.UsbBBbootDeviceAdapter(),
);
} }
if ( if (

4101
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -46,6 +46,14 @@
"author": "Balena Inc. <hello@etcher.io>", "author": "Balena Inc. <hello@etcher.io>",
"license": "Apache-2.0", "license": "Apache-2.0",
"platformSpecificDependencies": [ "platformSpecificDependencies": [
"xmlbuilder",
"xmldom",
"@types/plist",
"@types/verror",
"crc",
"iconv-corefoundation",
"plist",
"dmg-license",
"fsevents", "fsevents",
"winusb-driver-generator" "winusb-driver-generator"
], ],
@@ -66,6 +74,7 @@
"@types/terser-webpack-plugin": "^5.0.2", "@types/terser-webpack-plugin": "^5.0.2",
"@types/tmp": "^0.2.0", "@types/tmp": "^0.2.0",
"@types/webpack-node-externals": "^2.5.0", "@types/webpack-node-externals": "^2.5.0",
"aws4-axios": "2.2.1",
"chai": "^4.2.0", "chai": "^4.2.0",
"copy-webpack-plugin": "^7.0.0", "copy-webpack-plugin": "^7.0.0",
"css-loader": "^5.0.1", "css-loader": "^5.0.1",
@@ -77,7 +86,7 @@
"electron-notarize": "^1.0.0", "electron-notarize": "^1.0.0",
"electron-rebuild": "^2.3.2", "electron-rebuild": "^2.3.2",
"electron-updater": "^4.3.5", "electron-updater": "^4.3.5",
"etcher-sdk": "^6.1.1", "etcher-sdk": "^6.2.0-beagle-bone-1e75cbc18fa680df8ca0647a145d2d9fd55570b0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"husky": "^4.2.5", "husky": "^4.2.5",
"immutable": "^3.8.1", "immutable": "^3.8.1",
@@ -99,7 +108,7 @@
"semver": "^7.3.2", "semver": "^7.3.2",
"simple-progress-webpack-plugin": "^1.1.2", "simple-progress-webpack-plugin": "^1.1.2",
"sinon": "^9.0.2", "sinon": "^9.0.2",
"spectron": "^11.0.0", "spectron": "^13.0.0",
"string-replace-loader": "^3.0.1", "string-replace-loader": "^3.0.1",
"styled-components": "^5.1.0", "styled-components": "^5.1.0",
"sudo-prompt": "github:zvin/sudo-prompt#7cdede2f0da28fbcc2db48402d7d935f3a825c91", "sudo-prompt": "github:zvin/sudo-prompt#7cdede2f0da28fbcc2db48402d7d935f3a825c91",

View File

@@ -29,6 +29,10 @@ const SHRINKWRAP_FILENAME = path.join(__dirname, '..', 'npm-shrinkwrap.json');
async function main() { async function main() {
try { try {
const cleaned = omit(shrinkwrap, packageInfo.platformSpecificDependencies); const cleaned = omit(shrinkwrap, packageInfo.platformSpecificDependencies);
for (const item of Object.values(cleaned.dependencies)) {
// @ts-ignore
item.dev = true;
}
await writeFileAsync( await writeFileAsync(
SHRINKWRAP_FILENAME, SHRINKWRAP_FILENAME,
JSON.stringify(cleaned, null, JSON_INDENT), JSON.stringify(cleaned, null, JSON_INDENT),

View File

@@ -68,6 +68,8 @@ function renameNodeModules(resourcePath: string) {
path path
.relative(__dirname, resourcePath) .relative(__dirname, resourcePath)
.replace('node_modules', 'modules') .replace('node_modules', 'modules')
// use the same name on all architectures so electron-builder can build a universal dmg on mac
.replace(LZMA_BINDINGS_FOLDER, 'binding')
// file-loader expects posix paths, even on Windows // file-loader expects posix paths, even on Windows
.replace(/\\/g, '/') .replace(/\\/g, '/')
); );
@@ -190,12 +192,7 @@ const commonConfig = {
// remove node-pre-gyp magic from lzma-native // remove node-pre-gyp magic from lzma-native
{ {
search: 'require(binding_path)', search: 'require(binding_path)',
replace: () => { replace: `require('./${LZMA_BINDINGS_FOLDER}/lzma_native.node')`,
return `require('./${path.posix.join(
LZMA_BINDINGS_FOLDER,
'lzma_native.node',
)}')`;
},
}, },
// use regular stream module instead of readable-stream // use regular stream module instead of readable-stream
{ {