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 250250 },
251251 "devDependencies" : {
252252 "@types/eventsource" : " ^1.1.15" ,
253- "@types/fs-extra" : " ^11.0.4" ,
254253 "@types/glob" : " ^7.1.3" ,
255254 "@types/ndjson" : " ^2.0.1" ,
256255 "@types/node" : " ^18.0.0" ,
288287 "date-fns" : " ^3.6.0" ,
289288 "eventsource" : " ^2.0.2" ,
290289 "find-process" : " ^1.4.7" ,
291- "fs-extra" : " ^11.2.0" ,
292290 "jsonc-parser" : " ^3.2.1" ,
293291 "memfs" : " ^4.9.2" ,
294292 "ndjson" : " ^2.0.0" ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const sshFilePath = "~/.config/ssh"
66
77const mockFileSystem = {
88 readFile : vi . fn ( ) ,
9- ensureDir : vi . fn ( ) ,
9+ mkdir : vi . fn ( ) ,
1010 writeFile : vi . fn ( ) ,
1111}
1212
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"
32import path from "path"
43
54class SSHConfigBadFormat extends Error { }
@@ -21,13 +20,13 @@ export interface SSHValues {
2120// Interface for the file system to make it easier to test
2221export interface FileSystem {
2322 readFile : typeof readFile
24- ensureDir : typeof ensureDir
23+ mkdir : typeof mkdir
2524 writeFile : typeof writeFile
2625}
2726
2827const defaultFileSystem : FileSystem = {
2928 readFile,
30- ensureDir ,
29+ mkdir ,
3130 writeFile,
3231}
3332
@@ -204,8 +203,9 @@ export class SSHConfig {
204203 }
205204
206205 private async save ( ) {
207- await this . fileSystem . ensureDir ( path . dirname ( this . filePath ) , {
206+ await this . fileSystem . mkdir ( path . dirname ( this . filePath ) , {
208207 mode : 0o700 , // only owner has rwx permission, not group or everyone.
208+ recursive : true ,
209209 } )
210210 return this . fileSystem . writeFile ( this . filePath , this . getRaw ( ) , {
211211 mode : 0o600 , // owner rw
Original file line number Diff line number Diff line change 651651 resolved "https://registry.yarnpkg.com/@types/eventsource/-/eventsource-1.1.15.tgz#949383d3482e20557cbecbf3b038368d94b6be27"
652652 integrity sha512-XQmGcbnxUNa06HR3VBVkc9+A2Vpi9ZyLJcdS5dwaQQ/4ZMWFO+5c90FnMUpbtMZwB/FChoYHwuVg8TvkECacTA==
653653
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-
662654" @types/glob@^7.1.3 " :
663655 version "7.2.0"
664656 resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb"
682674 resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
683675 integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
684676
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-
692677" @types/minimatch@* " :
693678 version "5.1.2"
694679 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