mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-27 22:59:51 -05:00
make path to local-db if it doesn't exist
This commit is contained in:
parent
40baedaa78
commit
feae33499e
1 changed files with 5 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
|
var Path = require('path')
|
||||||
|
|
||||||
module.exports = LocalData
|
module.exports = LocalData
|
||||||
|
|
||||||
|
@ -35,6 +36,9 @@ LocalData.prototype.get = function() {
|
||||||
|
|
||||||
LocalData.prototype.sync = function() {
|
LocalData.prototype.sync = function() {
|
||||||
// Uses sync to prevent ugly race condition
|
// Uses sync to prevent ugly race condition
|
||||||
|
try {
|
||||||
|
require('mkdirp').sync(Path.dirname(this.path))
|
||||||
|
} catch(err) {}
|
||||||
fs.writeFileSync(this.path, JSON.stringify(this.data))
|
fs.writeFileSync(this.path, JSON.stringify(this.data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue