added back ts generics
This commit is contained in:
parent
83108ce02d
commit
b0dbb9b8a0
14
README.md
14
README.md
@ -32,16 +32,16 @@ npmextra.json
|
|||||||
```
|
```
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import * as npmextra from 'npmextra'
|
import { Npmextra } from 'npmextra'
|
||||||
|
|
||||||
npmextra.dataFor({
|
let myNpmExtra = new Npmextra('my/path/to/cwd') // cwd argument is optional
|
||||||
toolName:'sometool',
|
mergedData = myNpmExtra.dataFor(
|
||||||
defaultSettings: { // gets merged with whatever is in the configfile
|
'sometool',
|
||||||
|
{ // gets merged with whatever is in the configfile
|
||||||
defaultKey1: 'defaultValue1', // so this will get overwritten with "awesomeValueFromConfig"
|
defaultKey1: 'defaultValue1', // so this will get overwritten with "awesomeValueFromConfig"
|
||||||
defaultKey2: 'defaultValue2' // this one will pass through unaltered
|
defaultKey2: 'defaultValue2' // this one will pass through unaltered
|
||||||
},
|
}
|
||||||
cwd?: string // lets you specifiy a custom current working directory to look for the npmextra.json
|
)
|
||||||
})
|
|
||||||
```
|
```
|
||||||
|
|
||||||
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)
|
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)
|
||||||
|
12
dist/npmextra.classes.keyValueStore.d.ts
vendored
12
dist/npmextra.classes.keyValueStore.d.ts
vendored
@ -3,4 +3,16 @@ export declare class KeyValueStore {
|
|||||||
constructor(optionsArg: {
|
constructor(optionsArg: {
|
||||||
type: keyValueStoreTypes;
|
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;
|
||||||
}
|
}
|
||||||
|
32
dist/npmextra.classes.keyValueStore.js
vendored
32
dist/npmextra.classes.keyValueStore.js
vendored
@ -2,21 +2,21 @@
|
|||||||
class KeyValueStore {
|
class KeyValueStore {
|
||||||
constructor(optionsArg) {
|
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;
|
exports.KeyValueStore = KeyValueStore;
|
||||||
/**
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZXh0cmEuY2xhc3Nlcy5rZXl2YWx1ZXN0b3JlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtZXh0cmEuY2xhc3Nlcy5rZXl2YWx1ZXN0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFLQTtJQUNJLFlBQVksVUFFWDtJQUVELENBQUM7SUFDRDs7R0FFRDtJQUNDLE1BQU07SUFFTixDQUFDO0lBRUQ7O09BRUc7SUFDSCxPQUFPO0lBRVAsQ0FBQztJQUVEOztPQUVHO0lBQ0gsT0FBTztJQUVQLENBQUM7Q0FDSjtBQTFCRCxzQ0EwQkMifQ==
|
||||||
* reads a keyValueFile from disk
|
|
||||||
*/
|
|
||||||
let kvRead = () => {
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* writes a key value file to disk
|
|
||||||
*/
|
|
||||||
let kvWrite = () => {
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* wipes a key value store from disk
|
|
||||||
*/
|
|
||||||
let kevWipe = () => {
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZXh0cmEuY2xhc3Nlcy5rZXl2YWx1ZXN0b3JlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtZXh0cmEuY2xhc3Nlcy5rZXl2YWx1ZXN0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFNQTtJQUNJLFlBQVksVUFFWDtJQUVELENBQUM7Q0FBQTtBQUxMLHNDQUtLO0FBQ0Q7O0VBRUQ7QUFDSCxJQUFJLE1BQU0sR0FBQztBQUVYLENBQUMsQ0FBQTtBQUVEOztHQUVHO0FBQ0gsSUFBSSxPQUFPLEdBQUM7QUFFWixDQUFDLENBQUE7QUFFRDs7R0FFRztBQUNILElBQUksT0FBTyxHQUFDO0FBRVosQ0FBQyxDQUFBIn0=
|
|
2
dist/npmextra.classes.npmextra.d.ts
vendored
2
dist/npmextra.classes.npmextra.d.ts
vendored
@ -13,7 +13,7 @@ export declare class Npmextra {
|
|||||||
/**
|
/**
|
||||||
* merges the supplied options with the ones from npmextra.json
|
* merges the supplied options with the ones from npmextra.json
|
||||||
*/
|
*/
|
||||||
dataFor(toolnameArg: string, defaultOptionsArg: any): any;
|
dataFor<IToolConfig>(toolnameArg: string, defaultOptionsArg: any): IToolConfig;
|
||||||
/**
|
/**
|
||||||
* checks if the JSON exists
|
* checks if the JSON exists
|
||||||
*/
|
*/
|
||||||
|
2
dist/npmextra.classes.npmextra.js
vendored
2
dist/npmextra.classes.npmextra.js
vendored
@ -61,4 +61,4 @@ class Npmextra {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Npmextra = Npmextra;
|
exports.Npmextra = Npmextra;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZXh0cmEuY2xhc3Nlcy5ucG1leHRyYS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL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sQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxDQUFBO0lBQ2xGLENBQUM7SUFFRDs7T0FFRztJQUNLLGVBQWU7UUFDbkIsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7WUFDWCxJQUFJLENBQUMsVUFBVSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUUsZUFBZSxDQUFDLENBQUE7UUFDbEUsQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ0osSUFBSSxDQUFDLFVBQVUsR0FBRyxLQUFLLENBQUMsVUFBVSxDQUFBO1FBQ3RDLENBQUM7UUFBQSxDQUFDO0lBQ04sQ0FBQztJQUVEOztPQUVHO0lBQ0sscUJBQXFCO1FBQ3pCLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDLENBQUM7WUFDMUIsSUFBSSxDQUFDLGdCQUFnQixHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUE7UUFDOUUsQ0FBQztJQUNMLENBQUM7Q0FFSjtBQTdERCw0QkE2REMifQ==
|
@ -3,7 +3,6 @@ import * as plugins from './npmextra.plugins'
|
|||||||
export type keyValueStoreTypes = 'path' | 'gitProject'
|
export type keyValueStoreTypes = 'path' | 'gitProject'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export class KeyValueStore {
|
export class KeyValueStore {
|
||||||
constructor(optionsArg: {
|
constructor(optionsArg: {
|
||||||
type: keyValueStoreTypes
|
type: keyValueStoreTypes
|
||||||
@ -13,21 +12,21 @@ export class KeyValueStore {
|
|||||||
/**
|
/**
|
||||||
* reads a keyValueFile from disk
|
* reads a keyValueFile from disk
|
||||||
*/
|
*/
|
||||||
let kvRead () {
|
kvRead() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* writes a key value file to disk
|
* writes a key value file to disk
|
||||||
*/
|
*/
|
||||||
let kvWrite () {
|
kvWrite() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wipes a key value store from disk
|
* wipes a key value store from disk
|
||||||
*/
|
*/
|
||||||
let kevWipe () {
|
kevWipe() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,9 @@ export class Npmextra {
|
|||||||
/**
|
/**
|
||||||
* merges the supplied options with the ones from npmextra.json
|
* merges the supplied options with the ones from npmextra.json
|
||||||
*/
|
*/
|
||||||
dataFor(toolnameArg: string, defaultOptionsArg: any) {
|
dataFor<IToolConfig>(toolnameArg: string, defaultOptionsArg: any): IToolConfig {
|
||||||
let npmextraToolOptions
|
let npmextraToolOptions
|
||||||
if(this.npmextraJsonData[toolnameArg]) {
|
if (this.npmextraJsonData[toolnameArg]) {
|
||||||
npmextraToolOptions = this.npmextraJsonData[toolnameArg]
|
npmextraToolOptions = this.npmextraJsonData[toolnameArg]
|
||||||
} else {
|
} else {
|
||||||
npmextraToolOptions = {}
|
npmextraToolOptions = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user