chore: cleanup tsup configs (#8381)

This commit is contained in:
Parbez
2022-07-28 22:27:57 +05:30
committed by GitHub
parent ff5dd1fcb4
commit c258bdf083
34 changed files with 17 additions and 346 deletions

View File

@@ -1,54 +0,0 @@
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'
| 'dts'
| 'bundle'
>;
export const createTsupConfig = ({
globalName,
format = ['esm', 'cjs'],
dts = true,
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";',
};
}
},
bundle,
}: ConfigOptions = {}) =>
defineConfig({
clean: true,
dts,
entry,
format,
minify,
skipNodeModulesBundle,
sourcemap,
target,
tsconfig: relative(__dirname, resolve(process.cwd(), 'tsconfig.json')),
keepNames: true,
globalName,
noExternal,
esbuildOptions,
bundle,
shims: true,
});