From 9655012c1b163df514f9fb57f2adfe591646c5f3 Mon Sep 17 00:00:00 2001 From: Lucas Santos Date: Wed, 29 Jan 2025 20:54:56 +0100 Subject: [PATCH 1/8] feat(node): add config for node.js with TypeScript --- bases/node-ts.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 bases/node-ts.json diff --git a/bases/node-ts.json b/bases/node-ts.json new file mode 100644 index 0000000..b1ba484 --- /dev/null +++ b/bases/node-ts.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Node with TypeScript", + "_version": "23.6.0", + "compilerOptions": { + "lib": [ + "es2024" + ], + "module": "node16", + "target": "es2024", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "moduleResolution": "node16", + "erasableSyntaxOnly": true + } +} From 52dc4d4eff0a96696b24088229148978945984dd Mon Sep 17 00:00:00 2001 From: Lucas Santos Date: Wed, 29 Jan 2025 20:58:06 +0100 Subject: [PATCH 2/8] docs(node): add ts 5.8 docs --- bases/node-ts.json | 3 ++- readme-extras/node-ts.md | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 readme-extras/node-ts.md diff --git a/bases/node-ts.json b/bases/node-ts.json index b1ba484..4e0a4bd 100644 --- a/bases/node-ts.json +++ b/bases/node-ts.json @@ -1,6 +1,7 @@ { "$schema": "https://json.schemastore.org/tsconfig", - "display": "Node with TypeScript", + "display": "Node with TypeScript (TS >=5.8 ONLY)", + "docs": "https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option", "_version": "23.6.0", "compilerOptions": { "lib": [ diff --git a/readme-extras/node-ts.md b/readme-extras/node-ts.md new file mode 100644 index 0000000..e4be527 --- /dev/null +++ b/readme-extras/node-ts.md @@ -0,0 +1,2 @@ +> **NOTE**: This `tsconfig` base will **only** work in TypeScript versions 5.8 +> and beyond. (See [announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option)) From 6d29fd0bc46377335559088795dae62e1f20376f Mon Sep 17 00:00:00 2001 From: Lucas Santos Date: Wed, 29 Jan 2025 21:07:18 +0100 Subject: [PATCH 3/8] fix(node): remove libs from array --- bases/node-ts.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/bases/node-ts.json b/bases/node-ts.json index 4e0a4bd..556eb21 100644 --- a/bases/node-ts.json +++ b/bases/node-ts.json @@ -4,9 +4,6 @@ "docs": "https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option", "_version": "23.6.0", "compilerOptions": { - "lib": [ - "es2024" - ], "module": "node16", "target": "es2024", "strict": true, From 7571d31a3f82deef58c740d236d83868aad9bcd0 Mon Sep 17 00:00:00 2001 From: Lucas Santos Date: Fri, 7 Feb 2025 01:44:41 +0100 Subject: [PATCH 4/8] fix(node-ts): update to only include the syntax --- bases/node-ts.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bases/node-ts.json b/bases/node-ts.json index 556eb21..c7aeaad 100644 --- a/bases/node-ts.json +++ b/bases/node-ts.json @@ -4,12 +4,6 @@ "docs": "https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option", "_version": "23.6.0", "compilerOptions": { - "module": "node16", - "target": "es2024", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "moduleResolution": "node16", "erasableSyntaxOnly": true } } From 474f7dec015397623b88408911e6c908637127d2 Mon Sep 17 00:00:00 2001 From: Lucas Santos Date: Fri, 7 Feb 2025 01:48:20 +0100 Subject: [PATCH 5/8] docs: add more explanations on extends --- readme-extras/node-ts.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/readme-extras/node-ts.md b/readme-extras/node-ts.md index e4be527..f60d5ce 100644 --- a/readme-extras/node-ts.md +++ b/readme-extras/node-ts.md @@ -1,2 +1,12 @@ > **NOTE**: This `tsconfig` base will **only** work in TypeScript versions 5.8 > and beyond. (See [announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option)) + +# Important (read it before usage) + +This file is meant to be used in conjunction with other Node.js configurations, you can do so by extending multiple files in the `extends` clause of your `tsconfig.json`: + +```json +{ + "extends": ["@tsconfig/node22/tsconfig.json", "@tsconfig/node-ts/tsconfig.json"] +} +``` From 749742fdfae1753e23862d0054d62ac004c8cf5c Mon Sep 17 00:00:00 2001 From: Lucas Santos Date: Fri, 7 Feb 2025 01:49:23 +0100 Subject: [PATCH 6/8] fix: remove title --- readme-extras/node-ts.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/readme-extras/node-ts.md b/readme-extras/node-ts.md index f60d5ce..782c9a0 100644 --- a/readme-extras/node-ts.md +++ b/readme-extras/node-ts.md @@ -1,12 +1,12 @@ > **NOTE**: This `tsconfig` base will **only** work in TypeScript versions 5.8 > and beyond. (See [announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option)) -# Important (read it before usage) - -This file is meant to be used in conjunction with other Node.js configurations, you can do so by extending multiple files in the `extends` clause of your `tsconfig.json`: - -```json -{ - "extends": ["@tsconfig/node22/tsconfig.json", "@tsconfig/node-ts/tsconfig.json"] -} -``` +> **Important (read it before usage)** +> +> This file is meant to be used in conjunction with other Node.js configurations, you can do so by extending multiple files in the `extends` clause of your `tsconfig.json`: +> +> ```json +> { +> "extends": ["@tsconfig/node22/tsconfig.json", "@tsconfig/node-ts/tsconfig.json"] +> } +> ``` From a557e4fbfc318b41fd921ea2960f11d7a293a946 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Fri, 7 Feb 2025 11:24:22 +0000 Subject: [PATCH 7/8] Copy changes --- README.md | 57 +++++++++++++++++++++++++++++++ readme-extras/node-ts.md | 19 +++++------ scripts/update-markdown-readme.ts | 22 ++++++++---- 3 files changed, 81 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 16223dd..f58e0ac 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/recommended/tsconfig.json" ``` + ### Bun tsconfig.json Install: @@ -67,6 +68,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/bun/tsconfig.json" ``` + ### Create React App tsconfig.json Install: @@ -81,6 +83,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/create-react-app/tsconfig.json" ``` + ### Cypress tsconfig.json Install: @@ -95,6 +98,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/cypress/tsconfig.json" ``` + ### Deno tsconfig.json Install: @@ -109,6 +113,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/deno/tsconfig.json" ``` + ### Docusaurus v2 tsconfig.json Install: @@ -124,7 +129,10 @@ Add to your `tsconfig.json`: "extends": "@tsconfig/docusaurus/tsconfig.json" ``` + + > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. + ### Ember tsconfig.json Install: @@ -140,7 +148,10 @@ Add to your `tsconfig.json`: "extends": "@tsconfig/ember/tsconfig.json" ``` + + > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. + ### Next.js tsconfig.json Install: @@ -155,6 +166,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/next/tsconfig.json" ``` + ### Node LTS (22) tsconfig.json Install: @@ -169,6 +181,27 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node-lts/tsconfig.json" ``` + +### Node with TypeScript (TS >=5.8 ONLY) tsconfig.json + +Install: + +```sh +npm install --save-dev @tsconfig/node-ts +yarn add --dev @tsconfig/node-ts +``` + + +> This base require TypeScript 5.8+ (See [announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option)) + +This file is meant to be used in conjunction with other Node.js configurations, you can do so by extending multiple files in the `extends` clause of your `tsconfig.json`: + +```json +{ + "extends": ["@tsconfig/node22/tsconfig.json", "@tsconfig/node-ts/tsconfig.json"] +} +``` + ### Node 10 tsconfig.json Install: @@ -183,6 +216,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node10/tsconfig.json" ``` + ### Node 12 tsconfig.json Install: @@ -197,6 +231,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node12/tsconfig.json" ``` + ### Node 14 tsconfig.json Install: @@ -211,6 +246,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node14/tsconfig.json" ``` + ### Node 16 tsconfig.json Install: @@ -225,6 +261,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node16/tsconfig.json" ``` + ### Node 17 tsconfig.json Install: @@ -239,6 +276,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node17/tsconfig.json" ``` + ### Node 18 tsconfig.json Install: @@ -253,6 +291,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node18/tsconfig.json" ``` + ### Node 19 tsconfig.json Install: @@ -267,6 +306,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node19/tsconfig.json" ``` + ### Node 20 tsconfig.json Install: @@ -281,6 +321,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node20/tsconfig.json" ``` + ### Node 21 tsconfig.json Install: @@ -295,6 +336,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node21/tsconfig.json" ``` + ### Node 22 tsconfig.json Install: @@ -309,6 +351,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node22/tsconfig.json" ``` + ### Node 23 tsconfig.json Install: @@ -323,6 +366,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/node23/tsconfig.json" ``` + ### Nuxt tsconfig.json Install: @@ -338,7 +382,10 @@ Add to your `tsconfig.json`: "extends": "@tsconfig/nuxt/tsconfig.json" ``` + + > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. + ### React Native tsconfig.json Install: @@ -353,6 +400,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/react-native/tsconfig.json" ``` + ### Remix tsconfig.json Install: @@ -368,7 +416,10 @@ Add to your `tsconfig.json`: "extends": "@tsconfig/remix/tsconfig.json" ``` + + > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. + ### Strictest tsconfig.json Install: @@ -383,6 +434,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/strictest/tsconfig.json" ``` + ### Svelte tsconfig.json Install: @@ -398,7 +450,10 @@ Add to your `tsconfig.json`: "extends": "@tsconfig/svelte/tsconfig.json" ``` + + > **NOTE**: After `@tsconfig/svelte@2.0.0`, you should add `/// ` to a `d.ts` or a `index.ts`(entry) file to prevent typescript error. + ### Taro tsconfig.json Install: @@ -413,6 +468,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/taro/tsconfig.json" ``` + ### Vite React tsconfig.json Install: @@ -428,6 +484,7 @@ Add to your `tsconfig.json`: "extends": "@tsconfig/vite-react/tsconfig.json" ``` + ### What about combined configs? diff --git a/readme-extras/node-ts.md b/readme-extras/node-ts.md index 782c9a0..993508c 100644 --- a/readme-extras/node-ts.md +++ b/readme-extras/node-ts.md @@ -1,12 +1,9 @@ -> **NOTE**: This `tsconfig` base will **only** work in TypeScript versions 5.8 -> and beyond. (See [announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option)) +> This base require TypeScript 5.8+ (See [announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option)) -> **Important (read it before usage)** -> -> This file is meant to be used in conjunction with other Node.js configurations, you can do so by extending multiple files in the `extends` clause of your `tsconfig.json`: -> -> ```json -> { -> "extends": ["@tsconfig/node22/tsconfig.json", "@tsconfig/node-ts/tsconfig.json"] -> } -> ``` +This file is meant to be used in conjunction with other Node.js configurations, you can do so by extending multiple files in the `extends` clause of your `tsconfig.json`: + +```json +{ + "extends": ["@tsconfig/node22/tsconfig.json", "@tsconfig/node-ts/tsconfig.json"] +} +``` diff --git a/scripts/update-markdown-readme.ts b/scripts/update-markdown-readme.ts index 0ce1eac..64c2eae 100644 --- a/scripts/update-markdown-readme.ts +++ b/scripts/update-markdown-readme.ts @@ -32,19 +32,29 @@ npm install --save-dev @tsconfig/${name} yarn add --dev @tsconfig/${name} \`\`\` -Add to your \`tsconfig.json\`: +` + + const hasReadmeExtra = await Deno.stat(`./readme-extras/${name}.md`).then(() => true).catch(() => false) + const readmeExtra = hasReadmeExtra ? (await Deno.readTextFile(`./readme-extras/${name}.md`)).trim() : "" + + const defaultInstructions = `Add to your \`tsconfig.json\`: \`\`\`json "extends": "@tsconfig/${name}/tsconfig.json" \`\`\` + ` - try { - const readmeExtra = (await Deno.readTextFile(`./readme-extras/${name}.md`)).trim() + if (readmeExtra) { + if (!readmeExtra.includes("extends")) { + center += defaultInstructions + "\n" + } - if (readmeExtra) - center += `\n${readmeExtra}\n` - } catch (error) {} + center += `\n${readmeExtra}\n\n` + + } else { + center += defaultInstructions + } }; const startMarker ="" From ac64db9123a44915c68881b6f4cb983f2343cc8b Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Fri, 14 Feb 2025 17:14:40 +0000 Subject: [PATCH 8/8] Add verbatim module syntax --- bases/node-ts.json | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bases/node-ts.json b/bases/node-ts.json index c7aeaad..c41df67 100644 --- a/bases/node-ts.json +++ b/bases/node-ts.json @@ -1,9 +1,10 @@ { - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Node with TypeScript (TS >=5.8 ONLY)", - "docs": "https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option", - "_version": "23.6.0", - "compilerOptions": { - "erasableSyntaxOnly": true - } + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Node with TypeScript (TS >=5.8 ONLY)", + "docs": "https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option", + "_version": "23.6.0", + "compilerOptions": { + "erasableSyntaxOnly": true, + "verbatimModuleSyntax": true + } }