Skip to content

Commit bbc5659

Browse files
committed
fix: remove dependency get-stdin
The get-stdin package has now gone to ESM and can not be used by common js package. This removes the dependency and implements the package.
1 parent 167e465 commit bbc5659

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

@commitlint/cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"@commitlint/load": "^12.1.1",
4949
"@commitlint/read": "^12.1.1",
5050
"@commitlint/types": "^12.1.1",
51-
"get-stdin": "9.0.0",
5251
"lodash": "^4.17.19",
5352
"resolve-from": "5.0.0",
5453
"resolve-global": "1.0.0",

@commitlint/cli/src/cli.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import load from '@commitlint/load';
22
import lint from '@commitlint/lint';
33
import read from '@commitlint/read';
44
import isFunction from 'lodash/isFunction';
5-
import stdin from 'get-stdin';
65
import resolveFrom from 'resolve-from';
76
import resolveGlobal from 'resolve-global';
87
import yargs from 'yargs';
@@ -126,6 +125,22 @@ main({edit: false, ...cli.argv}).catch((err) => {
126125
}, 0);
127126
});
128127

128+
async function stdin() {
129+
let result = '';
130+
131+
if (process.stdin.isTTY) {
132+
return result;
133+
}
134+
135+
process.stdin.setEncoding('utf8');
136+
137+
for await (const chunk of process.stdin) {
138+
result += chunk;
139+
}
140+
141+
return result;
142+
}
143+
129144
async function main(options: CliFlags) {
130145
const raw = options._;
131146
const flags = normalizeFlags(options);

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4945,11 +4945,6 @@ get-port@^5.0.0, get-port@^5.1.1:
49454945
resolved "https://registry.npmjs.org/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193"
49464946
integrity sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==
49474947

4948-
4949-
version "9.0.0"
4950-
resolved "https://registry.npmjs.org/get-stdin/-/get-stdin-9.0.0.tgz#3983ff82e03d56f1b2ea0d3e60325f39d703a575"
4951-
integrity sha512-dVKBjfWisLAicarI2Sf+JuBE/DghV4UzNAVe9yhEJuzeREd3JhOTE9cUaJTeSa77fsbQUK3pcOpJfM59+VKZaA==
4952-
49534948
get-stdin@^4.0.1:
49544949
version "4.0.1"
49554950
resolved "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe"

0 commit comments

Comments
 (0)