refactor: move all the config files to root (#8033)

This commit is contained in:
Parbez
2022-06-07 16:05:19 +05:30
committed by GitHub
parent 8b979c0245
commit 769ea0bfe7
43 changed files with 123 additions and 413 deletions

48
tsup.config.ts Normal file
View File

@@ -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,
});