update
This commit is contained in:
parent
b1f8c79b8d
commit
513bb686ef
18
dist/npmextra.classes.keyValueStore.d.ts
vendored
18
dist/npmextra.classes.keyValueStore.d.ts
vendored
@ -1,18 +0,0 @@
|
||||
export declare type keyValueStoreTypes = 'path' | 'gitProject';
|
||||
export declare class KeyValueStore {
|
||||
constructor(optionsArg: {
|
||||
type: keyValueStoreTypes;
|
||||
});
|
||||
/**
|
||||
* reads a keyValueFile from disk
|
||||
*/
|
||||
kvRead(): void;
|
||||
/**
|
||||
* writes a key value file to disk
|
||||
*/
|
||||
kvWrite(): void;
|
||||
/**
|
||||
* wipes a key value store from disk
|
||||
*/
|
||||
kevWipe(): void;
|
||||
}
|
22
dist/npmextra.classes.keyValueStore.js
vendored
22
dist/npmextra.classes.keyValueStore.js
vendored
@ -1,22 +0,0 @@
|
||||
"use strict";
|
||||
class KeyValueStore {
|
||||
constructor(optionsArg) {
|
||||
}
|
||||
/**
|
||||
* reads a keyValueFile from disk
|
||||
*/
|
||||
kvRead() {
|
||||
}
|
||||
/**
|
||||
* writes a key value file to disk
|
||||
*/
|
||||
kvWrite() {
|
||||
}
|
||||
/**
|
||||
* wipes a key value store from disk
|
||||
*/
|
||||
kevWipe() {
|
||||
}
|
||||
}
|
||||
exports.KeyValueStore = KeyValueStore;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZXh0cmEuY2xhc3Nlcy5rZXl2YWx1ZXN0b3JlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtZXh0cmEuY2xhc3Nlcy5rZXl2YWx1ZXN0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFLQTtJQUNJLFlBQVksVUFFWDtJQUVELENBQUM7SUFDRDs7R0FFRDtJQUNDLE1BQU07SUFFTixDQUFDO0lBRUQ7O09BRUc7SUFDSCxPQUFPO0lBRVAsQ0FBQztJQUVEOztPQUVHO0lBQ0gsT0FBTztJQUVQLENBQUM7Q0FDSjtBQTFCRCxzQ0EwQkMifQ==
|
@ -1,32 +1,67 @@
|
||||
import * as plugins from './npmextra.plugins'
|
||||
import * as paths from './npmextra.paths'
|
||||
|
||||
export type keyValueStoreTypes = 'path' | 'gitProject'
|
||||
export type keyValueStoreTypes = 'path' | 'gitProject' | 'customString'
|
||||
|
||||
|
||||
export class KeyValueStore {
|
||||
constructor(optionsArg: {
|
||||
type: keyValueStoreTypes
|
||||
}) {
|
||||
|
||||
type: string // the type of the kvStore
|
||||
identity: string // the identity of the kvStore
|
||||
filePath: string // the filePath of the kvStore
|
||||
constructor(typeArg: keyValueStoreTypes, identityStringArg?: string) {
|
||||
// set kvStoreType
|
||||
this.type = typeArg
|
||||
this.initIdentity(identityStringArg)
|
||||
this.initFilePath()
|
||||
}
|
||||
|
||||
/**
|
||||
* reads a keyValueFile from disk
|
||||
*/
|
||||
kvRead() {
|
||||
* reads a keyValueFile from disk
|
||||
*/
|
||||
read() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* writes a key value file to disk
|
||||
*/
|
||||
kvWrite() {
|
||||
write() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* wipes a key value store from disk
|
||||
*/
|
||||
kevWipe() {
|
||||
wipe() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* updates a value
|
||||
*/
|
||||
update() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* computes the identity
|
||||
*/
|
||||
private initIdentity(identityStringArg: string){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* computes the filePath
|
||||
*/
|
||||
private initFilePath() {
|
||||
let baseDir: string
|
||||
if (this.type === 'customString') {
|
||||
baseDir = paths.kvCusomDir
|
||||
} else if (this.type === 'gitProject') {
|
||||
baseDir = paths.kvGitDir
|
||||
} else if (this.type === 'path') {
|
||||
baseDir = paths.kvPathDir
|
||||
}
|
||||
this.filePath = plugins.path.join(baseDir, this.identity + '.json')
|
||||
}
|
||||
}
|
||||
|
@ -4,5 +4,11 @@ import * as plugins from './npmextra.plugins'
|
||||
export let cwd = process.cwd()
|
||||
export let packageDir = plugins.path.join(__dirname,'../')
|
||||
|
||||
// keyValueStore specific
|
||||
export let kvBase = '~/.npmextra/kv'
|
||||
export let kvCusomDir = plugins.path.join(kvBase, 'custom')
|
||||
export let kvGitDir = plugins.path.join(kvBase, 'git')
|
||||
export let kvPathDir = plugins.path.join(kvBase, 'path')
|
||||
|
||||
// files
|
||||
export let configFile = plugins.path.join(cwd,'npmextra.json')
|
||||
|
Loading…
Reference in New Issue
Block a user