first working version

This commit is contained in:
2016-07-17 01:23:22 +02:00
parent 46ed6fc6df
commit 351c2aeadc
15 changed files with 139 additions and 2 deletions

27
ts/index.ts Normal file
View File

@@ -0,0 +1,27 @@
import * as plugins from "./npmextra.plugins"
import * as paths from "./npmextra.paths";
let allData;
export let dataFor = (toolNameArg:string,cwdArg?:string) => {
if(typeof allData == "undefined"){
let lookupPath;
if(cwdArg){
lookupPath = plugins.path.join(cwdArg,"npmextra.json");
} else {
lookupPath = paths.configFile;
};
allData = plugins.smartfile.fs.toObjectSync(
plugins.path.join(lookupPath)
);
};
if(toolNameArg){
if(allData[toolNameArg]){
return allData[toolNameArg];
} else {
plugins.beautylog.error(`There is no data for ${toolNameArg}`);
return undefined;
}
} else {
return allData;
}
}