Skip to content

Commit 6e1495e

Browse files
authored
Use get-tsconfig to resolve tsconfig settings (#122)
1 parent 8a36324 commit 6e1495e

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@pnpm/types": "^9.4.2",
5050
"chalk": "^5.3.0",
5151
"fs-extra": "^11.2.0",
52+
"get-tsconfig": "^4.8.1",
5253
"glob": "^10.4.5",
5354
"outdent": "^0.8.0",
5455
"pnpm_lockfile_file_v8": "npm:@pnpm/lockfile-file@8",

pnpm-lock.yaml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/output/get-build-output-dir.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import fs from "fs-extra";
1+
import { getTsconfig } from "get-tsconfig";
22
import path from "node:path";
33
import outdent from "outdent";
44
import { useConfig } from "../config";
55
import { useLogger } from "../logger";
6-
import { readTypedJson } from "../utils";
76

87
export async function getBuildOutputDir(targetPackageDir: string) {
98
const config = useConfig();
@@ -16,14 +15,12 @@ export async function getBuildOutputDir(targetPackageDir: string) {
1615

1716
const tsconfigPath = path.join(targetPackageDir, config.tsconfigPath);
1817

19-
if (fs.existsSync(tsconfigPath)) {
20-
log.debug("Found tsconfig at:", config.tsconfigPath);
18+
const tsconfig = getTsconfig(tsconfigPath);
2119

22-
const tsconfig = await readTypedJson<{
23-
compilerOptions?: { outDir?: string };
24-
}>(tsconfigPath);
20+
if (tsconfig) {
21+
log.debug("Found tsconfig at:", tsconfig.path);
2522

26-
const outDir = tsconfig.compilerOptions?.outDir;
23+
const outDir = tsconfig.config.compilerOptions?.outDir;
2724

2825
if (outDir) {
2926
return path.join(targetPackageDir, outDir);

0 commit comments

Comments
 (0)