Skip to content

Commit

Permalink
Merge branch 'main' into pnpm-8
Browse files Browse the repository at this point in the history
  • Loading branch information
paescuj committed Oct 19, 2023
2 parents 6f21b8a + 77fbc03 commit c95a841
Show file tree
Hide file tree
Showing 36 changed files with 1,683 additions and 1,146 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- name: Setup pnpm
uses: ./.github/actions/setup-pnpm
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Create release
env:
Expand All @@ -26,12 +26,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org

- name: Setup pnpm
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ jobs:
fail-fast: false
matrix:
node:
- 14
- 16
- 18
- 19
- 20
os:
- name: Ubuntu
version: ubuntu-latest
Expand All @@ -43,7 +42,7 @@ jobs:
version: macOS-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,12 @@ For more details, visit https://github.com/open-cli-tools/concurrently
- `prefix`: the prefix type to use when logging processes output.
Possible values: `index`, `pid`, `time`, `command`, `name`, `none`, or a template (eg `[{time} process: {pid}]`).
Default: the name of the process, or its index if no name is set.
- `prefixColors`: a list of colors as supported by [chalk](https://www.npmjs.com/package/chalk) or `auto` for an automatically picked color.
- `prefixColors`: a list of colors or a string as supported by [chalk](https://www.npmjs.com/package/chalk) and additional style `auto` for an automatically picked color.
If concurrently would run more commands than there are colors, the last color is repeated, unless if the last color value is `auto` which means following colors are automatically picked to vary.
Prefix colors specified per-command take precedence over this list.
- `prefixLength`: how many characters to show when prefixing with `command`. Default: `10`
- `raw`: whether raw mode should be used, meaning strictly process output will
be logged, without any prefixes, coloring or extra stuff.
be logged, without any prefixes, coloring or extra stuff. Can be overriden per command.
- `successCondition`: the condition to consider the run was successful.
If `first`, only the first process to exit will make up the success of the run; if `last`, the last process that exits will determine whether the run succeeds.
Anything else means all processes should exit successfully.
Expand Down Expand Up @@ -376,7 +376,7 @@ const { result } = concurrently(
killOthers: ['failure', 'success'],
restartTries: 3,
cwd: path.resolve(__dirname, 'scripts'),
}
},
);
result.then(success, failure);
```
Expand Down
55 changes: 28 additions & 27 deletions bin/concurrently.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,17 @@ const run = (args: string, ctrlcWrapper?: boolean) => {
});

const exit = Rx.firstValueFrom(
Rx.fromEvent<[number | null, NodeJS.Signals | null]>(child, 'exit').pipe(
map((exit) => {
Rx.fromEvent(child, 'exit').pipe(
map((event) => {
const exit = event as [number | null, NodeJS.Signals | null];
return {
/** The exit code if the child exited on its own. */
code: exit[0],
/** The signal by which the child process was terminated. */
signal: exit[1],
};
})
)
}),
),
);

const getLogLines = async (): Promise<string[]> => {
Expand Down Expand Up @@ -196,9 +197,9 @@ describe('exiting conditions', () => {
// TODO: Flappy value due to race condition, sometimes killed by concurrently (exit code 1),
// sometimes terminated on its own (exit code 0).
// Related issue: https://github.com/open-cli-tools/concurrently/issues/283
isWindows ? '(3221225786|0|1)' : 'SIGINT'
)
)
isWindows ? '(3221225786|0|1)' : 'SIGINT',
),
),
);
});
});
Expand Down Expand Up @@ -232,7 +233,7 @@ describe('--hide', () => {
describe('--group', () => {
it('groups output per process', async () => {
const lines = await run(
'--group "echo foo && node fixtures/sleep.mjs 1 && echo bar" "echo baz"'
'--group "echo foo && node fixtures/sleep.mjs 1 && echo bar" "echo baz"',
).getLogLines();

expect(lines.slice(0, 4)).toEqual([
Expand All @@ -256,7 +257,7 @@ describe('--names', () => {

it('is split using --name-separator arg', async () => {
const lines = await run(
'--names "foo|bar" --name-separator "|" "echo foo" "echo bar"'
'--names "foo|bar" --name-separator "|" "echo foo" "echo bar"',
).getLogLines();

expect(lines).toContainEqual(expect.stringContaining('[foo] foo'));
Expand Down Expand Up @@ -301,50 +302,50 @@ describe('--kill-others', () => {

expect(lines).toContainEqual(expect.stringContaining('[1] exit 0 exited with code 0'));
expect(lines).toContainEqual(
expect.stringContaining('Sending SIGTERM to other processes')
expect.stringContaining('Sending SIGTERM to other processes'),
);
expect(lines).toContainEqual(
expect.stringMatching(
createKillMessage('[0] node fixtures/sleep.mjs 10', 'SIGTERM')
)
createKillMessage('[0] node fixtures/sleep.mjs 10', 'SIGTERM'),
),
);
});
});

it('kills on failure', async () => {
const lines = await run(
'--kill-others "node fixtures/sleep.mjs 10" "exit 1"'
'--kill-others "node fixtures/sleep.mjs 10" "exit 1"',
).getLogLines();

expect(lines).toContainEqual(expect.stringContaining('[1] exit 1 exited with code 1'));
expect(lines).toContainEqual(expect.stringContaining('Sending SIGTERM to other processes'));
expect(lines).toContainEqual(
expect.stringMatching(createKillMessage('[0] node fixtures/sleep.mjs 10', 'SIGTERM'))
expect.stringMatching(createKillMessage('[0] node fixtures/sleep.mjs 10', 'SIGTERM')),
);
});
});

describe('--kill-others-on-fail', () => {
it('does not kill on success', async () => {
const lines = await run(
'--kill-others-on-fail "node fixtures/sleep.mjs 0.5" "exit 0"'
'--kill-others-on-fail "node fixtures/sleep.mjs 0.5" "exit 0"',
).getLogLines();

expect(lines).toContainEqual(expect.stringContaining('[1] exit 0 exited with code 0'));
expect(lines).toContainEqual(
expect.stringContaining('[0] node fixtures/sleep.mjs 0.5 exited with code 0')
expect.stringContaining('[0] node fixtures/sleep.mjs 0.5 exited with code 0'),
);
});

it('kills on failure', async () => {
const lines = await run(
'--kill-others-on-fail "node fixtures/sleep.mjs 10" "exit 1"'
'--kill-others-on-fail "node fixtures/sleep.mjs 10" "exit 1"',
).getLogLines();

expect(lines).toContainEqual(expect.stringContaining('[1] exit 1 exited with code 1'));
expect(lines).toContainEqual(expect.stringContaining('Sending SIGTERM to other processes'));
expect(lines).toContainEqual(
expect.stringMatching(createKillMessage('[0] node fixtures/sleep.mjs 10', 'SIGTERM'))
expect.stringMatching(createKillMessage('[0] node fixtures/sleep.mjs 10', 'SIGTERM')),
);
});
});
Expand All @@ -364,14 +365,14 @@ describe('--handle-input', () => {
expect(exit.code).toBe(0);
expect(lines).toContainEqual(expect.stringContaining('[0] stop'));
expect(lines).toContainEqual(
expect.stringContaining('[0] node fixtures/read-echo.js exited with code 0')
expect.stringContaining('[0] node fixtures/read-echo.js exited with code 0'),
);
});
});

it('forwards input to process --default-input-target', async () => {
const child = run(
'-ki --default-input-target 1 "node fixtures/read-echo.js" "node fixtures/read-echo.js"'
'-ki --default-input-target 1 "node fixtures/read-echo.js" "node fixtures/read-echo.js"',
);
child.log.subscribe((line) => {
if (/\[1\] READING/.test(line)) {
Expand All @@ -384,7 +385,7 @@ describe('--handle-input', () => {
expect(exit.code).toBeGreaterThan(0);
expect(lines).toContainEqual(expect.stringContaining('[1] stop'));
expect(lines).toContainEqual(
expect.stringMatching(createKillMessage('[0] node fixtures/read-echo.js', 'SIGTERM'))
expect.stringMatching(createKillMessage('[0] node fixtures/read-echo.js', 'SIGTERM')),
);
});

Expand All @@ -401,7 +402,7 @@ describe('--handle-input', () => {
expect(exit.code).toBeGreaterThan(0);
expect(lines).toContainEqual(expect.stringContaining('[1] stop'));
expect(lines).toContainEqual(
expect.stringMatching(createKillMessage('[0] node fixtures/read-echo.js', 'SIGTERM'))
expect.stringMatching(createKillMessage('[0] node fixtures/read-echo.js', 'SIGTERM')),
);
});
});
Expand All @@ -410,12 +411,12 @@ describe('--timings', () => {
const defaultTimestampFormatRegex = /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}/;
const processStartedMessageRegex = (index: number, command: string) => {
return new RegExp(
`^\\[${index}] ${command} started at ${defaultTimestampFormatRegex.source}$`
`^\\[${index}] ${command} started at ${defaultTimestampFormatRegex.source}$`,
);
};
const processStoppedMessageRegex = (index: number, command: string) => {
return new RegExp(
`^\\[${index}] ${command} stopped at ${defaultTimestampFormatRegex.source} after (\\d|,)+ms$`
`^\\[${index}] ${command} stopped at ${defaultTimestampFormatRegex.source} after (\\d|,)+ms$`,
);
};

Expand All @@ -429,17 +430,17 @@ describe('--timings', () => {
};
it.each(Object.entries(timingsTests))('%s', async (_, commands) => {
const lines = await run(
`--timings ${commands.map((command) => `"${command}"`).join(' ')}`
`--timings ${commands.map((command) => `"${command}"`).join(' ')}`,
).getLogLines();

// Expect output to contain process start / stop messages for each command
commands.forEach((command, index) => {
const escapedCommand = escapeRegExp(command);
expect(lines).toContainEqual(
expect.stringMatching(processStartedMessageRegex(index, escapedCommand))
expect.stringMatching(processStartedMessageRegex(index, escapedCommand)),
);
expect(lines).toContainEqual(
expect.stringMatching(processStoppedMessageRegex(index, escapedCommand))
expect.stringMatching(processStoppedMessageRegex(index, escapedCommand)),
);
});

Expand Down
6 changes: 3 additions & 3 deletions bin/concurrently.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const args = yargs(argsBeforeSep)
})
.group(
['m', 'n', 'name-separator', 's', 'r', 'no-color', 'hide', 'g', 'timings', 'P'],
'General'
'General',
)
.group(['p', 'c', 'l', 't'], 'Prefix styling')
.group(['i', 'default-input-target'], 'Input handling')
Expand Down Expand Up @@ -229,8 +229,8 @@ concurrently(
timestampFormat: args.timestampFormat,
timings: args.timings,
additionalArguments: args.passthroughArguments ? argsAfterSep : undefined,
}
},
).result.then(
() => process.exit(0),
() => process.exit(1)
() => process.exit(1),
);
2 changes: 1 addition & 1 deletion bin/epilogue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const examplesString = examples
.split('\n')
.map((line) => ` ${line}`)
.join('\n'),
].join('\n\n')
].join('\n\n'),
)
.join('\n\n');

Expand Down
60 changes: 30 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "concurrently",
"version": "8.0.1",
"version": "8.2.2",
"description": "Run commands concurrently",
"main": "index.js",
"types": "dist/src/index.d.ts",
Expand All @@ -10,14 +10,14 @@
"conc": "./dist/bin/concurrently.js"
},
"engines": {
"node": "^14.13.0 || >=16.0.0"
"node": ">=16"
},
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./index.mjs",
"require": "./index.js",
"default": "./index.js",
"types": "./dist/src/index.d.ts"
"default": "./index.js"
},
"./package.json": "./package.json"
},
Expand Down Expand Up @@ -51,44 +51,44 @@
"license": "MIT",
"dependencies": {
"chalk": "^4.1.2",
"date-fns": "^2.29.3",
"date-fns": "^2.30.0",
"lodash": "^4.17.21",
"rxjs": "^7.8.0",
"shell-quote": "^1.8.0",
"spawn-command": "0.0.2-1",
"rxjs": "^7.8.1",
"shell-quote": "^1.8.1",
"spawn-command": "0.0.2",
"supports-color": "^8.1.1",
"tree-kill": "^1.2.2",
"yargs": "^17.7.1"
"yargs": "^17.7.2"
},
"devDependencies": {
"@hirez_io/observer-spy": "^2.2.0",
"@swc/core": "^1.3.42",
"@swc/jest": "^0.2.24",
"@types/jest": "^29.5.0",
"@types/lodash": "^4.14.192",
"@types/node": "^14.18.42",
"@types/shell-quote": "^1.7.1",
"@types/supports-color": "^8.1.1",
"@types/yargs": "^17.0.24",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@swc/core": "^1.3.93",
"@swc/jest": "^0.2.29",
"@types/jest": "^29.5.6",
"@types/lodash": "^4.14.200",
"@types/node": "^16.18.59",
"@types/shell-quote": "^1.7.3",
"@types/supports-color": "^8.1.2",
"@types/yargs": "^17.0.29",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"coveralls-next": "^4.2.0",
"ctrlc-wrapper": "^0.0.4",
"esbuild": "~0.17.14",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^4.2.1",
"esbuild": "~0.19.5",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"husky": "^8.0.3",
"jest": "^29.5.0",
"jest": "^29.7.0",
"jest-create-mock-instance": "^2.0.0",
"lint-staged": "^13.2.0",
"prettier": "^2.8.7",
"lint-staged": "^13.3.0",
"prettier": "^3.0.3",
"safe-publish-latest": "^2.0.0",
"string-argv": "^0.3.1",
"typescript": "~5.0.2"
"string-argv": "^0.3.2",
"typescript": "~5.2.2"
},
"files": [
"dist",
Expand Down
Loading

0 comments on commit c95a841

Please sign in to comment.