mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-30 08:10:34 +01:00
remove mkdirp lib
This commit is contained in:
parent
b425b6f509
commit
1157c074ad
13
package-lock.json
generated
13
package-lock.json
generated
@ -34,15 +34,6 @@
|
||||
"integrity": "sha512-esk3CG25hRtHsVHm+LOjiSFYdw8be3uIY653WUwR43Bro914HSimPgPpqgajkhTJ0awK3RQfaIxP7zvbtCpcyg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/mkdirp": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz",
|
||||
"integrity": "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "10.0.8"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "10.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.0.8.tgz",
|
||||
@ -3111,6 +3102,7 @@
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
},
|
||||
@ -3118,7 +3110,8 @@
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -47,7 +47,6 @@
|
||||
"@types/commander": "^2.12.2",
|
||||
"@types/lowdb": "^1.0.1",
|
||||
"@types/lunr": "^2.1.5",
|
||||
"@types/mkdirp": "^0.5.2",
|
||||
"@types/node": "^10.0.8",
|
||||
"@types/node-forge": "^0.7.1",
|
||||
"@types/readline-sync": "^1.4.3",
|
||||
@ -65,7 +64,6 @@
|
||||
"chalk": "2.4.1",
|
||||
"commander": "2.15.1",
|
||||
"lowdb": "1.0.0",
|
||||
"mkdirp": "0.5.1",
|
||||
"node-fetch": "2.1.2",
|
||||
"node-forge": "0.7.1",
|
||||
"readline-sync": "1.4.9"
|
||||
|
@ -1,7 +1,6 @@
|
||||
import * as fs from 'fs';
|
||||
import * as lowdb from 'lowdb';
|
||||
import * as FileSync from 'lowdb/adapters/FileSync';
|
||||
import * as mkdirp from 'mkdirp';
|
||||
import * as path from 'path';
|
||||
|
||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||
@ -20,7 +19,7 @@ export class LowdbStorageService implements StorageService {
|
||||
p = path.join(process.env.HOME, '.config', appDirName);
|
||||
}
|
||||
if (!fs.existsSync(p)) {
|
||||
mkdirp.sync(p, 755);
|
||||
this.mkdirpSync(p, 755);
|
||||
}
|
||||
p = path.join(p, 'data.json');
|
||||
|
||||
@ -42,4 +41,16 @@ export class LowdbStorageService implements StorageService {
|
||||
this.db.unset(key).write();
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
private mkdirpSync(targetDir: string, mode = 755, relative = false) {
|
||||
const initialDir = path.isAbsolute(targetDir) ? path.sep : '';
|
||||
const baseDir = relative ? __dirname : '.';
|
||||
targetDir.split(path.sep).reduce((parentDir, childDir) => {
|
||||
const dir = path.resolve(baseDir, parentDir, childDir);
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, mode);
|
||||
}
|
||||
return dir;
|
||||
}, initialDir);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user