File tree Expand file tree Collapse file tree 4 files changed +6
-23
lines changed Expand file tree Collapse file tree 4 files changed +6
-23
lines changed Original file line number Diff line number Diff line change 250
250
},
251
251
"devDependencies" : {
252
252
"@types/eventsource" : " ^1.1.15" ,
253
- "@types/fs-extra" : " ^11.0.4" ,
254
253
"@types/glob" : " ^7.1.3" ,
255
254
"@types/ndjson" : " ^2.0.1" ,
256
255
"@types/node" : " ^18.0.0" ,
288
287
"date-fns" : " ^3.6.0" ,
289
288
"eventsource" : " ^2.0.2" ,
290
289
"find-process" : " ^1.4.7" ,
291
- "fs-extra" : " ^11.2.0" ,
292
290
"jsonc-parser" : " ^3.2.1" ,
293
291
"memfs" : " ^4.9.2" ,
294
292
"ndjson" : " ^2.0.0" ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const sshFilePath = "~/.config/ssh"
6
6
7
7
const mockFileSystem = {
8
8
readFile : vi . fn ( ) ,
9
- ensureDir : vi . fn ( ) ,
9
+ mkdir : vi . fn ( ) ,
10
10
writeFile : vi . fn ( ) ,
11
11
}
12
12
Original file line number Diff line number Diff line change 1
- import { readFile , writeFile } from "fs/promises"
2
- import { ensureDir } from "fs-extra"
1
+ import { mkdir , readFile , writeFile } from "fs/promises"
3
2
import path from "path"
4
3
5
4
class SSHConfigBadFormat extends Error { }
@@ -21,13 +20,13 @@ export interface SSHValues {
21
20
// Interface for the file system to make it easier to test
22
21
export interface FileSystem {
23
22
readFile : typeof readFile
24
- ensureDir : typeof ensureDir
23
+ mkdir : typeof mkdir
25
24
writeFile : typeof writeFile
26
25
}
27
26
28
27
const defaultFileSystem : FileSystem = {
29
28
readFile,
30
- ensureDir ,
29
+ mkdir ,
31
30
writeFile,
32
31
}
33
32
@@ -204,8 +203,9 @@ export class SSHConfig {
204
203
}
205
204
206
205
private async save ( ) {
207
- await this . fileSystem . ensureDir ( path . dirname ( this . filePath ) , {
206
+ await this . fileSystem . mkdir ( path . dirname ( this . filePath ) , {
208
207
mode : 0o700 , // only owner has rwx permission, not group or everyone.
208
+ recursive : true ,
209
209
} )
210
210
return this . fileSystem . writeFile ( this . filePath , this . getRaw ( ) , {
211
211
mode : 0o600 , // owner rw
Original file line number Diff line number Diff line change 651
651
resolved "https://registry.yarnpkg.com/@types/eventsource/-/eventsource-1.1.15.tgz#949383d3482e20557cbecbf3b038368d94b6be27"
652
652
integrity sha512-XQmGcbnxUNa06HR3VBVkc9+A2Vpi9ZyLJcdS5dwaQQ/4ZMWFO+5c90FnMUpbtMZwB/FChoYHwuVg8TvkECacTA==
653
653
654
- " @types/fs-extra@^11.0.4 " :
655
- version "11.0.4"
656
- resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-11.0.4.tgz#e16a863bb8843fba8c5004362b5a73e17becca45"
657
- integrity sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==
658
- dependencies :
659
- " @types/jsonfile" " *"
660
- " @types/node" " *"
661
-
662
654
" @types/glob@^7.1.3 " :
663
655
version "7.2.0"
664
656
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb"
682
674
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
683
675
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
684
676
685
- " @types/jsonfile@* " :
686
- version "6.1.1"
687
- resolved "https://registry.yarnpkg.com/@types/jsonfile/-/jsonfile-6.1.1.tgz#ac84e9aefa74a2425a0fb3012bdea44f58970f1b"
688
- integrity sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==
689
- dependencies :
690
- " @types/node" " *"
691
-
692
677
" @types/minimatch@* " :
693
678
version "5.1.2"
694
679
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca"
You can’t perform that action at this time.
0 commit comments