File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed
packages/compass-web/scripts Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3- //@ts -check
4-
5- import fs from 'node:fs' ;
3+ import fs from 'node:fs/promises' ;
64import path from 'node:path' ;
7- import process from 'node:process' ;
85
9- const distDir = path . join ( process . cwd ( ) , 'dist' ) ;
10- const keepFiles = new Set ( [ 'compass-web.d.ts' , 'compass-web.d.ts.map' ] ) ;
6+ const distDir = path . join ( import . meta. dirname , '..' , 'dist' ) ;
117
12- for ( const file of fs . readdirSync ( distDir ) ) {
13- if (
14- ( file . endsWith ( '.d.ts' ) || file . endsWith ( '.d.ts.map' ) ) &&
15- ! keepFiles . has ( file )
16- ) {
17- fs . unlinkSync ( path . join ( distDir , file ) ) ;
18- console . log ( `Deleted: ${ file } ` ) ;
19- }
20- }
8+ await Promise . all (
9+ (
10+ await fs . readdir ( distDir )
11+ )
12+ . filter ( ( file ) => file . endsWith ( '.d.ts' ) || file . endsWith ( '.d.ts.map' ) )
13+ . filter ( ( file ) => file !== 'compass-web.d.ts' )
14+ . map ( ( file ) => fs . unlink ( path . join ( distDir , file ) ) )
15+ ) ;
You can’t perform that action at this time.
0 commit comments