@@ -7,7 +7,6 @@ import { mkdirSync, rmSync, writeFileSync } from 'node:fs'
77import { glob } from 'node:fs/promises'
88import path , { dirname } from 'node:path'
99import { fileURLToPath } from 'node:url'
10- import tsconfig from './tsconfig.npm.json' with { type : 'json' }
1110import { updateImports } from './updateImports.ts'
1211
1312const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
2019 // pass
2120}
2221
23- for await ( const file of glob (
24- `./.npm/{ ${ tsconfig . include . join ( ',' ) } }/**/*.ts` ,
25- ) ) {
22+ const srcDir = path . join ( __dirname , `../src/` )
23+
24+ for await ( const file of glob ( path . join ( srcDir , `**/*.ts` ) ) ) {
2625 if ( file . endsWith ( '.spec.ts' ) ) continue
2726 let compiled = (
2827 await swc . transformFile ( file , {
@@ -40,7 +39,10 @@ for await (const file of glob(
4039
4140 compiled = updateImports ( compiled )
4241
43- const targetFile = path . join ( outDir , file . replace ( / \. t s $ / , '.js' ) )
42+ const targetFile = path . join (
43+ outDir ,
44+ file . replace ( srcDir , '' ) . replace ( / \. t s $ / , '.js' ) ,
45+ )
4446
4547 mkdirSync ( dirname ( targetFile ) , { recursive : true } )
4648
0 commit comments