Commit 27f3f85 1 parent ef3995d commit 27f3f85 Copy full SHA for 27f3f85
File tree 4 files changed +81
-5
lines changed
4 files changed +81
-5
lines changed Original file line number Diff line number Diff line change
1
+ const { eslintConfig } = require ( './package.json' )
2
+
3
+ eslintConfig . parser = '@typescript-eslint/parser'
4
+ eslintConfig . extends . push (
5
+ 'plugin:@typescript-eslint/eslint-recommended' ,
6
+ 'plugin:@typescript-eslint/recommended'
7
+ )
8
+
9
+ eslintConfig . rules = {
10
+ 'node/no-unsupported-features/es-syntax' : 'off' ,
11
+ 'comma-dangle' : [ 'error' , 'only-multiline' ] ,
12
+ semi : [ 'error' , 'always' ] ,
13
+ 'space-before-function-paren' : [ 'error' , 'never' ]
14
+ }
15
+
16
+ module . exports = eslintConfig
Original file line number Diff line number Diff line change
1
+ // Based on the type definitions for extract-zip 1.6
2
+ // Definitions by: Mizunashi Mana <https://github.com/mizunashi-mana>
3
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e69b58e/types/extract-zip/index.d.ts
4
+
5
+ import { Entry , ZipFile } from 'yauzl' ;
6
+
7
+ declare namespace extract {
8
+ interface Options {
9
+ dir : string ;
10
+ defaultDirMode ?: number ;
11
+ defaultFileMode ?: number ;
12
+ onEntry ?: ( entry : Entry , zipfile : ZipFile ) => void ;
13
+ }
14
+ }
15
+
16
+ declare function extract (
17
+ zipPath : string ,
18
+ opts : extract . Options ,
19
+ ) : Promise < void > ;
20
+
21
+ export = extract ;
Original file line number Diff line number Diff line change
1
+ import { Entry , ZipFile } from 'yauzl' ;
2
+ import * as extract from '.' ;
3
+
4
+ const zip = '/path/to/zip' ;
5
+ const dir = '/path/to/dir' ;
6
+ const defaultFileMode = 0o600 ;
7
+
8
+ let options : extract . Options = {
9
+ dir,
10
+ } ;
11
+ options = {
12
+ dir,
13
+ defaultDirMode : 0o700 ,
14
+ defaultFileMode,
15
+ onEntry : ( entry : Entry , zipfile : ZipFile ) : void => {
16
+ console . log ( entry ) ;
17
+ console . log ( zipfile ) ;
18
+ }
19
+ } ;
20
+
21
+ try {
22
+ await extract ( zip , options ) ;
23
+ console . log ( 'done' ) ;
24
+ } catch ( err ) {
25
+ console . error ( err ) ;
26
+ }
Original file line number Diff line number Diff line change 3
3
"version" : " 1.7.0" ,
4
4
"description" : " unzip a zip file into a directory using 100% javascript" ,
5
5
"main" : " index.js" ,
6
+ "types" : " index.d.ts" ,
6
7
"bin" : {
7
8
"extract-zip" : " cli.js"
8
9
},
9
10
"scripts" : {
10
11
"ava" : " ava" ,
11
12
"coverage" : " nyc ava" ,
12
- "lint" : " eslint ." ,
13
- "test" : " npm run lint && ava"
13
+ "lint" : " yarn lint:js && yarn lint:ts && yarn tsd" ,
14
+ "lint:js" : " eslint ." ,
15
+ "lint:ts" : " eslint --config .eslintrc.typescript.js --ext .ts ." ,
16
+ "test" : " yarn lint && ava" ,
17
+ "tsd" : " tsd"
14
18
},
15
19
"files" : [
16
- " *.js"
20
+ " *.js" ,
21
+ " index.d.ts"
17
22
],
18
23
"author" : " max ogden" ,
19
24
"license" : " BSD-2-Clause" ,
31
36
"get-stream" : " ^5.1.0" ,
32
37
"yauzl" : " ^2.10.0"
33
38
},
39
+ "optionalDependencies" : {
40
+ "@types/yauzl" : " ^2.9.1"
41
+ },
34
42
"devDependencies" : {
43
+ "@typescript-eslint/eslint-plugin" : " ^2.25.0" ,
44
+ "@typescript-eslint/parser" : " ^2.25.0" ,
35
45
"ava" : " ^3.5.1" ,
36
46
"eslint" : " ^6.8.0" ,
37
47
"eslint-config-standard" : " ^14.1.1" ,
43
53
"fs-extra" : " ^9.0.0" ,
44
54
"husky" : " ^4.2.3" ,
45
55
"lint-staged" : " ^10.0.9" ,
46
- "nyc" : " ^15.0.0"
56
+ "nyc" : " ^15.0.0" ,
57
+ "tsd" : " ^0.11.0" ,
58
+ "typescript" : " ^3.8.3"
47
59
},
48
60
"eslintConfig" : {
49
61
"extends" : [
62
74
}
63
75
},
64
76
"lint-staged" : {
65
- "*.js" : " eslint --fix"
77
+ "*.js" : " yarn lint:js --fix" ,
78
+ "*.ts" : " yarn lint:ts --fix"
66
79
}
67
80
}
You can’t perform that action at this time.
0 commit comments