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
exports.default = function(context) {
if (context.platform.name === 'windows') {
if (['windows', 'mac'].includes(context.platform.name)) {
cp.execFileSync(
'bash',
['./node_modules/.bin/electron-rebuild', '--types', 'dev', '--arch', context.arch],
'npx',
['electron-rebuild', '--types', 'dev', '--arch', context.arch],
);
rimraf.sync('generated');
cp.execFileSync(
'bash',
['./node_modules/.bin/webpack'],
'npx',
['webpack'],
{
env: {
...process.env,

View File

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

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>",
"license": "Apache-2.0",
"platformSpecificDependencies": [
"xmlbuilder",
"xmldom",
"@types/plist",
"@types/verror",
"crc",
"iconv-corefoundation",
"plist",
"dmg-license",
"fsevents",
"winusb-driver-generator"
],
@@ -66,6 +74,7 @@
"@types/terser-webpack-plugin": "^5.0.2",
"@types/tmp": "^0.2.0",
"@types/webpack-node-externals": "^2.5.0",
"aws4-axios": "2.2.1",
"chai": "^4.2.0",
"copy-webpack-plugin": "^7.0.0",
"css-loader": "^5.0.1",
@@ -77,7 +86,7 @@
"electron-notarize": "^1.0.0",
"electron-rebuild": "^2.3.2",
"electron-updater": "^4.3.5",
"etcher-sdk": "^6.1.1",
"etcher-sdk": "^6.2.0-beagle-bone-1e75cbc18fa680df8ca0647a145d2d9fd55570b0",
"file-loader": "^6.2.0",
"husky": "^4.2.5",
"immutable": "^3.8.1",
@@ -99,7 +108,7 @@
"semver": "^7.3.2",
"simple-progress-webpack-plugin": "^1.1.2",
"sinon": "^9.0.2",
"spectron": "^11.0.0",
"spectron": "^13.0.0",
"string-replace-loader": "^3.0.1",
"styled-components": "^5.1.0",
"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() {
try {
const cleaned = omit(shrinkwrap, packageInfo.platformSpecificDependencies);
for (const item of Object.values(cleaned.dependencies)) {
// @ts-ignore
item.dev = true;
}
await writeFileAsync(
SHRINKWRAP_FILENAME,
JSON.stringify(cleaned, null, JSON_INDENT),

View File

@@ -68,6 +68,8 @@ function renameNodeModules(resourcePath: string) {
path
.relative(__dirname, resourcePath)
.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
.replace(/\\/g, '/')
);
@@ -190,12 +192,7 @@ const commonConfig = {
// remove node-pre-gyp magic from lzma-native
{
search: 'require(binding_path)',
replace: () => {
return `require('./${path.posix.join(
LZMA_BINDINGS_FOLDER,
'lzma_native.node',
)}')`;
},
replace: `require('./${LZMA_BINDINGS_FOLDER}/lzma_native.node')`,
},
// use regular stream module instead of readable-stream
{