backend-manager 3.2.158 → 3.2.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/manager/index.js +9 -2
package/package.json
CHANGED
package/src/manager/index.js
CHANGED
|
@@ -506,17 +506,23 @@ Manager.prototype.storage = function (options) {
|
|
|
506
506
|
options.clear = typeof options.clear === 'undefined' ? true : options.clear;
|
|
507
507
|
options.log = typeof options.log === 'undefined' ? false : options.log;
|
|
508
508
|
|
|
509
|
+
// Set path
|
|
510
|
+
const subfolder = `storage/${self.options.uniqueAppName || 'primary'}/${options.name}`;
|
|
511
|
+
|
|
512
|
+
// Setup lowdb
|
|
509
513
|
const low = require('lowdb');
|
|
510
514
|
const FileSync = require('lowdb/adapters/FileSync');
|
|
511
515
|
const location = options.temporary
|
|
512
|
-
? `${require('os').tmpdir()}
|
|
513
|
-
: `./.data
|
|
516
|
+
? `${require('os').tmpdir()}/${subfolder}.json`
|
|
517
|
+
: `./.data/${subfolder}.json`;
|
|
514
518
|
const adapter = new FileSync(location);
|
|
515
519
|
|
|
520
|
+
// Log
|
|
516
521
|
if (options.log) {
|
|
517
522
|
self.assistant.log('storage(): Location', location);
|
|
518
523
|
}
|
|
519
524
|
|
|
525
|
+
// Clear temporary storage
|
|
520
526
|
if (
|
|
521
527
|
options.temporary
|
|
522
528
|
&& self.assistant.isDevelopment()
|
|
@@ -526,6 +532,7 @@ Manager.prototype.storage = function (options) {
|
|
|
526
532
|
jetpack.remove(location);
|
|
527
533
|
}
|
|
528
534
|
|
|
535
|
+
// Setup options
|
|
529
536
|
options.clearInvalid = typeof options.clearInvalid === 'undefined'
|
|
530
537
|
? true
|
|
531
538
|
: options.clearInvalid;
|