Skip to content

Commit 31993de

Browse files
committed
[Chore] Remove dependency on mz
1 parent fcb6f73 commit 31993de

File tree

3 files changed

+10
-50
lines changed

3 files changed

+10
-50
lines changed

package-lock.json

+5-43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
"lodash": "^4.17.21",
5959
"minimist": "^1.2.8",
6060
"mkdirp": "^3.0.1",
61-
"mz": "^2.7.0",
6261
"node-fetch": "^3.3.2",
6362
"prettier": "^3.2.5"
6463
},
@@ -68,7 +67,6 @@
6867
"@types/js-yaml": "^4.0.9",
6968
"@types/minimist": "^1.2.5",
7069
"@types/mkdirp": "^2.0.0",
71-
"@types/mz": "^2.7.8",
7270
"@types/node": "^20.12.7",
7371
"@types/rimraf": "^4.0.5",
7472
"@typescript-eslint/eslint-plugin": "^7.7.0",

src/cli.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22

33
import minimist from 'minimist'
4-
import {readFile, writeFile, existsSync, lstatSync, readdirSync} from 'mz/fs'
4+
import {readFileSync, writeFileSync, existsSync, lstatSync, readdirSync} from 'fs'
55
import * as mkdirp from 'mkdirp'
66
import {glob} from 'glob'
77
import isGlob from 'is-glob'
@@ -114,14 +114,14 @@ async function processDir(argIn: string, argOut: string | undefined, argv: Parti
114114
)
115115
}
116116

117-
async function outputResult(result: string, outputPath: string | undefined): Promise<void> {
117+
function outputResult(result: string, outputPath: string | undefined): void {
118118
if (!outputPath) {
119119
process.stdout.write(result)
120120
} else {
121121
if (!isDir(dirname(outputPath))) {
122122
mkdirp.sync(dirname(outputPath))
123123
}
124-
return await writeFile(outputPath, result)
124+
return writeFileSync(outputPath, result)
125125
}
126126
}
127127

@@ -150,12 +150,12 @@ async function readInput(argIn?: string): Promise<{filename: string | null; cont
150150
}
151151
return {
152152
filename: argIn,
153-
contents: await readFile(resolve(process.cwd(), argIn), 'utf-8'),
153+
contents: readFileSync(resolve(process.cwd(), argIn), 'utf-8'),
154154
}
155155
}
156156

157157
async function readStream(stream: NodeJS.ReadStream): Promise<string> {
158-
const chunks = []
158+
const chunks: Uint8Array[] = []
159159
for await (const chunk of stream) chunks.push(chunk)
160160
return Buffer.concat(chunks).toString('utf8')
161161
}

0 commit comments

Comments
 (0)