Compare commits

...

10 Commits

Author SHA1 Message Date
Alexis Svinartchouk
f9520085fa etcher pro dockerfile wip 2019-10-14 15:45:39 +02:00
Alexis Svinartchouk
64c4863c8a Use the same entrypoint for etcher and the child writer
Change-type: patch
2019-10-14 15:45:39 +02:00
Alexis Svinartchouk
dea11bedf2 nan is a devDependency
Change-type: patch
2019-10-14 15:45:39 +02:00
Alexis Svinartchouk
19bd8a7968 Require angular-mocks only when needed
Change-type: patch
2019-10-14 15:45:39 +02:00
Alexis Svinartchouk
32bd0b65bc Remove no longer needed pkg dev dependency
Change-type: patch
2019-10-14 15:45:39 +02:00
Alexis Svinartchouk
a51e378854 Update mocha, remove nock
Change-type: patch
2019-10-14 15:45:39 +02:00
Alexis Svinartchouk
3426f1a43c Remove no longer needed xml2js
Change-type: patch
2019-10-14 15:45:39 +02:00
Alexis Svinartchouk
8815e8d4c3 Remove node-pre-gyp patch that is no longer needed with electron 6
Change-type: patch
2019-10-14 15:45:39 +02:00
Alexis Svinartchouk
531cd1816b Update electron-mocha to ^8.1.2, remove acorn
Change-type: patch
2019-10-14 15:45:39 +02:00
Alexis Svinartchouk
54960f3692 Update electron to 6.0.10
Change-type: patch
Changelog-entry: Update electron to 6.0.10
2019-10-14 15:45:39 +02:00
19 changed files with 1914 additions and 1267 deletions

View File

@@ -1,2 +0,0 @@
*
!requirements.txt

1
.gitattributes vendored
View File

@@ -6,6 +6,7 @@
*.scss text eol=lf *.scss text eol=lf
# Text files # Text files
*.Dockerfile text
Dockerfile* text Dockerfile* text
.dockerignore text .dockerignore text
.editorconfig text .editorconfig text

View File

@@ -182,7 +182,7 @@ test-spectron:
ETCHER_SPECTRON_ENTRYPOINT="$(ETCHER_SPECTRON_ENTRYPOINT)" mocha $(MOCHA_OPTIONS) tests/spectron ETCHER_SPECTRON_ENTRYPOINT="$(ETCHER_SPECTRON_ENTRYPOINT)" mocha $(MOCHA_OPTIONS) tests/spectron
test-gui: test-gui:
electron-mocha $(MOCHA_OPTIONS) --renderer tests/gui electron-mocha $(MOCHA_OPTIONS) --full-trace --renderer tests/gui
test-sdk: test-sdk:
electron-mocha $(MOCHA_OPTIONS) \ electron-mocha $(MOCHA_OPTIONS) \

19
etcher-pro.Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM balenalib/amd64-debian-node:12.6-buster-build as builder
RUN \
apt-get update \
&& \
apt-get install \
build-essential \
jq \
&& \
apt-get clean
WORKDIR /usr/src/app
ADD . ./
RUN npm config set unsafe-perm true
RUN npm config set arch armv7l
ENV npm_config_arch=armv7l
RUN make electron-develop
FROM alexisresinio/balena-electronjs-amd64
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app /usr/src/app

View File

@@ -91,7 +91,9 @@ const createMainWindow = () => {
icon: path.join(__dirname, '..', '..', 'assets', 'icon.png'), icon: path.join(__dirname, '..', '..', 'assets', 'icon.png'),
darkTheme: true, darkTheme: true,
webPreferences: { webPreferences: {
backgroundThrottling: false backgroundThrottling: false,
nodeIntegration: true,
webviewTag: true
} }
}) })

View File

