Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 45deb1a8d2 | |||
| 4c9d3c7148 | |||
| 320c627d4f | |||
| d834e0a220 | |||
| 86427ac05d | |||
| dc59682c15 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@push.rocks/npmextra",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.4",
|
||||
"private": false,
|
||||
"description": "do more with npm",
|
||||
"main": "dist_ts/index.js",
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/npmextra',
|
||||
version: '4.0.1',
|
||||
version: '4.0.4',
|
||||
description: 'do more with npm'
|
||||
}
|
||||
|
||||
@@ -3,6 +3,13 @@ import * as paths from './npmextra.paths.js';
|
||||
import { KeyValueStore } from './npmextra.classes.keyvaluestore.js';
|
||||
|
||||
export class AppData {
|
||||
public static async createAndInit(pathArg?: string) {
|
||||
const appData = new AppData(pathArg);
|
||||
await appData.init();
|
||||
return appData;
|
||||
}
|
||||
|
||||
// instance
|
||||
public readyDeferred = plugins.smartpromise.defer();
|
||||
public dirPathArg: string;
|
||||
private kvStore: KeyValueStore;
|
||||
@@ -16,11 +23,16 @@ export class AppData {
|
||||
} else {
|
||||
const appDataDir = '/app/data';
|
||||
const dataDir = '/data';
|
||||
const nogitAppData = '.nogit/appdata';
|
||||
const appDataExists = plugins.smartfile.fs.isDirectory(appDataDir);
|
||||
const dataExists = plugins.smartfile.fs.isDirectory(dataDir);
|
||||
if (appDataExists) {
|
||||
this.dirPathArg = appDataDir;
|
||||
} else if (dataExists) {
|
||||
this.dirPathArg = dataDir;
|
||||
} else {
|
||||
await plugins.smartfile.fs.ensureDir(nogitAppData);
|
||||
this.dirPathArg = nogitAppData;
|
||||
}
|
||||
}
|
||||
this.kvStore = new KeyValueStore('custom', 'appkv', this.dirPathArg);
|
||||
|
||||
Reference in New Issue
Block a user