From 6837e6df2a212bd9f3aa2e4d8a6449998c89c76a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigui=20Kess=C3=A9=20Emmanuel?= Date: Sat, 17 Aug 2024 05:50:39 +0100 Subject: [PATCH] :hammer: Improve the build script --- scripts/build.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/build.ts b/scripts/build.ts index 6ab9efe..dd08421 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -4,9 +4,8 @@ import pkg from '../package.json'; import { fs, path, zlib } from '../src/'; import tsconfig from '../tsconfig.json'; -export type Target = BuildOptions['target'] | 'default'; -export type Format = BuildOptions['format']; -export type Platform = BuildOptions['platform']; +type Target = BuildOptions['target'] | 'default'; +type Format = BuildOptions['format']; const entryPoints = globbySync(tsconfig.include, { gitignore: true, @@ -17,11 +16,12 @@ const defaultFormat = pkg.type && pkg.type.toLowerCase() === 'module' ? 'esm' : 'cjs'; const outdir = tsconfig.compilerOptions.outDir; const target = tsconfig.compilerOptions.target || 'default'; +const minify = !tsconfig.compilerOptions.pretty; const watch = process.argv.includes('--watch'); const dtsdir = tsconfig.compilerOptions.declarationDir || outdir; bunify(entryPoints, dtsdir); -build(entryPoints, outdir, target, [undefined, 'cjs', 'esm'], true, watch); +build(entryPoints, outdir, target, [undefined, 'cjs', 'esm'], minify, watch); const files = fs.readdirSync(outdir); for (const file of files) { @@ -61,7 +61,6 @@ function getBuildOptions( return { ...options, platform: 'node', - bundle: true, minify, format: format ?? defaultFormat, sourcemap: !minify,