@@ -22,12 +22,9 @@
// *won't* attempt to load the `app.asar` application by default, therefore // *won't* attempt to load the `app.asar` application by default, therefore
// if passing `ELECTRON_RUN_AS_NODE`, you have to pass the path to the asar // if passing `ELECTRON_RUN_AS_NODE`, you have to pass the path to the asar
// or the entry point file (this file) manually as an argument. // or the entry point file (this file) manually as an argument.
//
// We also consider `ATOM_SHELL_INTERNAL_RUN_AS_NODE`, which is basically if (process.env.ELECTRON_RUN_AS_NODE) {
// an older equivalent of `ELECTRON_RUN_AS_NODE` that still gets set when
// using `child_process.fork()`.
if (process.env.ELECTRON_RUN_AS_NODE || process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE) {
require('./gui/modules/child-writer') require('./gui/modules/child-writer')
} else { } else {
require('../generated/etcher') require('./gui/etcher')
} }

3081
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@
"sleepDays": 7, "sleepDays": 7,
"semverRange": "<2.0.0" "semverRange": "<2.0.0"
}, },
"main": "lib/start.js", "main": "generated/etcher.js",
"description": "Flash OS images to SD cards and USB drives, safely and easily.", "description": "Flash OS images to SD cards and USB drives, safely and easily.",
"productDescription": "Etcher is a powerful OS image flasher built with web technologies to ensure flashing an SDCard or USB drive is a pleasant and safe experience. It protects you from accidentally writing to your hard-drives, ensures every byte of data was written correctly and much more.", "productDescription": "Etcher is a powerful OS image flasher built with web technologies to ensure flashing an SDCard or USB drive is a pleasant and safe experience. It protects you from accidentally writing to your hard-drives, ensures every byte of data was written correctly and much more.",
"homepage": "https://github.com/balena-io/etcher", "homepage": "https://github.com/balena-io/etcher",
@@ -54,13 +54,12 @@
"debug": "^3.1.0", "debug": "^3.1.0",
"electron-is-running-in-asar": "^1.0.0", "electron-is-running-in-asar": "^1.0.0",
"electron-updater": "4.0.6", "electron-updater": "4.0.6",
"etcher-sdk": "^2.0.13", "etcher-sdk": "^2.0.15",
"flexboxgrid": "^6.3.0", "flexboxgrid": "^6.3.0",
"immutable": "^3.8.1", "immutable": "^3.8.1",
"inactivity-timer": "^1.0.0", "inactivity-timer": "^1.0.0",
"lodash": "^4.17.10", "lodash": "^4.17.10",
"mime-types": "^2.1.18", "mime-types": "^2.1.18",
"nan": "^2.9.2",
"node-ipc": "^9.1.1", "node-ipc": "^9.1.1",
"path-is-inside": "^1.0.2", "path-is-inside": "^1.0.2",
"pretty-bytes": "^1.0.4", "pretty-bytes": "^1.0.4",
@@ -78,22 +77,20 @@
"styled-system": "^4.1.0", "styled-system": "^4.1.0",
"sudo-prompt": "^9.0.0", "sudo-prompt": "^9.0.0",
"tmp": "^0.1.0", "tmp": "^0.1.0",
"uuid": "^3.0.1", "uuid": "^3.0.1"
"xml2js": "^0.4.17"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.2.0", "@babel/core": "^7.6.0",
"@babel/plugin-proposal-function-bind": "^7.2.0", "@babel/plugin-proposal-function-bind": "^7.2.0",
"@babel/preset-env": "^7.2.0", "@babel/preset-env": "^7.6.0",
"@babel/preset-react": "^7.0.0", "@babel/preset-react": "^7.0.0",
"@types/react-dom": "^16.8.4", "@types/react-dom": "^16.8.4",
"acorn": "^6.0.5",
"angular-mocks": "1.7.6", "angular-mocks": "1.7.6",
"babel-loader": "^8.0.4", "babel-loader": "^8.0.4",
"chalk": "^1.1.3", "chalk": "^1.1.3",
"electron": "3.1.9", "electron": "6.0.10",
"electron-builder": "^20.40.2", "electron-builder": "^20.40.2",
"electron-mocha": "^6.0.4", "electron-mocha": "^8.1.2",
"eslint": "^4.17.0", "eslint": "^4.17.0",
"eslint-config-standard": "^10.2.1", "eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.9.0", "eslint-plugin-import": "^2.9.0",
@@ -105,13 +102,12 @@
"eslint-plugin-standard": "^3.0.1", "eslint-plugin-standard": "^3.0.1",
"html-angular-validate": "^0.2.3", "html-angular-validate": "^0.2.3",
"html-loader": "^0.5.1", "html-loader": "^0.5.1",
"mocha": "^5.0.1", "mocha": "^6.2.1",
"mochainon": "^2.0.0", "mochainon": "^2.0.0",
"nock": "^9.2.3", "nan": "^2.9.2",
"node-gyp": "^3.8.0", "node-gyp": "^3.8.0",
"node-sass": "^4.7.2", "node-sass": "^4.12.0",
"omit-deep-lodash": "1.1.4", "omit-deep-lodash": "1.1.4",
"pkg": "^4.3.0",
"resin-lint": "^3.1.0", "resin-lint": "^3.1.0",
"sass-lint": "^1.12.1", "sass-lint": "^1.12.1",
"simple-progress-webpack-plugin": "^1.1.2", "simple-progress-webpack-plugin": "^1.1.2",
@@ -119,8 +115,8 @@
"ts-loader": "^6.0.4", "ts-loader": "^6.0.4",
"ts-node": "^8.3.0", "ts-node": "^8.3.0",
"typescript": "^3.5.3", "typescript": "^3.5.3",
"webpack": "^4.31.0", "webpack": "^4.40.2",
"webpack-cli": "^3.1.2", "webpack-cli": "^3.3.9",
"webpack-node-externals": "^1.7.2" "webpack-node-externals": "^1.7.2"
} }
} }

