Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
feat(electron): use new electron-forge and electron-package
Browse files Browse the repository at this point in the history
  • Loading branch information
devinus committed Nov 27, 2018
1 parent 97449af commit ed2db80
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 299 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
sudo: false
dist: trusty
- os: osx
osx_image: xcode6.4
osx_image: xcode7.3

addons:
chrome: stable
Expand Down
16 changes: 9 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ init:
- git config --global core.autocrlf input

install:
- ps: Update-NodeJsInstallation $env:nodejs_version $env:PLATFORM
- ps: Update-NodeJsInstallation $Env:nodejs_version $Env:PLATFORM
- node --version
- yarn --version
- yarn --frozen-lockfile --non-interactive
Expand All @@ -27,14 +27,16 @@ test_script:
- yarn test

after_test:
- ps: |
$path = "$Env:PATH;C:\Program Files (x86)\Windows Kits\10\App Certification Kit"
Set-AppveyorBuildVariable -Name 'PATH' -Value $path
- yarn cross-env NODE_ENV=production ember electron:build -e production
- ps: |
$path = Join-Path -Path "$env:TEMP" -ChildPath csc.p12
[IO.File]::WriteAllBytes($path, [Convert]::FromBase64String($env:CSC_LINK))
Set-AppveyorBuildVariable -Name 'CSC_LINK' -Value $path
$cscFile = Join-Path -Path "$Env:TMP" -ChildPath csc.p12
[IO.File]::WriteAllBytes($cscFile, [Convert]::FromBase64String($Env:CSC_LINK))
Set-AppveyorBuildVariable -Name 'CSC_FILE' -Value $cscFile
- yarn cross-env NODE_ENV=production ember electron:make -e production --build-path electron-out/ember
- ps: Remove-Item env:CSC_KEY_PASSWORD
- ps: Remove-Item -Path $env:CSC_LINK
- ps: Remove-Item -Path $Env:CSC_FILE

artifacts:
- path: electron-out\make\*.zip
Expand All @@ -49,7 +51,7 @@ artifacts:
before_deploy:
- ps: |
$package = Get-Content -Raw -Path package.json | ConvertFrom-Json
$release = "$($package.productName) $($env:APPVEYOR_REPO_TAG_NAME.Substring(1))"
$release = "$($package.productName) $($Env:APPVEYOR_REPO_TAG_NAME.Substring(1))"
Set-AppveyorBuildVariable -Name 'GITHUB_RELEASE' -Value $release
deploy:
Expand Down
2 changes: 1 addition & 1 deletion ember-electron/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const downloadAsset = async (sender, url, onStarted, onProgress) => {
sender.send('download-extract');
}

const assetName = path.basename(savePath, '.tar.br');
const assetName = path.basename(savePath, '.tar.xz');
const extractDir = path.join(path.dirname(savePath), productName, assetName);
await makeDir(extractDir);
await extractAsset(savePath, extractDir, onProgress);
Expand Down
21 changes: 17 additions & 4 deletions ember-electron/electron-forge-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const moment = require('moment');

