File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { copyFileSync , mkdirSync , readdirSync } from 'node:fs' ;
2- import { dirname , join } from 'node:path' ;
31import { defineConfig } from 'tsup' ;
2+ import { copyTplFiles } from '../../scripts/shared.mjs' ;
43
5- function copyTplFiles ( srcDir : string , dstDir : string ) {
6- function walk ( currentSrc : string , currentDst : string ) {
7- readdirSync ( currentSrc , { withFileTypes : true } ) . forEach ( ( dirent ) => {
8- const srcPath = join ( currentSrc , dirent . name ) ;
9- const dstPath = join ( currentDst , dirent . name ) ;
10-
11- if ( dirent . isDirectory ( ) ) {
12- walk ( srcPath , dstPath ) ;
13- }
14- else if ( dirent . isFile ( ) && dirent . name . endsWith ( '.tpl' ) ) {
15- mkdirSync ( dirname ( dstPath ) , { recursive : true } ) ;
16- copyFileSync ( srcPath , dstPath ) ;
17- console . log ( `Copied: ${ srcPath } -> ${ dstPath } ` ) ;
18- }
19- } ) ;
20- }
21- walk ( srcDir , dstDir ) ;
22- }
234export default defineConfig ( {
245 entry : [
256 'src/index.ts' ,
@@ -57,7 +38,6 @@ export default defineConfig({
5738 dts : false ,
5839 shims : true ,
5940 format : [ 'esm' ] ,
60- outExtension : ( ) => ( { js : '.mjs' } ) ,
6141 onSuccess : ( ) => {
6242 copyTplFiles ( 'src' , 'dist' ) ;
6343 } ,
You can’t perform that action at this time.
0 commit comments