@@ -4,7 +4,6 @@ import path from 'path';
4
4
import yargs from 'yargs' ;
5
5
import { $ } from 'execa' ;
6
6
import * as babel from '@babel/core' ;
7
- import { typescriptCopy } from './copyFilesUtils.mjs' ;
8
7
9
8
const $$ = $ ( { stdio : 'inherit' } ) ;
10
9
@@ -47,9 +46,16 @@ async function copyDeclarations(sourceDirectory: string, destinationDirectory: s
47
46
48
47
await fs . cp ( fullSourceDirectory , fullDestinationDirectory , {
49
48
recursive : true ,
50
- filter : ( src ) => {
51
- // include directories and .d.ts files
52
- return ! src . includes ( '.' ) || src . endsWith ( '.d.ts' ) ;
49
+ filter : async ( src ) => {
50
+ if ( src . startsWith ( '.' ) ) {
51
+ // ignore dotfiles
52
+ return false ;
53
+ }
54
+ const stats = await fs . stat ( src ) ;
55
+ if ( stats . isDirectory ( ) ) {
56
+ return true ;
57
+ }
58
+ return src . endsWith ( '.d.ts' ) ;
53
59
} ,
54
60
} ) ;
55
61
}
@@ -66,7 +72,7 @@ async function main(argv: HandlerArgv) {
66
72
const esmFolder = path . join ( buildFolder , 'esm' ) ;
67
73
const modernFolder = path . join ( buildFolder , 'modern' ) ;
68
74
69
- await typescriptCopy ( { from : srcPath , to : esmFolder } ) ;
75
+ await copyDeclarations ( srcPath , esmFolder ) ;
70
76
71
77
if ( ! argv . skipTsc ) {
72
78
const tsconfigPath = path . join ( packageRoot , 'tsconfig.build.json' ) ;
0 commit comments