Skip to content

Commit add49b2

Browse files
committed
concurrently 7.0 API change
1 parent a33ab16 commit add49b2

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

apps/generator-cli/src/app/services/generator.service.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ describe('GeneratorService', () => {
122122
concurrently.mockImplementation((ec, cfg) => {
123123
executedCommands = ec;
124124
concurrentlyCfg = cfg;
125-
return Promise.resolve();
125+
return {
126+
commands: ec.map(c => ({ name: c })),
127+
result: Promise.resolve(),
128+
};
126129
});
127130
});
128131

apps/generator-cli/src/app/services/generator.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Inject, Injectable } from '@nestjs/common';
22
import { flatten, isString, kebabCase, sortBy, upperFirst } from 'lodash';
33

4-
import concurrently from 'concurrently';
4+
import concurrently, { type CloseEvent } from 'concurrently';
55
import * as path from 'path';
66
import * as fs from 'fs-extra';
77
import * as glob from 'glob';
@@ -94,7 +94,7 @@ export class GeneratorService {
9494
commands.length > 0 &&
9595
(await (async () => {
9696
try {
97-
this.printResult(await concurrently(commands, { maxProcesses: 10 }));
97+
this.printResult(await concurrently(commands, { maxProcesses: 10 }).result);
9898
return true;
9999
} catch (e) {
100100
this.printResult(e);
@@ -111,12 +111,12 @@ export class GeneratorService {
111111
}
112112

113113
private printResult(
114-
res: { command: concurrently.CommandObj; exitCode: number }[]
114+
res: CloseEvent[]
115115
) {
116116
this.logger.log(
117117
sortBy(res, 'command.name')
118118
.map(({ exitCode, command }) => {
119-
const failed = exitCode > 0;
119+
const failed = typeof exitCode === 'string' || exitCode > 0;
120120
return [
121121
chalk[failed ? 'red' : 'green'](command.name),
122122
...(failed ? [chalk.yellow(` ${command.command}\n`)] : []),

0 commit comments

Comments
 (0)