Skip to content

Commit

Permalink
Change tsconfig templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Didas-git committed Dec 7, 2023
1 parent 3766b70 commit 7b91984
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/create/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lilybird/create",
"version": "0.1.7",
"version": "0.1.8",
"description": "Create a new template bot using lilybird",
"main": "./dist/index.js",
"author": "DidaS",
Expand Down
6 changes: 3 additions & 3 deletions packages/create/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ const type = await new Select({
}
}).run();

let config: null | "strict" | "lilybird" = null;
let config: null | "strict" | "normal" = null;
const devDeps: Array<string> = [];

if (type === "ts") {
devDeps.push("typescript");
config = await new Select({
message: "What typescript config style would you like to use?",
choices: [
{ name: "Non-strict", value: "normal" },
{ name: "Strict", value: "strict" },
{ name: "Super Strict", value: "lilybird" },
{ name: "My own", value: null }
{ name: "None", value: null }
],
result(name: string) {
return this.find(name).value;
Expand Down
7 changes: 2 additions & 5 deletions packages/create/src/templates.cts
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,31 @@ ${pm} run build

export function generateTSConfig(type: string, pm: string): string {
const temp: {
extends: string | undefined,
compilerOptions: {
target: string,
module: string,
moduleResolution: string,
outDir: string,
baseUrl: string,
strict: true,
strict: boolean,
types: Array<string>
},
include: Array<string>
} = {
extends: undefined,
compilerOptions: {
target: "ESNext",
module: "Node16",
moduleResolution: "Node16",
outDir: "dist",
baseUrl: ".",
strict: true,
strict: type === "strict",
types: ["./globals.d.ts"]
},
include: ["src/**/*"]
};

if (pm === "bun") temp.compilerOptions.types.push("bun-types");
else temp.compilerOptions.types.push("@types/node");
if (type === "lilybird") temp.extends = "lilybird/tsconfig.json";

return JSON.stringify(temp, null, 4);
}
Expand Down

0 comments on commit 7b91984

Please sign in to comment.