Skip to content

Commit 1b9bae4

Browse files
authored
deps: upgrade yargs to v18 (#593)
1 parent b05ee75 commit 1b9bae4

3 files changed

Lines changed: 45 additions & 307 deletions

File tree

bin/index.spec.ts

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
import { spawn } from 'node:child_process';
1+
import { execSync, spawn } from 'node:child_process';
22
import fs from 'node:fs';
3-
import os from 'node:os';
43
import path from 'node:path';
54
import readline from 'node:readline';
65

76
import { subscribeSpyTo } from '@hirez_io/observer-spy';
87
import { sendCtrlC, spawnWithWrapper } from 'ctrlc-wrapper';
9-
import { build } from 'esbuild';
108
import Rx from 'rxjs';
119
import { map } from 'rxjs/operators';
1210
import stringArgv from 'string-argv';
13-
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
11+
import { beforeAll, describe, expect, it } from 'vitest';
1412

1513
import { escapeRegExp } from '../lib/utils.js';
1614

@@ -24,37 +22,20 @@ const createKillMessage = (prefix: string, signal: 'SIGTERM' | 'SIGINT' | string
2422
return new RegExp(`${escapeRegExp(prefix)} exited with code ${map[signal] ?? signal}`);
2523
};
2624

27-
let tmpDir: string;
28-
29-
beforeAll(async () => {
30-
// Build 'concurrently' and store it in a temporary directory
31-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'concurrently-'));
32-
await build({
33-
entryPoints: [path.join(__dirname, 'index.ts')],
34-
platform: 'node',
35-
bundle: true,
36-
// it doesn't seem like esbuild is able to change a CJS module to ESM, so target CJS instead.
37-
// https://github.com/evanw/esbuild/issues/1921
38-
format: 'cjs',
39-
outfile: path.join(tmpDir, 'concurrently.cjs'),
40-
});
41-
fs.copyFileSync(path.join(__dirname, '..', 'package.json'), path.join(tmpDir, 'package.json'));
42-
}, 8000);
43-
44-
afterAll(() => {
45-
// Remove the temporary directory where 'concurrently' was stored
46-
if (tmpDir) {
47-
fs.rmSync(tmpDir, { recursive: true });
48-
}
49-
});
25+
const concurrentlyBin = path.join(__dirname, '..', 'dist', 'bin', 'index.js');
26+
27+
// Build once, then spawn the real CLI without a shell (see open-cli-tools/concurrently#346).
28+
beforeAll(() => {
29+
execSync('pnpm run build', { cwd: path.join(__dirname, '..'), stdio: 'pipe' });
30+
}, 20_000);
5031

5132
/**
5233
* Creates a child process running 'concurrently' with the given args.
5334
* Returns observables for its combined stdout + stderr output, close events, pid, and stdin stream.
5435
*/
5536
const run = (args: string, ctrlcWrapper?: boolean) => {
5637
const spawnFn = ctrlcWrapper ? spawnWithWrapper : spawn;
57-
const child = spawnFn('node', [path.join(tmpDir, 'concurrently.cjs'), ...stringArgv(args)], {
38+
const child = spawnFn('node', [concurrentlyBin, ...stringArgv(args)], {
5839
cwd: __dirname,
5940
env: {
6041
...process.env,

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"shell-quote": "1.8.4",
5757
"supports-color": "10.2.2",
5858
"tree-kill": "1.2.2",
59-
"yargs": "17.7.2"
59+
"yargs": "18.0.0"
6060
},
6161
"devDependencies": {
6262
"@eslint/js": "^10.0.1",
@@ -67,7 +67,6 @@
6767
"@vitest/coverage-v8": "^4.1.6",
6868
"@vitest/eslint-plugin": "^1.6.17",
6969
"ctrlc-wrapper": "^0.0.5",
70-
"esbuild": "~0.28.0",
7170
"eslint": "^10.4.0",
7271
"eslint-config-flat-gitignore": "^2.3.0",
7372
"eslint-config-prettier": "^10.1.8",

0 commit comments

Comments
 (0)