Skip to content

Commit

Permalink
fix(core): do platform filtering later in the make chain to ensure th…
Browse files Browse the repository at this point in the history
…at default platforms are respec
  • Loading branch information
MarshallOfSound committed Jun 27, 2018
1 parent 3b625de commit 19e0543
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/api/core/src/api/make.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ export default async ({
const makers: {
[key: number]: MakerBase<any>;
} = {};
const targets = (overrideTargets || forgeConfig.makers.filter(
maker => maker.platforms
? maker.platforms.indexOf(actualTargetPlatform) !== -1
: true,
)).map((target) => {
let targets = (overrideTargets || forgeConfig.makers).map((target) => {
if (typeof target === 'string') {
return { name: target };
}
Expand All @@ -99,6 +95,7 @@ export default async ({
let maker: MakerBase<any>;
if ((target as MakerBase<any>).__isElectronForgeMaker) {
maker = target as MakerBase<any>;
if (maker.platforms.indexOf(actualTargetPlatform) === -1) continue;
} else {
const resolvableTarget: IForgeResolvableMaker = target as IForgeResolvableMaker;
let makerModule;
Expand All @@ -111,6 +108,7 @@ export default async ({

const MakerClass = makerModule.default || makerModule;
maker = new MakerClass(resolvableTarget.config, resolvableTarget.platforms);
if (maker.platforms.indexOf(actualTargetPlatform) === -1) continue;
}

if (!maker.isSupportedOnCurrentPlatform) {
Expand All @@ -123,7 +121,7 @@ export default async ({

if (!await maker.isSupportedOnCurrentPlatform()) {
throw new Error([
`Cannot build for ${platform} and target ${maker.name}: the maker declared `,
`Cannot make for ${platform} and target ${maker.name}: the maker declared `,
`that it cannot run on ${process.platform}`,
].join(''));
}
Expand All @@ -145,6 +143,8 @@ export default async ({
warn(interactive, 'WARNING: Skipping the packaging step, this could result in an out of date build'.red);
}

targets = targets.filter((_, i) => makers[i]);

info(interactive, `Making for the following targets: ${`${targets.map((t, i) => makers[i].name).join(', ')}`.cyan}`);

const packageJSON = await readMutatedPackageJson(dir, forgeConfig);
Expand Down

0 comments on commit 19e0543

Please sign in to comment.