Skip to content
Permalink
Browse files

feat(maker): allow maker configs to be functions that return values b…

…ased on arch

this allows more arguments to be passed through in the future, leaving this undocumented for now as
it's not a pattern I like but a pattern some people might find useful.  Will document once I get a
grip on how exactly I want this to be used.
  • Loading branch information
MarshallOfSound committed Apr 18, 2017
1 parent c23bfdf commit d9cbec5ae4fca15a1ff85edd5710494fefca0a21
@@ -3,13 +3,14 @@ import path from 'path';
import pify from 'pify';

import { ensureFile } from '../../util/ensure-output';
import configFn from '../../util/config-fn';

export default async (dir, appName, targetArch, forgeConfig, packageJSON) => { // eslint-disable-line
const outPath = path.resolve(dir, '../make', `${appName}.dmg`);
await ensureFile(outPath);
const dmgConfig = Object.assign({
overwrite: true,
}, forgeConfig.electronInstallerDMG, {
}, configFn(forgeConfig.electronInstallerDMG, targetArch), {
appPath: path.resolve(dir, `${appName}.app`),
name: appName,
out: path.dirname(outPath),
@@ -3,6 +3,7 @@ import path from 'path';
import pify from 'pify';

import { ensureFile } from '../../util/ensure-output';
import configFn from '../../util/config-fn';

function debianArch(nodeArch) {
switch (nodeArch) {
@@ -24,7 +25,7 @@ export default async (dir, appName, targetArch, forgeConfig, packageJSON) => { /
dest: path.dirname(outPath),
src: dir,
};
const debianConfig = Object.assign({}, forgeConfig.electronInstallerDebian, debianDefaults);
const debianConfig = Object.assign({}, configFn(forgeConfig.electronInstallerDebian, targetArch), debianDefaults);

await pify(installer)(debianConfig);
return [outPath];
@@ -3,6 +3,7 @@ import path from 'path';
import pify from 'pify';

import { ensureFile } from '../../util/ensure-output';
import configFn from '../../util/config-fn';

function flatpakArch(nodeArch) {
switch (nodeArch) {
@@ -24,7 +25,7 @@ export default async (dir, appName, targetArch, forgeConfig, packageJSON) => { /
dest: path.dirname(outPath),
src: dir,
};
const flatpakConfig = Object.assign({}, forgeConfig.electronInstallerFlatpak, flatpakDefaults);
const flatpakConfig = Object.assign({}, configFn(forgeConfig.electronInstallerFlatpak, targetArch), flatpakDefaults);

await pify(installer)(flatpakConfig);
return [outPath];
@@ -3,6 +3,7 @@ import path from 'path';
import pify from 'pify';

import { ensureFile } from '../../util/ensure-output';
import configFn from '../../util/config-fn';

function rpmArch(nodeArch) {
switch (nodeArch) {
@@ -24,7 +25,7 @@ export default async (dir, appName, targetArch, forgeConfig, packageJSON) => { /
dest: path.dirname(outPath),
src: dir,
};
const rpmConfig = Object.assign({}, forgeConfig.electronInstallerRedhat, rpmDefaults);
const rpmConfig = Object.assign({}, configFn(forgeConfig.electronInstallerRedhat, targetArch), rpmDefaults);

await pify(installer)(rpmConfig);
return [outPath];
@@ -4,6 +4,7 @@ import path from 'path';
import { spawnPromise, findActualExecutable } from 'spawn-rx';

import { ensureDirectory } from '../../util/ensure-output';
import configFn from '../../util/config-fn';

// NB: This is not a typo, we require AppXs to be built on 64-bit
// but if we're running in a 32-bit node.js process, we're going to
@@ -57,7 +58,7 @@ export default async (dir, appName, targetArch, forgeConfig, packageJSON) => { /
packageDescription: packageJSON.description || appName,
packageExecutable: `app\\${appName}.exe`,
windowsKit: path.dirname(findSdkTool('makeappx.exe')),
}, forgeConfig.windowsStoreConfig, {
}, configFn(forgeConfig.windowsStoreConfig, targetArch), {
inputDirectory: dir,
outputDirectory: outPath,
});
@@ -3,6 +3,7 @@ import fs from 'fs-promise';
import path from 'path';

import { ensureDirectory } from '../../util/ensure-output';
import configFn from '../../util/config-fn';

export default async (dir, appName, targetArch, forgeConfig, packageJSON) => { // eslint-disable-line
const outPath = path.resolve(dir, `../make/squirrel.windows/${targetArch}`);
@@ -12,10 +13,11 @@ export default async (dir, appName, targetArch, forgeConfig, packageJSON) => { /
name: appName,
noMsi: true,
exe: `${appName}.exe`,
}, forgeConfig.electronWinstallerConfig, {
}, configFn(forgeConfig.electronWinstallerConfig, targetArch), {
appDirectory: dir,
outputDirectory: outPath,
});

await createWindowsInstaller(winstallerConfig);
const artifacts = [
path.resolve(outPath, 'RELEASES'),
@@ -0,0 +1,6 @@
export default (configObject, ...args) => {
if (typeof configObject === 'function') {
return configObject(...args);
}
return configObject;
};

0 comments on commit d9cbec5

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