Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit 298c7cb

Browse files
authored
fix(generate): use tsconfig from shared nodecg-io-tsconfig package
1 parent 472d112 commit 298c7cb

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

src/generate/packageJson.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,20 @@ async function genDependencies(opts: GenerationOptions, serviceDeps: Dependency[
6969
* @param nodecgDir the directory in which nodecg is installed. Used to get nodecg version which will be used by nodecg dependency.
7070
*/
7171
async function genTypeScriptDependencies(opts: GenerationOptions): Promise<Dependency[]> {
72-
logger.debug(`Fetching latest ${opts.nodeeCGTypingsPackage}, typescript and @types/node versions...`);
73-
const [nodecgVersion, latestNodeTypes, latestTypeScript] = await Promise.all([
72+
logger.debug(
73+
`Fetching latest ${opts.nodeeCGTypingsPackage}, nodecg-io-tsconfig, typescript and @types/node versions...`,
74+
);
75+
const [nodecgVersion, latestTsConfig, latestTypeScript, latestNodeTypes] = await Promise.all([
7476
getLatestPackageVersion(opts.nodeeCGTypingsPackage),
75-
getLatestPackageVersion("@types/node"),
77+
getLatestPackageVersion("nodecg-io-tsconfig"),
7678
getLatestPackageVersion("typescript"),
79+
getLatestPackageVersion("@types/node"),
7780
]);
7881

7982
return [
80-
[opts.nodeeCGTypingsPackage, `^${nodecgVersion}`],
8183
["@types/node", `^${latestNodeTypes}`],
84+
[opts.nodeeCGTypingsPackage, `^${nodecgVersion}`],
85+
["nodecg-io-tsconfig", `^${latestTsConfig}`],
8286
["typescript", `^${latestTypeScript}`],
8387
];
8488
}
@@ -90,7 +94,7 @@ async function genTypeScriptDependencies(opts: GenerationOptions): Promise<Depen
9094
*/
9195
function genScripts(opts: GenerationOptions) {
9296
if (opts.language !== "typescript") {
93-
// For JS we don't need any scripts to build anythiing.
97+
// For JS we don't need any scripts to build anything.
9498
return undefined;
9599
}
96100

src/generate/tsConfig.ts

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
11
import { GenerationOptions } from "./prompt";
22
import { writeBundleFile } from "./utils";
33

4-
const defaultTsConfigJson = {
5-
compilerOptions: {
6-
target: "es2019",
7-
sourceMap: true,
8-
lib: ["es2019"],
9-
alwaysStrict: true,
10-
forceConsistentCasingInFileNames: true,
11-
noFallthroughCasesInSwitch: true,
12-
noImplicitAny: true,
13-
noImplicitReturns: true,
14-
noImplicitThis: true,
15-
strictNullChecks: true,
16-
skipLibCheck: true,
17-
module: "CommonJS",
18-
types: ["node"],
19-
},
20-
};
21-
224
/**
235
* Generates a tsconfig.json for a bundle if the language was set to typescript.
246
*/
257
export async function genTsConfig(opts: GenerationOptions): Promise<void> {
268
// Only TS needs its tsconfig.json compiler configuration
279
if (opts.language === "typescript") {
28-
await writeBundleFile(defaultTsConfigJson, opts.bundlePath, "tsconfig.json");
10+
await writeBundleFile(
11+
{
12+
extends: "nodecg-io-tsconfig",
13+
},
14+
opts.bundlePath,
15+
"tsconfig.json",
16+
);
2917
}
3018
}

0 commit comments

Comments
 (0)