now using npmextra
This commit is contained in:
@ -1,33 +1,32 @@
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
import {npmtsOra} from "./npmts.promisechain";
|
||||
export var run = function(argvArg){
|
||||
var done = plugins.Q.defer();
|
||||
var config:any = {};
|
||||
var configPath = plugins.path.join(paths.cwd,"npmts.json");
|
||||
if(argvArg.notest){
|
||||
config.notest = true;
|
||||
}
|
||||
if(plugins.smartfile.fs.fileExistsSync(configPath)){
|
||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||
config = plugins.lodashObject.assign(
|
||||
config,
|
||||
plugins.smartfile.fs.toObjectSync(configPath)
|
||||
);
|
||||
switch (config.mode){
|
||||
case "default":
|
||||
case "custom":
|
||||
plugins.beautylog.ok("mode is " + config.mode.yellow);
|
||||
done.resolve(config);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||
process.exit(1);
|
||||
};
|
||||
} else {
|
||||
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
|
||||
config.mode = "default";
|
||||
done.resolve(config);
|
||||
let done = plugins.Q.defer();
|
||||
npmtsOra.text("looking for npmextra.json");
|
||||
let defaultConfig = {
|
||||
mode: "default",
|
||||
notest:false
|
||||
};
|
||||
if(argvArg.notest){
|
||||
defaultConfig.notest = true;
|
||||
};
|
||||
let config = plugins.npmextra.dataFor({
|
||||
toolName:"npmts",
|
||||
defaultSettings:defaultConfig,
|
||||
cwd:paths.cwd
|
||||
});
|
||||
switch (config.mode){
|
||||
case "default":
|
||||
case "custom":
|
||||
plugins.beautylog.ok("mode is " + config.mode.yellow);
|
||||
done.resolve(config);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||
process.exit(1);
|
||||
};
|
||||
done.resolve(config);
|
||||
return done.promise;
|
||||
};
|
@ -12,6 +12,7 @@ export let g = {
|
||||
typedoc: require("gulp-typedoc")
|
||||
};
|
||||
export let lodashObject = require('lodash/fp/object');
|
||||
export import npmextra = require("npmextra");
|
||||
export import projectinfo = require("projectinfo");
|
||||
export import path = require("path");
|
||||
export import Q = require("q");
|
||||
|
Reference in New Issue
Block a user