Skip to content

Commit aabdaaf

Browse files
authored
allow custom tsconfig file (#14)
1 parent ad033ab commit aabdaaf

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

package-lock.json

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

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@
3333
},
3434
"peerDependencies": {
3535
"typescript": "*"
36+
},
37+
"prettier":{
38+
"semi": true
3639
}
3740
}

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export type Config = Partial<{
22
outDir: string;
3+
tsConfigFile?: string;
34
esbuild: {
45
entryPoints?: string[];
56
minify?: boolean;

src/index.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ import { Config, readUserConfig } from "./config";
99

1010
const cwd = process.cwd();
1111

12-
function getTSConfig() {
13-
const tsConfigFile = ts.findConfigFile(
14-
cwd,
15-
ts.sys.fileExists,
16-
"tsconfig.json"
17-
);
12+
function getTSConfig(_tsConfigFile = "tsconfig.json") {
13+
const tsConfigFile = ts.findConfigFile(cwd, ts.sys.fileExists, _tsConfigFile);
1814
if (!tsConfigFile) {
1915
throw new Error(`tsconfig.json not found in the current directory! ${cwd}`);
2016
}
@@ -50,7 +46,7 @@ function esBuildSourceMapOptions(tsConfig: TSConfig) {
5046
}
5147

5248
function getBuildMetadata(userConfig: Config) {
53-
const { tsConfig, tsConfigFile } = getTSConfig();
49+
const { tsConfig, tsConfigFile } = getTSConfig(userConfig.tsConfigFile);
5450

5551
const outDir = userConfig.outDir || tsConfig.options.outDir || "dist";
5652

0 commit comments

Comments
 (0)