fix compiled filenames

This commit is contained in:
Philipp Kunz 2016-09-24 21:53:44 +02:00
parent 513bb686ef
commit 4c3715f655
6 changed files with 100 additions and 4 deletions

View File

@ -0,0 +1,31 @@
export declare type keyValueStoreTypes = 'path' | 'gitProject' | 'customString';
export declare class KeyValueStore {
type: string;
identity: string;
filePath: string;
constructor(typeArg: keyValueStoreTypes, identityStringArg?: string);
/**
* reads a keyValueFile from disk
*/
read(): void;
/**
* writes a key value file to disk
*/
write(): void;
/**
* wipes a key value store from disk
*/
wipe(): void;
/**
* updates a value
*/
update(): void;
/**
* computes the identity
*/
private initIdentity(identityStringArg);
/**
* computes the filePath
*/
private initFilePath();
}

55
dist/npmextra.classes.keyvaluestore.js vendored Normal file
View File

@ -0,0 +1,55 @@
"use strict";
const plugins = require("./npmextra.plugins");
const paths = require("./npmextra.paths");
class KeyValueStore {
constructor(typeArg, identityStringArg) {
// set kvStoreType
this.type = typeArg;
this.initIdentity(identityStringArg);
this.initFilePath();
}
/**
* reads a keyValueFile from disk
*/
read() {
}
/**
* writes a key value file to disk
*/
write() {
}
/**
* wipes a key value store from disk
*/
wipe() {
}
/**
* updates a value
*/
update() {
}
/**
* computes the identity
*/
initIdentity(identityStringArg) {
}
/**
* computes the filePath
*/
initFilePath() {
let baseDir;
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');
plugins.smartfile.fs.ensureFileSync(this.filePath, '{}');
}
}
exports.KeyValueStore = KeyValueStore;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZXh0cmEuY2xhc3Nlcy5rZXl2YWx1ZXN0b3JlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtZXh0cmEuY2xhc3Nlcy5rZXl2YWx1ZXN0b3JlLnRzIl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FDLFFBQVEsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLFFBQVEsR0FBRyxPQUFPLENBQUMsQ0FBQTtRQUNuRSxPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBQyxJQUFJLENBQUMsQ0FBQTtJQUMzRCxDQUFDO0NBQ0o7QUE3REQsc0NBNkRDIn0=

View File

@ -1,3 +1,7 @@
export declare let cwd: string;
export declare let packageDir: string;
export declare let kvBase: string;
export declare let kvCusomDir: string;
export declare let kvGitDir: string;
export declare let kvPathDir: string;
export declare let configFile: string;

View File

@ -3,6 +3,11 @@ const plugins = require("./npmextra.plugins");
// directories
exports.cwd = process.cwd();
exports.packageDir = plugins.path.join(__dirname, '../');
// keyValueStore specific
exports.kvBase = '~/.npmextra/kv';
exports.kvCusomDir = plugins.path.join(exports.kvBase, 'custom');
exports.kvGitDir = plugins.path.join(exports.kvBase, 'git');
exports.kvPathDir = plugins.path.join(exports.kvBase, 'path');
// files
exports.configFile = plugins.path.join(exports.cwd, 'npmextra.json');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZXh0cmEucGF0aHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1leHRyYS5wYXRocy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsOENBQTZDO0FBRTdDLGNBQWM7QUFDSCxRQUFBLEdBQUcsR0FBRyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUE7QUFDbkIsUUFBQSxVQUFVLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFDLEtBQUssQ0FBQyxDQUFBO0FBRTFELFFBQVE7QUFDRyxRQUFBLFVBQVUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxXQUFHLEVBQUMsZUFBZSxDQUFDLENBQUEifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZXh0cmEucGF0aHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1leHRyYS5wYXRocy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsOENBQTZDO0FBRTdDLGNBQWM7QUFDSCxRQUFBLEdBQUcsR0FBRyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUE7QUFDbkIsUUFBQSxVQUFVLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFDLEtBQUssQ0FBQyxDQUFBO0FBRTFELHlCQUF5QjtBQUNkLFFBQUEsTUFBTSxHQUFHLGdCQUFnQixDQUFBO0FBQ3pCLFFBQUEsVUFBVSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLGNBQU0sRUFBRSxRQUFRLENBQUMsQ0FBQTtBQUNoRCxRQUFBLFFBQVEsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxjQUFNLEVBQUUsS0FBSyxDQUFDLENBQUE7QUFDM0MsUUFBQSxTQUFTLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsY0FBTSxFQUFFLE1BQU0sQ0FBQyxDQUFBO0FBRXhELFFBQVE7QUFDRyxRQUFBLFVBQVUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxXQUFHLEVBQUMsZUFBZSxDQUFDLENBQUEifQ==

View File

@ -22,7 +22,7 @@
"beautylog": "^5.0.23",
"lodash": "^4.16.1",
"q": "^1.4.1",
"smartfile": "^4.0.20",
"smartfile": "^4.0.21",
"typings-global": "^1.0.14"
},
"devDependencies": {

View File

@ -46,10 +46,10 @@ export class KeyValueStore {
/**
* computes the identity
*/
private initIdentity(identityStringArg: string){
private initIdentity(identityStringArg: string) {
}
/**
* computes the filePath
*/
@ -63,5 +63,6 @@ export class KeyValueStore {
baseDir = paths.kvPathDir
}
this.filePath = plugins.path.join(baseDir, this.identity + '.json')
plugins.smartfile.fs.ensureFileSync(this.filePath,'{}')
}
}