From 2c69c9664258769f986fe1b52387e8164be53e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=85=A8=E6=98=8C?= Date: Sun, 7 Sep 2025 16:29:30 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/preset-built-in/tsup.config.ts | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/preset-built-in/tsup.config.ts b/packages/preset-built-in/tsup.config.ts index a42cbde0..9b963949 100644 --- a/packages/preset-built-in/tsup.config.ts +++ b/packages/preset-built-in/tsup.config.ts @@ -1,25 +1,6 @@ -import { copyFileSync, mkdirSync, readdirSync } from 'node:fs'; -import { dirname, join } from 'node:path'; import { defineConfig } from 'tsup'; +import { copyTplFiles } from '../../scripts/shared.mjs'; -function copyTplFiles(srcDir: string, dstDir: string) { - function walk(currentSrc: string, currentDst: string) { - readdirSync(currentSrc, { withFileTypes: true }).forEach((dirent) => { - const srcPath = join(currentSrc, dirent.name); - const dstPath = join(currentDst, dirent.name); - - if (dirent.isDirectory()) { - walk(srcPath, dstPath); - } - else if (dirent.isFile() && dirent.name.endsWith('.tpl')) { - mkdirSync(dirname(dstPath), { recursive: true }); - copyFileSync(srcPath, dstPath); - console.log(`Copied: ${srcPath} -> ${dstPath}`); - } - }); - } - walk(srcDir, dstDir); -} export default defineConfig({ entry: [ 'src/index.ts', @@ -57,7 +38,6 @@ export default defineConfig({ dts: false, shims: true, format: ['esm'], - outExtension: () => ({ js: '.mjs' }), onSuccess: () => { copyTplFiles('src', 'dist'); },