Files
test-repo/tests/integration/env.js
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
849 B
JavaScript
Raw Normal View History

import path from "node:path";
import createEsmUtils from "esm-utils";
const { __dirname, require } = createEsmUtils(import.meta);
2020-01-15 22:55:08 +08:00
const isProduction = process.env.NODE_ENV === "production";
const { PRETTIER_DIR } = process.env;
const { bin } = require(path.join(PRETTIER_DIR, "package.json"));
2025-04-23 23:42:19 +08:00
const prettierCliEntry = path.join(
PRETTIER_DIR,
2020-01-15 22:55:08 +08:00
typeof bin === "object" ? bin.prettier : bin,
);
2023-12-05 14:39:11 +08:00
const prettierMainEntry = isProduction
? path.join(PRETTIER_DIR, "./index.mjs")
: path.join(PRETTIER_DIR, "./src/index.js");
2020-01-15 22:55:08 +08:00
const projectRoot = path.join(__dirname, "../..");
2025-04-23 23:42:19 +08:00
const prettierCliMockableEntry = isProduction
? path.join(PRETTIER_DIR, "./internal/legacy-cli.mjs")
: path.join(PRETTIER_DIR, "./src/cli/index.js");
export {
isProduction,
prettierCliEntry,
prettierCliMockableEntry,
prettierMainEntry,
projectRoot,
};