Skip to content
Permalink
Browse files

chore: switch flatpak maker to @malept/electron-installer-flatpak (#714)

Upgrades dependencies, uses Promises, and other enhancements.
  • Loading branch information
malept committed Mar 17, 2019
1 parent d3e7305 commit 02ddd84846e80fca7e23b7ab380b268cff9ed288
@@ -13,4 +13,8 @@ bolt
bolt build
bolt lint

# For flatpak
mkdir -p /var/run/dbus
dbus-daemon --system

DEBUG=electron-installer-snap:snapcraft CI=true bolt test -- --installer=$NODE_INSTALLER
@@ -154,9 +154,9 @@
"typescript": "3.3.3333"
},
"optionalDependencies": {
"@malept/electron-installer-flatpak": "^0.9.0",
"electron-installer-debian": "^1.1.0",
"electron-installer-dmg": "^2.0.0",
"electron-installer-flatpak": "^0.8.0",
"electron-installer-redhat": "^1.0.0",
"electron-installer-snap": "^3.1.0",
"electron-windows-store": "^2.1.0",
@@ -21,6 +21,6 @@
"pify": "^4.0.0"
},
"optionalDependencies": {
"electron-installer-flatpak": "^0.8.0"
"@malept/electron-installer-flatpak": "^0.9.0"
}
}
@@ -3,7 +3,6 @@ import { ForgeArch, ForgePlatform } from '@electron-forge/shared-types';

import fs from 'fs-extra';
import path from 'path';
import pify from 'pify';

import { MakerFlatpakConfig } from './Config';

@@ -22,15 +21,15 @@ export default class MakerFlatpak extends MakerBase<MakerFlatpakConfig> {
defaultPlatforms: ForgePlatform[] = ['linux'];

isSupportedOnCurrentPlatform() {
return this.isInstalled('electron-installer-flatpak') && process.platform === 'linux';
return this.isInstalled('@malept/electron-installer-flatpak') && process.platform === 'linux';
}

async make({
dir,
makeDir,
targetArch,
}: MakerOptions) {
const installer = require('electron-installer-flatpak');
const installer = require('@malept/electron-installer-flatpak');

const arch = flatpakArch(targetArch);
const outDir = path.resolve(makeDir, 'flatpak');
@@ -42,7 +41,7 @@ export default class MakerFlatpak extends MakerBase<MakerFlatpakConfig> {
dest: outDir,
});

await pify(installer)(flatpakConfig);
await installer(flatpakConfig);

return (await fs.readdir(outDir))
.filter(basename => basename.endsWith('.flatpak'))
@@ -15,7 +15,7 @@ class MakerImpl extends MakerBase<MakerFlatpakConfig> { name = 'test'; defaultPl
describe('MakerFlatpak', () => {
let flatpakModule: typeof MakerImpl;
let maker: MakerImpl;
let eidStub: SinonStub;
let eifStub: SinonStub;
let ensureDirectoryStub: SinonStub;
let config: MakerFlatpakConfig;
let createMaker: () => void;
@@ -28,12 +28,12 @@ describe('MakerFlatpak', () => {

beforeEach(() => {
ensureDirectoryStub = stub().returns(Promise.resolve());
eidStub = stub().callsArg(1);
eifStub = stub().resolves();
config = {};

flatpakModule = proxyquire.noPreserveCache().noCallThru().load('../src/MakerFlatpak', {
'fs-extra': { readdir: stub().returns(Promise.resolve([])) },
'electron-installer-flatpak': eidStub,
'@malept/electron-installer-flatpak': eifStub,
}).default;
createMaker = () => {
maker = new flatpakModule(config); // eslint-disable-line
@@ -45,7 +45,7 @@ describe('MakerFlatpak', () => {

it('should pass through correct defaults', async () => {
await (maker.make as any)({ dir, makeDir, appName, targetArch, packageJSON });
const opts = eidStub.firstCall.args[0];
const opts = eifStub.firstCall.args[0];
expect(opts).to.deep.equal({
arch: flatpakArch(process.arch as ForgeArch),
src: dir,
@@ -63,7 +63,7 @@ describe('MakerFlatpak', () => {
createMaker();

await (maker.make as any)({ dir, makeDir, appName, targetArch, packageJSON });
const opts = eidStub.firstCall.args[0];
const opts = eifStub.firstCall.args[0];
expect(opts).to.deep.equal({
arch: flatpakArch(process.arch as ForgeArch),
options: {

0 comments on commit 02ddd84

Please sign in to comment.
You can’t perform that action at this time.