Skip to content

Commit 3c4b0fd

Browse files
authored
chore: replace execa with tinyexec and Node's child_process.spawnSync (#4134)
* chore(utils): replace `execa` with `tinyexec` * chore(commitlint): replace `execa` with `tinyexec` * chore(read): replace `execa` with `tinyexec` * chore(travis-cli): replace `execa` with `tinyexec` * chore(prompt-cli): replace `execa` with `tinyexec` * chore(cli): replace `execa` with `tinyexec` * chore(prompt-cli): fix the test * chore(test): replace `execa` with `tinyexec` * chore(rules): replace `execa` with a native implementation * chore: fix the test
1 parent c10c07f commit 3c4b0fd

22 files changed

+417
-329
lines changed

@alias/commitlint/cli.test.js

+11-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {createRequire} from 'module';
33
import path from 'path';
44
import {fileURLToPath} from 'url';
55

6-
import {execa} from 'execa';
6+
import {x} from 'tinyexec';
77
import {fix} from '@commitlint/test';
88

99
const require = createRequire(import.meta.url);
@@ -13,12 +13,17 @@ const __dirname = path.resolve(fileURLToPath(import.meta.url), '..');
1313
const bin = require.resolve('./cli.js');
1414

1515
function cli(args, options, input) {
16-
const c = execa(bin, args, {
17-
cwd: options.cwd,
18-
env: options.env,
19-
input: input,
16+
const result = x(bin, args, {
17+
nodeOptions: {
18+
cwd: options.cwd,
19+
env: options.env,
20+
},
2021
});
21-
return c.catch((err) => err);
22+
23+
result.process.stdin.write(input);
24+
result.process.stdin.end();
25+
26+
return result;
2227
}
2328

2429
const fixBootstrap = (fixture) => fix.bootstrap(fixture, __dirname);

@alias/commitlint/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"devDependencies": {
4343
"@commitlint/test": "^19.0.0",
4444
"@commitlint/utils": "^19.0.0",
45-
"execa": "^8.0.1"
45+
"tinyexec": "^0.3.0"
4646
},
4747
"gitHead": "70f7f4688b51774e7ac5e40e896cdaa3f132b2bc"
4848
}

@commitlint/cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"@commitlint/load": "^19.4.0",
5454
"@commitlint/read": "^19.4.0",
5555
"@commitlint/types": "^19.0.3",
56-
"execa": "^8.0.1",
56+
"tinyexec": "^0.3.0",
5757
"yargs": "^17.0.0"
5858
},
5959
"gitHead": "70f7f4688b51774e7ac5e40e896cdaa3f132b2bc"

0 commit comments

Comments
 (0)