Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix releaser to run tasks serially and not in parallel #2719

Merged
merged 2 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/extensions/releases/release-pipe.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pMapSeries from 'p-map-series';
import { Component } from '../component';
import { Network } from '../isolator/isolator';
import { ExecutionContext } from '../environments';
Expand Down Expand Up @@ -39,7 +40,7 @@ export class ReleasePipe {
* execute a pipeline of release tasks.
*/
async execute(releaseContext: ReleaseContext) {
return Promise.all(this.tasks.map(task => task.execute(releaseContext)));
return pMapSeries(this.tasks, (task: ReleaseTask) => task.execute(releaseContext));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/extensions/releases/run.cmd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ export class ReleaserCmd implements Command {
const pattern = userPattern && userPattern.toString();
const results = await this.releaser.release(pattern ? await this.workspace.byPattern(pattern) : undefined);
// @todo: decide about the output
// eslint-disable-next-line no-console
console.log('ReleaserCmd -> render -> results', results);
results.forEach((
result // eslint-disable-next-line no-console
) => console.log('result', `Env: ${result.env}\nResult: ${JSON.stringify(result.res, undefined, 2)}`));
return <Color cyan>compiled {results.length} components successfully</Color>;
}
}
6 changes: 4 additions & 2 deletions src/extensions/workspace/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class Workspace implements ComponentHost {
/**
* list all workspace components.
*/
async list() {
async list(): Promise<Component[]> {
const consumerComponents = await this.componentList.getAuthoredAndImportedFromFS();
return this.transformLegacyComponents(consumerComponents);
}
Expand Down Expand Up @@ -158,7 +158,9 @@ export default class Workspace implements ComponentHost {
// @gilad needs to implment on variants
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async byPattern(pattern: string): Promise<Component[]> {
return [];
// @todo: this is a naive implementation, replace it with a real one.
const all = await this.list();
return all.filter(c => c.id.toString() === pattern);
}

/**
Expand Down