const {
version,
homepage,
productName,
name: packageName,
copyright: appCopyright,
Expand Down Expand Up @@ -34,8 +35,11 @@ const osxSign = {
entitlements: false,
};

const certificateFile = process.env.CSC_LINK || undefined;
const certificatePassword = process.env.CSC_KEY_PASSWORD || undefined;
const certificateFile = process.env.CSC_FILE ? path.resolve(process.env.CSC_FILE) : null;
const certificatePassword = process.env.CSC_KEY_PASSWORD || null;
const signWithParams = certificateFile && certificatePassword
? `/a /f "${certificateFile}" /p "${certificatePassword}" /fd sha256 /tr http://timestamp.digicert.com /td sha256`
: undefined;

const unsupportedArch = (target, type) => {
throw new Error(`Unsupported architecture for ${target}: ${type}`);
Expand Down Expand Up @@ -96,9 +100,11 @@ module.exports = {
// extendInfo: {
// CSResourcesFileMapped: true,
// },
prune: false,
overwrite: true,
packageManager: 'yarn',
executableName: name,
darwinDarkModeSupport: true,
win32metadata: {
FileDescription: productName,
InternalName: name,
Expand All @@ -115,13 +121,20 @@ module.exports = {
},
electronWinstallerConfig: {
name,
certificateFile,
certificatePassword,
signWithParams,
exe: `${name}.exe`,
iconUrl: `${homepage}/icon.ico`,
setupIcon: `${icon}.ico`,
loadingGif: path.join(__dirname, 'resources', 'install-spinner.gif'),
},
electronInstallerDMG: {
icon: `${icon}.icns`,
format: 'ULFO',
additionalDMGOptions: {
'code-sign': {
'signing-identity': process.env.CSC_NAME || undefined,
},
},
},
electronInstallerDebian: {
name,
Expand Down
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"name": "Nano Wallet Company",
"email": "team@nanowalletcompany.com"
},
"homepage": "https://nanowalletcompany.com/",
"copyright": "Copyright © 2018, Nano Wallet Company",
"homepage": "https://nanowalletcompany.com",
"copyright": "Copyright © 2018 Nano Wallet Company LLC",
"bugs": {
"url": "https://github.com/nano-wallet-company/nano-wallet-desktop/issues",
"email": "support@nanowalletcompany.com"
Expand Down Expand Up @@ -137,7 +137,7 @@
"@commitlint/cli": "^7.2.1",
"@commitlint/config-conventional": "^7.1.2",
"@commitlint/prompt": "^7.2.1",
"@ember-decorators/babel-transforms": "^3.1.0",
"@ember-decorators/babel-transforms": "^3.1.1",
"@ember/jquery": "^0.5.2",
"@ember/optional-features": "^0.7.0",
"@fortawesome/ember-fontawesome": "^0.1.8",
Expand All @@ -158,8 +158,9 @@
"cross-env": "^5.2.0",
"devtron": "^1.4.0",
"downloadjs": "^1.4.7",
"electron-forge": "~5.0.0",
"electron-packager": "~10.1.2",
"electron-forge": "^5.2.3",
"electron-installer-dmg": "^2.0.0",
"electron-packager": "^12.2.0",
"electron-prebuilt-compile": "3.0.10",
"ember-ajax": "^4.0.0",
"ember-bootstrap": "^2.3.0",
Expand Down Expand Up @@ -204,7 +205,7 @@
"ember-concurrency-retryable": "^0.4.0",
"ember-config-service": "^1.0.0",
"ember-data": "^3.6.0-beta.1",
"ember-decorators": "^3.1.0",
"ember-decorators": "^3.1.1",
"ember-electron": "^2.10.0",
"ember-exex": "^0.2.0",
"ember-export-application-global": "^2.0.0",
Expand Down Expand Up @@ -264,6 +265,11 @@
"slick-carousel": "^1.8.1",
"standard-version": "^4.4.0"
},
"resolutions": {
"electron-forge": "^5.2.3",
"electron-installer-dmg": "^2.0.0",
"electron-packager": "^12.2.0"
},
"engines": {
"node": ">= 10.2.0"
}
Expand Down
40 changes: 0 additions & 40 deletions patches/@ember-decorators/utils+3.1.0.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
diff --git a/node_modules/electron-forge/dist/api/make.js b/node_modules/electron-forge/dist/api/make.js
index a18d452..4d8ba3c 100644
index c51cd46..1a7cdad 100644
--- a/node_modules/electron-forge/dist/api/make.js
+++ b/node_modules/electron-forge/dist/api/make.js
@@ -199,7 +199,8 @@ exports.default = (() => {
for (var _iterator2 = (0, _getIterator3.default)((0, _parseArchs2.default)(platform, arch, packageJSON.devDependencies['electron-prebuilt-compile'])), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
@@ -204,7 +204,8 @@ exports.default = (() => {
for (var _iterator2 = (0, _getIterator3.default)((0, _parseArchs2.default)(platform, arch, electronVersion)), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
const targetArch = _step2.value;

- const packageDir = _path2.default.resolve(outDir, `${appName}-${actualTargetPlatform}-${targetArch}`);
Expand Down
27 changes: 0 additions & 27 deletions patches/electron-packager+10.1.2.patch

This file was deleted.

14 changes: 14 additions & 0 deletions patches/electron-packager+12.2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/node_modules/electron-packager/common.js b/node_modules/electron-packager/common.js
index d389ffa..f0277e2 100644
--- a/node_modules/electron-packager/common.js
+++ b/node_modules/electron-packager/common.js
@@ -72,7 +72,8 @@ function sanitizeAppName (name) {
}

function generateFinalBasename (opts) {
- return `${sanitizeAppName(opts.name)}-${opts.platform}-${opts.arch}`
+ let targetName = sanitizeAppName(opts.name).replace(/\s+/g, '-').toLowerCase()
+ return `${targetName}-${opts.platform}-${opts.arch}`
}

function generateFinalPath (opts) {
25 changes: 25 additions & 0 deletions patches/ember-electron+2.10.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/node_modules/ember-electron/lib/tasks/assemble.js b/node_modules/ember-electron/lib/tasks/assemble.js
index 12241f1..4fc1d4c 100644
--- a/node_modules/ember-electron/lib/tasks/assemble.js
+++ b/node_modules/ember-electron/lib/tasks/assemble.js
@@ -65,7 +65,7 @@ class AssembleTask extends Task {

pruneCommand() {
if (shouldUseYarn(this.project.root)) {
- return 'yarn install --production --no-bin-links';
+ return 'yarn install --production --no-bin-links --frozen-lockfile';
} else {
return 'npm install --production --no-bin-links';
}
diff --git a/node_modules/ember-electron/lib/utils/assemble-tree.js b/node_modules/ember-electron/lib/utils/assemble-tree.js
index 086b5cb..78f4188 100644
--- a/node_modules/ember-electron/lib/utils/assemble-tree.js
+++ b/node_modules/ember-electron/lib/utils/assemble-tree.js
@@ -84,6 +84,7 @@ this addon once you removed the {{welcome-page}} template tag.
include: [
'npm-shrinkwrap.json',
'yarn.lock',
+ '.yarnclean',
],
}),

Loading

0 comments on commit ed2db80

Please sign in to comment.