@@ -4,25 +4,28 @@ import { once } from "node:events";
44import { readFileSync } from "node:fs" ;
55import { createRequire } from "node:module" ;
66
7- // glibc distros ship /usr/bin/ldd as a script that never mentions musl;
8- // musl ones either mention it there or lack the glibc runtime header.
97const isMusl = ( ) => {
108 try {
119 return readFileSync ( "/usr/bin/ldd" , "utf8" ) . includes ( "musl" ) ;
1210 } catch {
13- return ! process . report ?. getReport ?. ( ) . header ?. glibcVersionRuntime ;
11+ return ! (
12+ /** @type {Record<string, any> } */ ( process . report ?. getReport ( ) ) ?. [ "header" ] ?. [
13+ "glibcVersionRuntime"
14+ ]
15+ ) ;
1416 }
1517} ;
1618
1719const exe = process . platform === "win32" ? "commit-lint.exe" : "commit-lint" ;
1820const libc = process . platform === "linux" && isMusl ( ) ? "-musl" : "" ;
1921const pkg = `@atypical/commit-${ process . platform } -${ process . arch } ${ libc } ` ;
2022
21- let bin = process . env . COMMIT_LINT_BINARY ;
23+ let bin = process . env [ " COMMIT_LINT_BINARY" ] ;
2224if ( ! bin ) {
2325 try {
2426 bin = createRequire ( import . meta. url ) . resolve ( `${ pkg } /${ exe } ` ) ;
2527 } catch {
28+ // oxlint-disable-next-line no-console
2629 console . error (
2730 `commit-lint: ${ pkg } is not installed ` +
2831 "(unsupported platform, or optional dependencies were skipped)" ,
@@ -35,7 +38,8 @@ const child = spawn(bin, process.argv.slice(2), { stdio: "inherit" });
3538try {
3639 const [ status ] = await once ( child , "exit" ) ;
3740 process . exit ( status ?? 1 ) ;
38- } catch ( error ) {
41+ } catch ( /** @type {any } */ error ) {
42+ // oxlint-disable-next-line no-console
3943 console . error ( `commit-lint: ${ error . message } ` ) ;
4044 process . exit ( 127 ) ;
4145}
0 commit comments