-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(generate): use tsconfig from shared nodecg-io-tsconfig package
- Loading branch information
Showing
2 changed files
with
16 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,18 @@ | ||
import { GenerationOptions } from "./prompt"; | ||
import { writeBundleFile } from "./utils"; | ||
|
||
const defaultTsConfigJson = { | ||
compilerOptions: { | ||
target: "es2019", | ||
sourceMap: true, | ||
lib: ["es2019"], | ||
alwaysStrict: true, | ||
forceConsistentCasingInFileNames: true, | ||
noFallthroughCasesInSwitch: true, | ||
noImplicitAny: true, | ||
noImplicitReturns: true, | ||
noImplicitThis: true, | ||
strictNullChecks: true, | ||
skipLibCheck: true, | ||
module: "CommonJS", | ||
types: ["node"], | ||
}, | ||
}; | ||
|
||
/** | ||
* Generates a tsconfig.json for a bundle if the language was set to typescript. | ||
*/ | ||
export async function genTsConfig(opts: GenerationOptions): Promise<void> { | ||
// Only TS needs its tsconfig.json compiler configuration | ||
if (opts.language === "typescript") { | ||
await writeBundleFile(defaultTsConfigJson, opts.bundlePath, "tsconfig.json"); | ||
await writeBundleFile( | ||
{ | ||
extends: "nodecg-io-tsconfig", | ||
}, | ||
opts.bundlePath, | ||
"tsconfig.json", | ||
); | ||
} | ||
} |