From 769ea0bfe78c4f1d413c6b397c604ffe91e39c6a Mon Sep 17 00:00:00 2001 From: Parbez Date: Tue, 7 Jun 2022 16:05:19 +0530 Subject: [PATCH] refactor: move all the config files to root (#8033) --- .eslintrc.json | 12 ++++++ packages/actions/.eslintrc.json | 11 +----- packages/actions/.prettierrc.js | 1 + packages/actions/.prettierrc.json | 8 ---- packages/actions/tsconfig.eslint.json | 19 +--------- packages/actions/tsup.config.ts | 12 ++---- packages/builders/.eslintrc.json | 11 +----- packages/builders/.prettierrc.js | 1 + packages/builders/.prettierrc.json | 8 ---- packages/builders/tsconfig.eslint.json | 19 +--------- packages/builders/tsup.config.ts | 21 +---------- packages/collection/.eslintrc.json | 11 +----- packages/collection/.prettierrc.js | 1 + packages/collection/.prettierrc.json | 8 ---- packages/collection/tsconfig.eslint.json | 19 +--------- packages/collection/tsup.config.ts | 22 +---------- packages/discord.js/.eslintrc.json | 11 ------ packages/docgen/.eslintrc.json | 11 +----- packages/docgen/.prettierrc.js | 1 + packages/docgen/.prettierrc.json | 8 ---- packages/docgen/tsconfig.eslint.json | 19 +--------- packages/docgen/tsup.config.ts | 14 ++----- packages/proxy/.eslintrc.json | 11 +----- packages/proxy/.prettierrc.js | 1 + packages/proxy/.prettierrc.json | 8 ---- packages/proxy/tsconfig.eslint.json | 19 +--------- packages/proxy/tsup.config.ts | 21 +---------- packages/rest/.eslintrc.json | 11 +----- packages/rest/.prettierrc.js | 1 + packages/rest/.prettierrc.json | 8 ---- packages/rest/tsconfig.eslint.json | 19 +--------- packages/rest/tsup.config.ts | 21 +---------- packages/scripts/.eslintrc.json | 11 +----- packages/scripts/.prettierrc.js | 1 + packages/scripts/.prettierrc.json | 8 ---- packages/scripts/tsconfig.eslint.json | 19 +--------- packages/scripts/tsup.config.ts | 12 ++---- packages/voice/.prettierrc.js | 1 + packages/voice/.prettierrc.json | 8 ---- packages/voice/tsconfig.eslint.json | 19 +--------- packages/voice/tsup.config.ts | 21 +---------- tsconfig.eslint.json | 20 ++++++++++ tsup.config.ts | 48 ++++++++++++++++++++++++ 43 files changed, 123 insertions(+), 413 deletions(-) create mode 100644 .eslintrc.json create mode 100644 packages/actions/.prettierrc.js delete mode 100644 packages/actions/.prettierrc.json create mode 100644 packages/builders/.prettierrc.js delete mode 100644 packages/builders/.prettierrc.json create mode 100644 packages/collection/.prettierrc.js delete mode 100644 packages/collection/.prettierrc.json create mode 100644 packages/docgen/.prettierrc.js delete mode 100644 packages/docgen/.prettierrc.json create mode 100644 packages/proxy/.prettierrc.js delete mode 100644 packages/proxy/.prettierrc.json create mode 100644 packages/rest/.prettierrc.js delete mode 100644 packages/rest/.prettierrc.json create mode 100644 packages/scripts/.prettierrc.js delete mode 100644 packages/scripts/.prettierrc.json create mode 100644 packages/voice/.prettierrc.js delete mode 100644 packages/voice/.prettierrc.json create mode 100644 tsconfig.eslint.json create mode 100644 tsup.config.ts diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..0998f03ac --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,12 @@ +{ + "root": true, + "extends": "marine/prettier/node", + "parserOptions": { + "project": "./tsconfig.eslint.json", + "extraFileExtensions": [".mjs"] + }, + "ignorePatterns": ["**/dist/*"], + "env": { + "jest": true + } +} diff --git a/packages/actions/.eslintrc.json b/packages/actions/.eslintrc.json index 0998f03ac..99ef7cec8 100644 --- a/packages/actions/.eslintrc.json +++ b/packages/actions/.eslintrc.json @@ -1,12 +1,3 @@ { - "root": true, - "extends": "marine/prettier/node", - "parserOptions": { - "project": "./tsconfig.eslint.json", - "extraFileExtensions": [".mjs"] - }, - "ignorePatterns": ["**/dist/*"], - "env": { - "jest": true - } + "extends": "../../.eslintrc.json" } diff --git a/packages/actions/.prettierrc.js b/packages/actions/.prettierrc.js new file mode 100644 index 000000000..f004026c7 --- /dev/null +++ b/packages/actions/.prettierrc.js @@ -0,0 +1 @@ +module.exports = require('../../.prettierrc.json'); diff --git a/packages/actions/.prettierrc.json b/packages/actions/.prettierrc.json deleted file mode 100644 index eba3f4077..000000000 --- a/packages/actions/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "printWidth": 120, - "useTabs": true, - "singleQuote": true, - "quoteProps": "as-needed", - "trailingComma": "all", - "endOfLine": "lf" -} diff --git a/packages/actions/tsconfig.eslint.json b/packages/actions/tsconfig.eslint.json index d04d4be3a..4cd64a835 100644 --- a/packages/actions/tsconfig.eslint.json +++ b/packages/actions/tsconfig.eslint.json @@ -1,20 +1,3 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "allowJs": true - }, - "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.mjs", - "**/*.jsx", - "**/*.test.ts", - "**/*.test.js", - "**/*.test.mjs", - "**/*.spec.ts", - "**/*.spec.js", - "**/*.spec.mjs" - ], - "exclude": [] + "extends": "../../tsconfig.eslint.json" } diff --git a/packages/actions/tsup.config.ts b/packages/actions/tsup.config.ts index 4880f4707..be9c98220 100644 --- a/packages/actions/tsup.config.ts +++ b/packages/actions/tsup.config.ts @@ -1,13 +1,9 @@ -import { defineConfig } from 'tsup'; +import { createTsupConfig } from '../../tsup.config'; -export default defineConfig({ - clean: true, - dts: true, - entryPoints: ['src/index.ts', 'src/formatTag/index.ts'], +export default createTsupConfig({ + entry: ['src/index.ts', 'src/formatTag/index.ts'], format: ['cjs'], - minify: true, skipNodeModulesBundle: false, noExternal: ['@actions/core'], - sourcemap: true, - target: 'es2021', + minify: true, }); diff --git a/packages/builders/.eslintrc.json b/packages/builders/.eslintrc.json index 0998f03ac..99ef7cec8 100644 --- a/packages/builders/.eslintrc.json +++ b/packages/builders/.eslintrc.json @@ -1,12 +1,3 @@ { - "root": true, - "extends": "marine/prettier/node", - "parserOptions": { - "project": "./tsconfig.eslint.json", - "extraFileExtensions": [".mjs"] - }, - "ignorePatterns": ["**/dist/*"], - "env": { - "jest": true - } + "extends": "../../.eslintrc.json" } diff --git a/packages/builders/.prettierrc.js b/packages/builders/.prettierrc.js new file mode 100644 index 000000000..f004026c7 --- /dev/null +++ b/packages/builders/.prettierrc.js @@ -0,0 +1 @@ +module.exports = require('../../.prettierrc.json'); diff --git a/packages/builders/.prettierrc.json b/packages/builders/.prettierrc.json deleted file mode 100644 index eba3f4077..000000000 --- a/packages/builders/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "printWidth": 120, - "useTabs": true, - "singleQuote": true, - "quoteProps": "as-needed", - "trailingComma": "all", - "endOfLine": "lf" -} diff --git a/packages/builders/tsconfig.eslint.json b/packages/builders/tsconfig.eslint.json index d04d4be3a..4cd64a835 100644 --- a/packages/builders/tsconfig.eslint.json +++ b/packages/builders/tsconfig.eslint.json @@ -1,20 +1,3 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "allowJs": true - }, - "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.mjs", - "**/*.jsx", - "**/*.test.ts", - "**/*.test.js", - "**/*.test.mjs", - "**/*.spec.ts", - "**/*.spec.js", - "**/*.spec.mjs" - ], - "exclude": [] + "extends": "../../tsconfig.eslint.json" } diff --git a/packages/builders/tsup.config.ts b/packages/builders/tsup.config.ts index a0c433e8d..862e61aff 100644 --- a/packages/builders/tsup.config.ts +++ b/packages/builders/tsup.config.ts @@ -1,20 +1,3 @@ -import { defineConfig } from 'tsup'; +import { createTsupConfig } from '../../tsup.config'; -export default defineConfig({ - clean: true, - dts: true, - entryPoints: ['src/index.ts'], - format: ['esm', 'cjs'], - minify: false, - keepNames: true, - skipNodeModulesBundle: true, - sourcemap: true, - target: 'es2021', - esbuildOptions: (options, context) => { - if (context.format === 'cjs') { - options.banner = { - js: '"use strict";', - }; - } - }, -}); +export default createTsupConfig(); diff --git a/packages/collection/.eslintrc.json b/packages/collection/.eslintrc.json index 0998f03ac..99ef7cec8 100644 --- a/packages/collection/.eslintrc.json +++ b/packages/collection/.eslintrc.json @@ -1,12 +1,3 @@ { - "root": true, - "extends": "marine/prettier/node", - "parserOptions": { - "project": "./tsconfig.eslint.json", - "extraFileExtensions": [".mjs"] - }, - "ignorePatterns": ["**/dist/*"], - "env": { - "jest": true - } + "extends": "../../.eslintrc.json" } diff --git a/packages/collection/.prettierrc.js b/packages/collection/.prettierrc.js new file mode 100644 index 000000000..f004026c7 --- /dev/null +++ b/packages/collection/.prettierrc.js @@ -0,0 +1 @@ +module.exports = require('../../.prettierrc.json'); diff --git a/packages/collection/.prettierrc.json b/packages/collection/.prettierrc.json deleted file mode 100644 index eba3f4077..000000000 --- a/packages/collection/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "printWidth": 120, - "useTabs": true, - "singleQuote": true, - "quoteProps": "as-needed", - "trailingComma": "all", - "endOfLine": "lf" -} diff --git a/packages/collection/tsconfig.eslint.json b/packages/collection/tsconfig.eslint.json index d04d4be3a..4cd64a835 100644 --- a/packages/collection/tsconfig.eslint.json +++ b/packages/collection/tsconfig.eslint.json @@ -1,20 +1,3 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "allowJs": true - }, - "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.mjs", - "**/*.jsx", - "**/*.test.ts", - "**/*.test.js", - "**/*.test.mjs", - "**/*.spec.ts", - "**/*.spec.js", - "**/*.spec.mjs" - ], - "exclude": [] + "extends": "../../tsconfig.eslint.json" } diff --git a/packages/collection/tsup.config.ts b/packages/collection/tsup.config.ts index 02c877e50..862e61aff 100644 --- a/packages/collection/tsup.config.ts +++ b/packages/collection/tsup.config.ts @@ -1,21 +1,3 @@ -import { defineConfig } from 'tsup'; +import { createTsupConfig } from '../../tsup.config'; -export default defineConfig({ - clean: true, - dts: true, - entryPoints: ['src/index.ts'], - format: ['esm', 'cjs'], - minify: false, - // if false: causes Collection.constructor to be a minified value like: 'o' - keepNames: true, - skipNodeModulesBundle: true, - sourcemap: true, - target: 'es2021', - esbuildOptions: (options, context) => { - if (context.format === 'cjs') { - options.banner = { - js: '"use strict";', - }; - } - }, -}); +export default createTsupConfig(); diff --git a/packages/discord.js/.eslintrc.json b/packages/discord.js/.eslintrc.json index de32e14c9..8d23178e6 100644 --- a/packages/discord.js/.eslintrc.json +++ b/packages/discord.js/.eslintrc.json @@ -19,17 +19,6 @@ } } ], - "prettier/prettier": [ - 2, - { - "printWidth": 120, - "singleQuote": true, - "quoteProps": "as-needed", - "trailingComma": "all", - "endOfLine": "lf", - "arrowParens": "avoid" - } - ], "strict": ["error", "global"], "no-await-in-loop": "warn", "no-compare-neg-zero": "error", diff --git a/packages/docgen/.eslintrc.json b/packages/docgen/.eslintrc.json index 0998f03ac..99ef7cec8 100644 --- a/packages/docgen/.eslintrc.json +++ b/packages/docgen/.eslintrc.json @@ -1,12 +1,3 @@ { - "root": true, - "extends": "marine/prettier/node", - "parserOptions": { - "project": "./tsconfig.eslint.json", - "extraFileExtensions": [".mjs"] - }, - "ignorePatterns": ["**/dist/*"], - "env": { - "jest": true - } + "extends": "../../.eslintrc.json" } diff --git a/packages/docgen/.prettierrc.js b/packages/docgen/.prettierrc.js new file mode 100644 index 000000000..f004026c7 --- /dev/null +++ b/packages/docgen/.prettierrc.js @@ -0,0 +1 @@ +module.exports = require('../../.prettierrc.json'); diff --git a/packages/docgen/.prettierrc.json b/packages/docgen/.prettierrc.json deleted file mode 100644 index eba3f4077..000000000 --- a/packages/docgen/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "printWidth": 120, - "useTabs": true, - "singleQuote": true, - "quoteProps": "as-needed", - "trailingComma": "all", - "endOfLine": "lf" -} diff --git a/packages/docgen/tsconfig.eslint.json b/packages/docgen/tsconfig.eslint.json index d04d4be3a..4cd64a835 100644 --- a/packages/docgen/tsconfig.eslint.json +++ b/packages/docgen/tsconfig.eslint.json @@ -1,20 +1,3 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "allowJs": true - }, - "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.mjs", - "**/*.jsx", - "**/*.test.ts", - "**/*.test.js", - "**/*.test.mjs", - "**/*.spec.ts", - "**/*.spec.js", - "**/*.spec.mjs" - ], - "exclude": [] + "extends": "../../tsconfig.eslint.json" } diff --git a/packages/docgen/tsup.config.ts b/packages/docgen/tsup.config.ts index 0699d3e27..98646f835 100644 --- a/packages/docgen/tsup.config.ts +++ b/packages/docgen/tsup.config.ts @@ -1,13 +1,5 @@ -import { defineConfig } from 'tsup'; +import { createTsupConfig } from '../../tsup.config'; -export default defineConfig({ - clean: true, - dts: true, - entryPoints: ['src/index.ts'], - format: ['esm', 'cjs'], - keepNames: true, - minify: false, - skipNodeModulesBundle: true, - sourcemap: true, - target: 'es2021', +export default createTsupConfig({ + minify: true, }); diff --git a/packages/proxy/.eslintrc.json b/packages/proxy/.eslintrc.json index 0998f03ac..99ef7cec8 100644 --- a/packages/proxy/.eslintrc.json +++ b/packages/proxy/.eslintrc.json @@ -1,12 +1,3 @@ { - "root": true, - "extends": "marine/prettier/node", - "parserOptions": { - "project": "./tsconfig.eslint.json", - "extraFileExtensions": [".mjs"] - }, - "ignorePatterns": ["**/dist/*"], - "env": { - "jest": true - } + "extends": "../../.eslintrc.json" } diff --git a/packages/proxy/.prettierrc.js b/packages/proxy/.prettierrc.js new file mode 100644 index 000000000..f004026c7 --- /dev/null +++ b/packages/proxy/.prettierrc.js @@ -0,0 +1 @@ +module.exports = require('../../.prettierrc.json'); diff --git a/packages/proxy/.prettierrc.json b/packages/proxy/.prettierrc.json deleted file mode 100644 index eba3f4077..000000000 --- a/packages/proxy/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "printWidth": 120, - "useTabs": true, - "singleQuote": true, - "quoteProps": "as-needed", - "trailingComma": "all", - "endOfLine": "lf" -} diff --git a/packages/proxy/tsconfig.eslint.json b/packages/proxy/tsconfig.eslint.json index d04d4be3a..4cd64a835 100644 --- a/packages/proxy/tsconfig.eslint.json +++ b/packages/proxy/tsconfig.eslint.json @@ -1,20 +1,3 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "allowJs": true - }, - "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.mjs", - "**/*.jsx", - "**/*.test.ts", - "**/*.test.js", - "**/*.test.mjs", - "**/*.spec.ts", - "**/*.spec.js", - "**/*.spec.mjs" - ], - "exclude": [] + "extends": "../../tsconfig.eslint.json" } diff --git a/packages/proxy/tsup.config.ts b/packages/proxy/tsup.config.ts index a0c433e8d..862e61aff 100644 --- a/packages/proxy/tsup.config.ts +++ b/packages/proxy/tsup.config.ts @@ -1,20 +1,3 @@ -import { defineConfig } from 'tsup'; +import { createTsupConfig } from '../../tsup.config'; -export default defineConfig({ - clean: true, - dts: true, - entryPoints: ['src/index.ts'], - format: ['esm', 'cjs'], - minify: false, - keepNames: true, - skipNodeModulesBundle: true, - sourcemap: true, - target: 'es2021', - esbuildOptions: (options, context) => { - if (context.format === 'cjs') { - options.banner = { - js: '"use strict";', - }; - } - }, -}); +export default createTsupConfig(); diff --git a/packages/rest/.eslintrc.json b/packages/rest/.eslintrc.json index 0998f03ac..99ef7cec8 100644 --- a/packages/rest/.eslintrc.json +++ b/packages/rest/.eslintrc.json @@ -1,12 +1,3 @@ { - "root": true, - "extends": "marine/prettier/node", - "parserOptions": { - "project": "./tsconfig.eslint.json", - "extraFileExtensions": [".mjs"] - }, - "ignorePatterns": ["**/dist/*"], - "env": { - "jest": true - } + "extends": "../../.eslintrc.json" } diff --git a/packages/rest/.prettierrc.js b/packages/rest/.prettierrc.js new file mode 100644 index 000000000..f004026c7 --- /dev/null +++ b/packages/rest/.prettierrc.js @@ -0,0 +1 @@ +module.exports = require('../../.prettierrc.json'); diff --git a/packages/rest/.prettierrc.json b/packages/rest/.prettierrc.json deleted file mode 100644 index eba3f4077..000000000 --- a/packages/rest/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "printWidth": 120, - "useTabs": true, - "singleQuote": true, - "quoteProps": "as-needed", - "trailingComma": "all", - "endOfLine": "lf" -} diff --git a/packages/rest/tsconfig.eslint.json b/packages/rest/tsconfig.eslint.json index d04d4be3a..4cd64a835 100644 --- a/packages/rest/tsconfig.eslint.json +++ b/packages/rest/tsconfig.eslint.json @@ -1,20 +1,3 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "allowJs": true - }, - "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.mjs", - "**/*.jsx", - "**/*.test.ts", - "**/*.test.js", - "**/*.test.mjs", - "**/*.spec.ts", - "**/*.spec.js", - "**/*.spec.mjs" - ], - "exclude": [] + "extends": "../../tsconfig.eslint.json" } diff --git a/packages/rest/tsup.config.ts b/packages/rest/tsup.config.ts index 553ca2a73..862e61aff 100644 --- a/packages/rest/tsup.config.ts +++ b/packages/rest/tsup.config.ts @@ -1,20 +1,3 @@ -import { defineConfig } from 'tsup'; +import { createTsupConfig } from '../../tsup.config'; -export default defineConfig({ - clean: true, - dts: false, - entryPoints: ['src/index.ts'], - format: ['esm', 'cjs'], - minify: false, - keepNames: true, - skipNodeModulesBundle: true, - sourcemap: true, - target: 'es2021', - esbuildOptions: (options, context) => { - if (context.format === 'cjs') { - options.banner = { - js: '"use strict";', - }; - } - }, -}); +export default createTsupConfig(); diff --git a/packages/scripts/.eslintrc.json b/packages/scripts/.eslintrc.json index 0998f03ac..99ef7cec8 100644 --- a/packages/scripts/.eslintrc.json +++ b/packages/scripts/.eslintrc.json @@ -1,12 +1,3 @@ { - "root": true, - "extends": "marine/prettier/node", - "parserOptions": { - "project": "./tsconfig.eslint.json", - "extraFileExtensions": [".mjs"] - }, - "ignorePatterns": ["**/dist/*"], - "env": { - "jest": true - } + "extends": "../../.eslintrc.json" } diff --git a/packages/scripts/.prettierrc.js b/packages/scripts/.prettierrc.js new file mode 100644 index 000000000..f004026c7 --- /dev/null +++ b/packages/scripts/.prettierrc.js @@ -0,0 +1 @@ +module.exports = require('../../.prettierrc.json'); diff --git a/packages/scripts/.prettierrc.json b/packages/scripts/.prettierrc.json deleted file mode 100644 index eba3f4077..000000000 --- a/packages/scripts/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "printWidth": 120, - "useTabs": true, - "singleQuote": true, - "quoteProps": "as-needed", - "trailingComma": "all", - "endOfLine": "lf" -} diff --git a/packages/scripts/tsconfig.eslint.json b/packages/scripts/tsconfig.eslint.json index d04d4be3a..4cd64a835 100644 --- a/packages/scripts/tsconfig.eslint.json +++ b/packages/scripts/tsconfig.eslint.json @@ -1,20 +1,3 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "allowJs": true - }, - "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.mjs", - "**/*.jsx", - "**/*.test.ts", - "**/*.test.js", - "**/*.test.mjs", - "**/*.spec.ts", - "**/*.spec.js", - "**/*.spec.mjs" - ], - "exclude": [] + "extends": "../../tsconfig.eslint.json" } diff --git a/packages/scripts/tsup.config.ts b/packages/scripts/tsup.config.ts index cb8bd7ecc..c61d9fad9 100644 --- a/packages/scripts/tsup.config.ts +++ b/packages/scripts/tsup.config.ts @@ -1,12 +1,6 @@ -import { defineConfig } from 'tsup'; +import { createTsupConfig } from '../../tsup.config'; -export default defineConfig({ - clean: true, - dts: true, - entryPoints: ['src/docs.ts'], - format: ['esm', 'cjs'], +export default createTsupConfig({ + entry: ['src/docs.ts'], minify: true, - skipNodeModulesBundle: true, - sourcemap: true, - target: 'es2021', }); diff --git a/packages/voice/.prettierrc.js b/packages/voice/.prettierrc.js new file mode 100644 index 000000000..f004026c7 --- /dev/null +++ b/packages/voice/.prettierrc.js @@ -0,0 +1 @@ +module.exports = require('../../.prettierrc.json'); diff --git a/packages/voice/.prettierrc.json b/packages/voice/.prettierrc.json deleted file mode 100644 index eba3f4077..000000000 --- a/packages/voice/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "printWidth": 120, - "useTabs": true, - "singleQuote": true, - "quoteProps": "as-needed", - "trailingComma": "all", - "endOfLine": "lf" -} diff --git a/packages/voice/tsconfig.eslint.json b/packages/voice/tsconfig.eslint.json index d04d4be3a..4cd64a835 100644 --- a/packages/voice/tsconfig.eslint.json +++ b/packages/voice/tsconfig.eslint.json @@ -1,20 +1,3 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "allowJs": true - }, - "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.mjs", - "**/*.jsx", - "**/*.test.ts", - "**/*.test.js", - "**/*.test.mjs", - "**/*.spec.ts", - "**/*.spec.js", - "**/*.spec.mjs" - ], - "exclude": [] + "extends": "../../tsconfig.eslint.json" } diff --git a/packages/voice/tsup.config.ts b/packages/voice/tsup.config.ts index a0c433e8d..862e61aff 100644 --- a/packages/voice/tsup.config.ts +++ b/packages/voice/tsup.config.ts @@ -1,20 +1,3 @@ -import { defineConfig } from 'tsup'; +import { createTsupConfig } from '../../tsup.config'; -export default defineConfig({ - clean: true, - dts: true, - entryPoints: ['src/index.ts'], - format: ['esm', 'cjs'], - minify: false, - keepNames: true, - skipNodeModulesBundle: true, - sourcemap: true, - target: 'es2021', - esbuildOptions: (options, context) => { - if (context.format === 'cjs') { - options.banner = { - js: '"use strict";', - }; - } - }, -}); +export default createTsupConfig(); diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 000000000..d04d4be3a --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "allowJs": true + }, + "include": [ + "**/*.ts", + "**/*.tsx", + "**/*.js", + "**/*.mjs", + "**/*.jsx", + "**/*.test.ts", + "**/*.test.js", + "**/*.test.mjs", + "**/*.spec.ts", + "**/*.spec.js", + "**/*.spec.mjs" + ], + "exclude": [] +} diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 000000000..b24056d93 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,48 @@ +import { relative, resolve } from 'node:path'; +import { defineConfig, type Options } from 'tsup'; + +type ConfigOptions = Pick< + Options, + | 'globalName' + | 'minify' + | 'entry' + | 'format' + | 'target' + | 'sourcemap' + | 'skipNodeModulesBundle' + | 'noExternal' + | 'esbuildOptions' +>; + +export const createTsupConfig = ({ + globalName, + format = ['esm', 'cjs'], + target = 'es2021', + sourcemap = true, + minify = false, + entry = ['src/index.ts'], + skipNodeModulesBundle = true, + noExternal, + esbuildOptions = (options, context) => { + if (context.format === 'cjs') { + options.banner = { + js: '"use strict";', + }; + } + }, +}: ConfigOptions = {}) => + defineConfig({ + clean: true, + dts: true, + entry, + format, + minify, + skipNodeModulesBundle, + sourcemap, + target, + tsconfig: relative(__dirname, resolve(process.cwd(), 'tsconfig.json')), + keepNames: true, + globalName, + noExternal, + esbuildOptions, + });