Commit 8b72280 1 parent d1359af commit 8b72280 Copy full SHA for 8b72280
File tree 6 files changed +81
-76
lines changed
6 files changed +81
-76
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 9
9
"types" : " index.d.ts" ,
10
10
"scripts" : {
11
11
"clean" : " rimraf coverage dist" ,
12
- "build" : " rollup -c " ,
12
+ "build" : " tsc " ,
13
13
"lint" : " eslint src tests" ,
14
14
"postpublish" : " yarn clean" ,
15
15
"prepublishOnly" : " yarn lint && yarn test && yarn clean && yarn build" ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import { deleteAsync , type Options as DelOptions } from 'del'
2
+ import type { AsyncPluginHooks , Plugin } from 'rollup'
3
+
4
+ export interface Options extends DelOptions {
5
+ /**
6
+ * Rollup hook the plugin should use.
7
+ * @default 'buildStart'
8
+ * end
9
+ */
10
+ readonly hook ?: AsyncPluginHooks
11
+
12
+ /**
13
+ * Delete items once. Useful in watch mode.
14
+ * @default false
15
+ */
16
+ readonly runOnce ?: boolean
17
+
18
+ /**
19
+ * Patterns of files and folders to be deleted.
20
+ * @default []
21
+ */
22
+ readonly targets ?: readonly string [ ] | string
23
+
24
+ /**
25
+ * Outputs removed files and folders to console.
26
+ * @default false
27
+ */
28
+ readonly verbose ?: boolean
29
+ }
30
+
31
+ export default function del ( options : Options = { } ) : Plugin {
32
+ const {
33
+ hook = 'buildStart' ,
34
+ runOnce = false ,
35
+ targets = [ ] ,
36
+ verbose = false ,
37
+ ...delOptions
38
+ } = options
39
+
40
+ let deleted = false
41
+
42
+ return {
43
+ name : 'delete' ,
44
+ // eslint-disable-next-line perfectionist/sort-objects
45
+ [ hook ] : async ( ) => {
46
+ if ( runOnce && deleted ) {
47
+ return
48
+ }
49
+
50
+ const paths = await deleteAsync ( targets , delOptions )
51
+
52
+ if ( verbose || delOptions . dryRun ) {
53
+ const message = delOptions . dryRun
54
+ ? `Expected files and folders to be deleted: ${ paths . length } `
55
+ : `Deleted files and folders: ${ paths . length } `
56
+
57
+ console . log ( message )
58
+
59
+ if ( paths . length ) {
60
+ paths . forEach ( ( path ) => {
61
+ console . log ( path )
62
+ } )
63
+ }
64
+ }
65
+
66
+ // eslint-disable-next-line require-atomic-updates
67
+ deleted = true
68
+ }
69
+ }
70
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : "@tsconfig/node18" ,
3
+ "compilerOptions" : {
4
+ "declaration" : true ,
5
+ "noImplicitReturns" : true ,
6
+ "outDir" : "dist" ,
7
+ "verbatimModuleSyntax" : true
8
+ } ,
9
+ "include" : [ "src" ]
10
+ }
You can’t perform that action at this time.
0 commit comments