View File

@@ -1,28 +0,0 @@
--- a/node_modules/node-pre-gyp/lib/util/versioning.js
+++ b/node_modules/node-pre-gyp/lib/util/versioning.js
@@ -80,7 +80,14 @@ function get_runtime_abi(runtime, target_version) {
if (runtime === 'node-webkit') {
return get_node_webkit_abi(runtime, target_version || process.versions['node-webkit']);
} else if (runtime === 'electron') {
- return get_electron_abi(runtime, target_version || process.versions.electron);
+ var electron_version = target_version || process.versions.electron;
+ if (!electron_version) {
+ // TODO PR something to electron to pass in the version number for forks
+ // https://github.com/electron/electron/issues/9058
+ try { electron_version = require('electron/package.json').version; }
+ catch (_) { electron_version = '3.1.9'; }
+ }
+ return get_electron_abi(runtime, electron_version);
} else {
if (runtime != 'node') {
throw new Error("Unknown Runtime: '" + runtime + "'");
@@ -263,7 +270,8 @@ function get_process_runtime(versions) {
var runtime = 'node';
if (versions['node-webkit']) {
runtime = 'node-webkit';
- } else if (versions.electron) {
+ } else if (versions.electron || process.env.ELECTRON_RUN_AS_NODE) {
+ // Running in electron or a childProcess.fork of electron
runtime = 'electron';
}
return runtime;

View File

@@ -19,14 +19,9 @@
const _ = require('lodash') const _ = require('lodash')
const m = require('mochainon') const m = require('mochainon')
const angular = require('angular') const angular = require('angular')
require('angular-mocks')
const utils = require('../../../lib/shared/utils') const utils = require('../../../lib/shared/utils')
describe('Browser: DriveSelector', function () { describe('Browser: DriveSelector', function () {
beforeEach(angular.mock.module(
require('../../../lib/gui/app/components/drive-selector/drive-selector')
))
describe('DriveSelectorController', function () { describe('DriveSelectorController', function () {
describe('.memoize()', function () { describe('.memoize()', function () {
it('should handle equal angular objects with different hashes', function () { it('should handle equal angular objects with different hashes', function () {

View File

@@ -21,7 +21,6 @@ const _ = require('lodash')
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const angular = require('angular') const angular = require('angular')
require('angular-mocks')
describe('Browser: SVGIcon', function () { describe('Browser: SVGIcon', function () {
beforeEach(angular.mock.module( beforeEach(angular.mock.module(

View File

@@ -18,7 +18,6 @@
const m = require('mochainon') const m = require('mochainon')
const angular = require('angular') const angular = require('angular')
require('angular-mocks')
describe('Browser: OSDropzone', function () { describe('Browser: OSDropzone', function () {
beforeEach(angular.mock.module( beforeEach(angular.mock.module(

View File

@@ -19,7 +19,6 @@
const m = require('mochainon') const m = require('mochainon')
const angular = require('angular') const angular = require('angular')
const electron = require('electron') const electron = require('electron')
require('angular-mocks')
describe('Browser: OSOpenExternal', function () { describe('Browser: OSOpenExternal', function () {
beforeEach(angular.mock.module( beforeEach(angular.mock.module(

View File

@@ -19,7 +19,6 @@
const m = require('mochainon') const m = require('mochainon')
const fs = require('fs') const fs = require('fs')
const angular = require('angular') const angular = require('angular')
require('angular-mocks')
describe('Browser: FinishPage', function () { describe('Browser: FinishPage', function () {
beforeEach(angular.mock.module( beforeEach(angular.mock.module(

View File

@@ -25,7 +25,6 @@ const angular = require('angular')
const flashState = require('../../../lib/gui/app/models/flash-state') const flashState = require('../../../lib/gui/app/models/flash-state')
const availableDrives = require('../../../lib/gui/app/models/available-drives') const availableDrives = require('../../../lib/gui/app/models/available-drives')
const selectionState = require('../../../lib/gui/app/models/selection-state') const selectionState = require('../../../lib/gui/app/models/selection-state')
require('angular-mocks')
// Mock HTML requires by reading from the file-system // Mock HTML requires by reading from the file-system
// eslint-disable-next-line node/no-deprecated-api // eslint-disable-next-line node/no-deprecated-api

View File

@@ -19,7 +19,6 @@
const m = require('mochainon') const m = require('mochainon')
const fs = require('fs') const fs = require('fs')
const angular = require('angular') const angular = require('angular')
require('angular-mocks')
describe('Browser: SettingsPage', function () { describe('Browser: SettingsPage', function () {
beforeEach(angular.mock.module( beforeEach(angular.mock.module(

View File

@@ -18,7 +18,6 @@
const m = require('mochainon') const m = require('mochainon')
const angular = require('angular') const angular = require('angular')
require('angular-mocks')
const units = require('../../../lib/shared/units') const units = require('../../../lib/shared/units')
describe('Browser: ByteSize', function () { describe('Browser: ByteSize', function () {

View File

@@ -19,7 +19,6 @@
const m = require('mochainon') const m = require('mochainon')
const angular = require('angular') const angular = require('angular')
const packageJSON = require('../../../package.json') const packageJSON = require('../../../package.json')
require('angular-mocks')
describe('Browser: ManifestBind', function () { describe('Browser: ManifestBind', function () {
beforeEach(angular.mock.module( beforeEach(angular.mock.module(

View File

@@ -38,7 +38,7 @@ const commonConfig = {
options: { options: {
presets: [ presets: [
'@babel/preset-react', '@babel/preset-react',
[ '@babel/preset-env', { targets: { electron: '3' } } ] [ '@babel/preset-env', { targets: { electron: '6' } } ]
], ],
plugins: [ '@babel/plugin-proposal-function-bind' ], plugins: [ '@babel/plugin-proposal-function-bind' ],
cacheDirectory: true cacheDirectory: true
@@ -145,7 +145,7 @@ const etcherConfig = _.assign({
} }
], ],
entry: { entry: {
etcher: path.join(__dirname, 'lib', 'gui', 'etcher.js') etcher: path.join(__dirname, 'lib', 'start.js')
}, },
output: { output: {
path: path.join(__dirname, 'generated'), path: path.join(__dirname, 'generated'),