From 2783fe32f427ffa19abde15fb6bfcfd62dc32feb Mon Sep 17 00:00:00 2001 From: port dev <108868128+portdeveloper@users.noreply.github.com> Date: Sat, 26 Oct 2024 03:04:40 +0300 Subject: [PATCH] Add template for tsconfig.json --- .changeset/soft-shrimps-pull.md | 5 +++ templates/base/packages/nextjs/tsconfig.json | 28 ------------ .../nextjs/tsconfig.json.template.mjs | 45 +++++++++++++++++++ 3 files changed, 50 insertions(+), 28 deletions(-) create mode 100644 .changeset/soft-shrimps-pull.md delete mode 100644 templates/base/packages/nextjs/tsconfig.json create mode 100644 templates/base/packages/nextjs/tsconfig.json.template.mjs diff --git a/.changeset/soft-shrimps-pull.md b/.changeset/soft-shrimps-pull.md new file mode 100644 index 000000000..43521e9f8 --- /dev/null +++ b/.changeset/soft-shrimps-pull.md @@ -0,0 +1,5 @@ +--- +"create-eth": patch +--- + +templates: added template for tsconfig.json file diff --git a/templates/base/packages/nextjs/tsconfig.json b/templates/base/packages/nextjs/tsconfig.json deleted file mode 100644 index 69290112d..000000000 --- a/templates/base/packages/nextjs/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "target": "es2020", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "Bundler", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "paths": { - "~~/*": ["./*"] - }, - "plugins": [ - { - "name": "next" - } - ] - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"] -} diff --git a/templates/base/packages/nextjs/tsconfig.json.template.mjs b/templates/base/packages/nextjs/tsconfig.json.template.mjs new file mode 100644 index 000000000..ac8fb1bee --- /dev/null +++ b/templates/base/packages/nextjs/tsconfig.json.template.mjs @@ -0,0 +1,45 @@ +import { withDefaults } from '../../../utils.js' + +const contents = ({ extraPaths, extraPlugins, extraCompilerOptions, extraInclude, extraExclude }) => `{ + "compilerOptions": { + "target": "es2020", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "~~/*": ["./*"]${extraPaths[0] ? `,${extraPaths[0]}` : ''} + }, + "plugins": [ + { + "name": "next" + }${extraPlugins[0] ? `,${extraPlugins[0]}` : ''} + ]${extraCompilerOptions[0] ? `,${extraCompilerOptions[0]}` : ''} + }, + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts"${extraInclude[0] ? `,${extraInclude[0]}` : ''} + ], + "exclude": [ + "node_modules"${extraExclude[0] ? `,${extraExclude[0]}` : ''} + ] +}` + +export default withDefaults(contents, { + extraPaths: '', + extraPlugins: '', + extraCompilerOptions: '', + extraInclude: '', + extraExclude: '' +})