Skip to content

Commit

Permalink
send makeResults instead of flatten artifacts list
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Mar 14, 2018
1 parent 9047f13 commit 4127e06
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/extend.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ The options object has the following structure.
| Key | Value |
|-----|-------|
| `dir` | The base directory of the apps source code |
| `artifacts` | An array of artifact objects, see the [MakeResult](https://docs.electronforge.io/typedef/index.html#static-typedef-MakeResult) object definition for details |
| `makeResults` | An array of MakeResult objects, see the [MakeResult](https://docs.electronforge.io/typedef/index.html#static-typedef-MakeResult) object definition for details |
| `packageJSON` | The packageJSON of the app |
| `config` | The config that is dedicated for this publisher |
| `forgeConfig` | The raw forgeConfig this app is using, you shouldn't really have to use this |
Expand Down
7 changes: 1 addition & 6 deletions packages/api/core/src/api/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ const publish = async (providedOptions = {}) => {
throw 'Failed to locate publishable Electron application';
}

const artifacts = makeResults.reduce((accum, makeResult) => {
accum.push(...makeResult.artifacts);
return accum;
}, []);

const testPlatform = makeOptions.platform || process.platform;
if (publishTargets === null) {
publishTargets = (forgeConfig.publishers || [])
Expand All @@ -152,7 +147,7 @@ const publish = async (providedOptions = {}) => {

await publisher.publish({
dir,
artifacts,
makeResults,
packageJSON,
config: publishTarget.config || {},
forgeConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/publisher/base/src/Publisher.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class Publisher {
*/
async publish({
dir, // The base directory of the apps source code
artifacts, // An array of artifact objects, see the MakeResult object definition for details
makeResults, // An array of MakeResult objects, see the MakeResult object definition for details
packageJSON, // The packageJSON of the app
config, // The config that is dedicated for this publisher
forgeConfig, // The raw forgeConfig this app is using, you shouldn't really have to use this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ export default class PublisherERS extends PublisherBase {
super('electron-release-server');
}

async publish({ artifacts, packageJSON, config, platform, arch }) {
async publish({ makeResults, packageJSON, config, platform, arch }) {
const artifacts = makeResults.reduce((flat, makeResult) => {
flat.push(...makeResult.artifacts);
return flat;
}, []);

if (!(config.baseUrl && config.username && config.password)) {
throw 'In order to publish to ERS you must set the "electronReleaseServer.baseUrl", "electronReleaseServer.username" and "electronReleaseServer.password" properties in your forge config. See the docs for more info'; // eslint-disable-line
}
Expand Down
7 changes: 6 additions & 1 deletion packages/publisher/github/src/PublisherGithub.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export default class PublisherGithub extends PublisherBase {
super('github');
}

async publish({ artifacts, packageJSON, config, tag }) {
async publish({ makeResults, packageJSON, config, tag }) {
const artifacts = makeResults.reduce((flat, makeResult) => {
flat.push(...makeResult.artifacts);
return flat;
}, []);

if (!(config.repository && typeof config.repository === 'object' &&
config.repository.owner && config.repository.name)) {
throw 'In order to publish to github you must set the "github_repository.owner" and "github_repository.name" properties in your forge config. See the docs for more info'; // eslint-disable-line
Expand Down
7 changes: 6 additions & 1 deletion packages/publisher/s3/src/PublisherS3.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export default class PublisherS3 extends PublisherBase {
super('s3');
}

async publish({ artifacts, packageJSON, config, tag }) {
async publish({ makeResults, packageJSON, config, tag }) {
const artifacts = makeResults.reduce((flat, makeResult) => {
flat.push(...makeResult.artifacts);
return flat;
}, []);

const s3Client = new AWS.S3({
accessKeyId: config.accessKeyId,
secretAccessKey: config.secretAccessKey,
Expand Down
7 changes: 6 additions & 1 deletion packages/publisher/snapcraft/src/PublisherSnapcraft.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ export default class PublisherSnapcraft extends PublisherBase {
super('snapcraft');
}

async publish({ dir, artifacts, config }) {
async publish({ dir, makeResults, config }) {
const artifacts = makeResults.reduce((flat, makeResult) => {
flat.push(...makeResult.artifacts);
return flat;
}, []);

const snapArtifacts = artifacts.filter(artifact => artifact.endsWith('.snap'));

if (snapArtifacts.length === 0) {
Expand Down

0 comments on commit 4127e06

Please sign in to comment.