Minor refactor (#13095)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-07-13 14:10:22 +08:00
1 parent 692f86ee36
commit 79b44ff7b0
1 file changed
+3 -5
+3 -5
View File
@@ -2,9 +2,7 @@ import { workerData, parentPort } from "node:worker_threads";
import fs from "node:fs";
import path from "node:path";
import url from "node:url";
import createEsmUtils from "esm-utils";
const { __dirname, require } = createEsmUtils(import.meta);
import { cosmiconfig } from "cosmiconfig";
async function run() {
const { options, thirdParty: thirdPartyModuleFile, prettierCli } = workerData;
@@ -48,9 +46,9 @@ async function run() {
thirdParty.getStdin = async () => options.input || "";
thirdParty.isCI = () => Boolean(options.ci);
thirdParty.cosmiconfig = (moduleName, options) =>
require("cosmiconfig").cosmiconfig(moduleName, {
cosmiconfig(moduleName, {
...options,
stopDir: path.join(__dirname, "cli"),
stopDir: url.fileURLToPath(new URL("./cli", import.meta.url)),
});
thirdParty.findParentDir = () => process.cwd();