This repository was archived by the owner on Jan 2, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 10
10
"test:unit" : " jest --runInBand --verbose" ,
11
11
"test:unit:watch" : " jest --runInBand --watch --verbose" ,
12
12
"build" : " yarn build:esm && yarn build:cjs" ,
13
+ "build:clean" : " node --experimental-modules scripts/clean-dist.mjs" ,
13
14
"build:esm" : " tsc --module es6 --target es2018 --outDir dist/esm" ,
14
15
"build:cjs" : " tsc --module commonjs --target es5 --outDir dist/cjs" ,
15
16
"build:umd" : " tsc --module umd --target es5 --outDir dist/umd" ,
Original file line number Diff line number Diff line change
1
+ import {
2
+ existsSync ,
3
+ readdirSync ,
4
+ lstatSync ,
5
+ unlinkSync ,
6
+ rmdirSync ,
7
+ } from 'fs' ;
8
+ import { join } from 'path' ;
9
+
10
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
11
+ const deleteFolderRecursive = ( filePath ) => {
12
+ if ( existsSync ( filePath ) ) {
13
+ readdirSync ( filePath ) . forEach ( ( file , _index ) => {
14
+ const curPath = join ( filePath , file ) ;
15
+ if ( lstatSync ( curPath ) . isDirectory ( ) ) { // recurse
16
+ deleteFolderRecursive ( curPath ) ;
17
+ } else { // delete file
18
+ unlinkSync ( curPath ) ;
19
+ }
20
+ } ) ;
21
+ rmdirSync ( filePath ) ;
22
+ }
23
+ } ;
24
+
25
+ deleteFolderRecursive ( './dist' ) ;
You can’t perform that action at this time.
0 commit comments