work in progress
This commit is contained in:
parent
fea330b8ff
commit
8f72b3f2af
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,9 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
.settings/
|
.settings/
|
||||||
.idea/
|
.idea/
|
||||||
|
coverage/
|
||||||
|
docs/
|
||||||
|
|
||||||
|
|
||||||
ts/*.js
|
ts/*.js
|
||||||
ts/*.js.map
|
ts/*.js.map
|
||||||
|
263
index.js
263
index.js
@ -1,263 +0,0 @@
|
|||||||
/// <reference path="./index.ts" />
|
|
||||||
var smartcliPlugins;
|
|
||||||
(function (smartcliPlugins) {
|
|
||||||
var plugins = {};
|
|
||||||
function init() {
|
|
||||||
plugins.path = require("path");
|
|
||||||
plugins.beautylog = require("beautylog")("os");
|
|
||||||
plugins.cliff = require("cliff");
|
|
||||||
plugins.inquirer = require("inquirer");
|
|
||||||
plugins.smartparam = require("smartparam");
|
|
||||||
plugins.argv = require('yargs').argv;
|
|
||||||
return plugins;
|
|
||||||
}
|
|
||||||
smartcliPlugins.init = init;
|
|
||||||
})(smartcliPlugins || (smartcliPlugins = {}));
|
|
||||||
/// <reference path="index.ts" />
|
|
||||||
/// <reference path="./index.ts" />
|
|
||||||
var SmartcliChecks;
|
|
||||||
(function (SmartcliChecks) {
|
|
||||||
function init() {
|
|
||||||
/**
|
|
||||||
* all functions in smartcli.check return a boolean
|
|
||||||
* @type {{}}
|
|
||||||
*/
|
|
||||||
smartcli.check = {};
|
|
||||||
/**
|
|
||||||
* checks for a special command string and returns true if found.
|
|
||||||
* @param commandString
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
smartcli.check.command = function (commandString) {
|
|
||||||
if (plugins.argv._.indexOf(commandString) == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* checks if a command is present, returns true if yes, false if no.
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
smartcli.check.commandPresence = function () {
|
|
||||||
if (plugins.argv._.length > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* checks for an special command argument at a certain position, returns true if matches, returns false if not
|
|
||||||
* @param level
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
smartcli.check.commandArgument = function (commandArgumentString, level) {
|
|
||||||
if (level === void 0) { level = 1; }
|
|
||||||
if (smartcli.check.commandArgumentPresence(level) && (plugins.argv._[level] == commandArgumentString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
smartcli.check.commandArgumentPresence = function (level) {
|
|
||||||
if (level === void 0) { level = 1; }
|
|
||||||
if (plugins.argv._.length >= (level + 1)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* checks for a specific option string, returns true if yes, returns false if no
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
smartcli.check.option = function (optionString) {
|
|
||||||
if (plugins.smartparam.exists(plugins.argv, optionString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
smartcli.check.optionPresence = function () {
|
|
||||||
if (plugins.argv.indexOf() != -1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
SmartcliChecks.init = init;
|
|
||||||
})(SmartcliChecks || (SmartcliChecks = {}));
|
|
||||||
/// <reference path="./index.ts" />
|
|
||||||
var SmartcliGetters;
|
|
||||||
(function (SmartcliGetters) {
|
|
||||||
function init() {
|
|
||||||
smartcli.get = {};
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param commandString
|
|
||||||
* @returns {{specified: boolean, name: any, arguments: CliCommandArgument}}
|
|
||||||
*/
|
|
||||||
smartcli.get.command = function () {
|
|
||||||
var cliCommand = {
|
|
||||||
specified: smartcli.check.commandPresence(),
|
|
||||||
name: plugins.argv._[0],
|
|
||||||
arguments: smartcli.get.commandArgs()
|
|
||||||
};
|
|
||||||
return cliCommand;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* gets the second or higher value of plugins.argv._ if specified and returns it as commandArgument
|
|
||||||
* @param argumentLevel
|
|
||||||
* @returns {{specified: (boolean|boolean), name}}
|
|
||||||
*/
|
|
||||||
smartcli.get.commandArgument = function (argumentLevel) {
|
|
||||||
var commandArgument = {
|
|
||||||
specified: false,
|
|
||||||
name: "undefined",
|
|
||||||
level: argumentLevel
|
|
||||||
};
|
|
||||||
if (argumentLevel < 1) {
|
|
||||||
plugins.beautylog.error("smartcli.get.argument cannot be invoked with an argumentLevel smaller than 1");
|
|
||||||
return commandArgument;
|
|
||||||
}
|
|
||||||
if (smartcli.check.commandArgumentPresence(argumentLevel)) {
|
|
||||||
commandArgument.specified = true;
|
|
||||||
commandArgument.name = plugins.argv._[argumentLevel];
|
|
||||||
}
|
|
||||||
return commandArgument;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* returns array with commandArgs
|
|
||||||
* @returns {CliCommandArgument[]}
|
|
||||||
*/
|
|
||||||
smartcli.get.commandArgs = function () {
|
|
||||||
var commandArgs = [];
|
|
||||||
var argsArray = smartcli.get.commandArray().slice(0);
|
|
||||||
argsArray.shift();
|
|
||||||
for (var item in argsArray) {
|
|
||||||
var commandArgument = {
|
|
||||||
specified: true,
|
|
||||||
name: argsArray[item],
|
|
||||||
level: item + 1
|
|
||||||
};
|
|
||||||
commandArgs.push(commandArgument);
|
|
||||||
}
|
|
||||||
return commandArgs;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* returns complete command array
|
|
||||||
* @returns {any}
|
|
||||||
*/
|
|
||||||
smartcli.get.commandArray = function () {
|
|
||||||
var commandArray = plugins.argv._;
|
|
||||||
return commandArray;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* returns a cli option
|
|
||||||
* @param optionName
|
|
||||||
* @returns {CliOption}
|
|
||||||
*/
|
|
||||||
smartcli.get.option = function (optionName) {
|
|
||||||
var cliOption = {
|
|
||||||
name: optionName,
|
|
||||||
specified: false,
|
|
||||||
value: false
|
|
||||||
};
|
|
||||||
if (plugins.smartparam.exists(plugins.argv, optionName)) {
|
|
||||||
cliOption.name = optionName;
|
|
||||||
cliOption.specified = true;
|
|
||||||
cliOption.value = plugins.argv[optionName]; //we already know from the "if" above that the value is available.
|
|
||||||
}
|
|
||||||
return cliOption;
|
|
||||||
};
|
|
||||||
smartcli.get.options = function () {
|
|
||||||
var options = {};
|
|
||||||
for (var key in plugins.argv) {
|
|
||||||
if (key != "_") {
|
|
||||||
options['key'] = plugins.argv['key'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return options;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* returns Directory of cwd
|
|
||||||
* @returns {{path: string}}
|
|
||||||
*/
|
|
||||||
smartcli.get.cwd = function () {
|
|
||||||
return {
|
|
||||||
path: process.cwd()
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
SmartcliGetters.init = init;
|
|
||||||
})(SmartcliGetters || (SmartcliGetters = {}));
|
|
||||||
/// <reference path="./index.ts" />
|
|
||||||
var SmartcliInteraction;
|
|
||||||
(function (SmartcliInteraction) {
|
|
||||||
function init() {
|
|
||||||
smartcli.interaction = {};
|
|
||||||
/**
|
|
||||||
* executes callback with answer to question as argument
|
|
||||||
* @param questionString the question you want to ask the user
|
|
||||||
* @param cb the function to execute with answer as param
|
|
||||||
* @returns {null}
|
|
||||||
*/
|
|
||||||
smartcli.interaction.getAnswer = function (questionString, cb) {
|
|
||||||
if (typeof questionString != 'string') {
|
|
||||||
plugins.beautylog.error('no question specified');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//make inquirer compatible question object
|
|
||||||
var question = {
|
|
||||||
type: "input",
|
|
||||||
name: "userFeedback",
|
|
||||||
message: questionString,
|
|
||||||
validate: function (value) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
plugins.inquirer.prompt([question], function (answers) {
|
|
||||||
var answer = answers.userFeedback;
|
|
||||||
cb(answer);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param questionString
|
|
||||||
* @param choiceOptions
|
|
||||||
* @param cb
|
|
||||||
* @returns {null}
|
|
||||||
*/
|
|
||||||
smartcli.interaction.getChoice = function (questionString, choiceOptions, cb) {
|
|
||||||
if (!Array.isArray(choiceOptions)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//make inquirer compatible question object
|
|
||||||
var question = {
|
|
||||||
type: "list",
|
|
||||||
name: "userFeedback",
|
|
||||||
message: questionString,
|
|
||||||
choices: choiceOptions,
|
|
||||||
filter: function (val) { return val.toLowerCase(); }
|
|
||||||
};
|
|
||||||
plugins.inquirer.prompt(question, function (answers) {
|
|
||||||
var answer = answers.userFeedback;
|
|
||||||
cb(answer);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
SmartcliInteraction.init = init;
|
|
||||||
})(SmartcliInteraction || (SmartcliInteraction = {}));
|
|
||||||
/// <reference path="typings/tsd.d.ts" />
|
|
||||||
/// <reference path="./smartcli.plugins.ts" />
|
|
||||||
/// <reference path="./smartcli.interfaces.ts" />
|
|
||||||
/// <reference path="./smartcli.checks.ts" />
|
|
||||||
/// <reference path="./smartcli.getters.ts" />
|
|
||||||
/// <reference path="./smartcli.interaction.ts" />
|
|
||||||
var plugins = smartcliPlugins.init(); //get all the required npm modules under plugins
|
|
||||||
//define the smartcli object
|
|
||||||
var smartcli = {};
|
|
||||||
//add plugins from above for direct use
|
|
||||||
smartcli.inquirer = plugins.inquirer; //inquirer is for asking questions
|
|
||||||
smartcli.cliff = plugins.cliff; // formats cli output
|
|
||||||
smartcli.argv = plugins.argv; //argv gets initial cli commands and options.
|
|
||||||
//init checks. Checks return boolean. That means they can be used as question with an answer of yes or no.
|
|
||||||
SmartcliChecks.init(); // is defined in smartcli.checks.ts
|
|
||||||
SmartcliGetters.init(); // is defined in smartcli.getters.ts
|
|
||||||
SmartcliInteraction.init(); // is defined in smartcli.interaction.ts
|
|
||||||
module.exports = smartcli; // expose smartcli to outside world
|
|
15
package.json
15
package.json
@ -4,8 +4,8 @@
|
|||||||
"description": "nodejs wrapper for CLI related tasks",
|
"description": "nodejs wrapper for CLI related tasks",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(cd ts/compile && node compile.js) && (node test.js jazz jam --awesome --silent)",
|
"test": "(npmts)",
|
||||||
"mtest": "(cd ts/compile && gulp) && (node test.js jazz jam --awesome)",
|
"testm": "(cd ts/compile && gulp) && (node test.js jazz jam --awesome)",
|
||||||
"devTest": "(npm test) && (node test.js --test true)",
|
"devTest": "(npm test) && (node test.js --test true)",
|
||||||
"reinstall": "(rm -r node_modules && npm install)",
|
"reinstall": "(rm -r node_modules && npm install)",
|
||||||
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
|
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
|
||||||
@ -27,14 +27,15 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/smartcli",
|
"homepage": "https://github.com/pushrocks/smartcli",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "1.0.2",
|
"beautylog": "3.1.2",
|
||||||
"cliff": "^0.1.10",
|
"cliff": "^0.1.10",
|
||||||
"inquirer": "^0.11.0",
|
"inquirer": "^0.12.0",
|
||||||
"smartparam": "0.0.7",
|
"smartparam": "0.0.7",
|
||||||
"yargs": "^3.29.0"
|
"yargs": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "3.9.0",
|
"gulp": "3.9.1",
|
||||||
"gulp-typescript": "2.9.2"
|
"gulp-typescript": "2.11.0",
|
||||||
|
"npmts": "^3.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
/// <reference path="typings/tsd.d.ts" />
|
/// <reference path="typings/main.d.ts" />
|
||||||
var smartcli = require("./index.js");
|
var smartcli = require("../index.js");
|
||||||
var bl = require("beautylog")("os");
|
var beautylog = require("beautylog");
|
||||||
bl.log('now starting Test');
|
|
||||||
bl.log('starting with initial CLI commands and options');
|
|
||||||
var commandsString = 'You specified the following commands:';
|
var commandsString = 'You specified the following commands:';
|
||||||
var commands = smartcli.get.commandArray();
|
var commands = smartcli.get.commandArray();
|
||||||
for (var key in commands) {
|
for (var key in commands) {
|
||||||
commandsString = commandsString + ' ' + commands[key];
|
commandsString = commandsString + ' ' + commands[key];
|
||||||
}
|
}
|
||||||
bl.log(commandsString);
|
beautylog.log(commandsString);
|
||||||
/* ------------------------------------------------------------------ *
|
/* ------------------------------------------------------------------ *
|
||||||
* ------------------- CHECKS TESTS --------------------------------- *
|
* ------------------- CHECKS TESTS --------------------------------- *
|
||||||
* ------------------------------------------------------------------ */
|
* ------------------------------------------------------------------ */
|
||||||
@ -17,61 +15,61 @@ bl.log(commandsString);
|
|||||||
*/
|
*/
|
||||||
var checkCommandTest = function () {
|
var checkCommandTest = function () {
|
||||||
if (smartcli.check.command('jazz')) {
|
if (smartcli.check.command('jazz')) {
|
||||||
bl.success('One of your commands is jazz. It is supposed to be there. Perfect!');
|
beautylog.success('One of your commands is jazz. It is supposed to be there. Perfect!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error('None of your commands is jazz. You need to check this');
|
beautylog.error('None of your commands is jazz. You need to check this');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (!smartcli.check.command('punk')) {
|
if (!smartcli.check.command('punk')) {
|
||||||
bl.success('None of your commands is punk. It is not supposed to be there. Perfect!');
|
beautylog.success('None of your commands is punk. It is not supposed to be there. Perfect!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error('One of your commands seems to be punk. Something is wrong here');
|
beautylog.error('One of your commands seems to be punk. Something is wrong here');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
checkCommandTest();
|
checkCommandTest();
|
||||||
var checkCommandPresenceTest = function () {
|
var checkCommandPresenceTest = function () {
|
||||||
if (smartcli.check.commandPresence()) {
|
if (smartcli.check.commandPresence()) {
|
||||||
bl.success('There are commands present, like supposed to. Perfect!');
|
beautylog.success('There are commands present, like supposed to. Perfect!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error('There do not seem to be any commands present... This is wrong');
|
beautylog.error('There do not seem to be any commands present... This is wrong');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
checkCommandPresenceTest();
|
checkCommandPresenceTest();
|
||||||
var checkCommandArgumentTest = function () {
|
var checkCommandArgumentTest = function () {
|
||||||
if (smartcli.check.commandArgument("jam", 1)) {
|
if (smartcli.check.commandArgument("jam", 1)) {
|
||||||
bl.success('There is a level 1 argument! Perfect!');
|
beautylog.success('There is a level 1 argument! Perfect!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error('There seems to be no level 1 argument... This is wrong');
|
beautylog.error('There seems to be no level 1 argument... This is wrong');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (!smartcli.check.commandArgument("session", 2)) {
|
if (!smartcli.check.commandArgument("session", 2)) {
|
||||||
bl.success('There is no level 2 argument with the name of "session"! Perfect!');
|
beautylog.success('There is no level 2 argument with the name of "session"! Perfect!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error('There seems to be a level 2 argument with the name of "session"! This is wrong');
|
beautylog.error('There seems to be a level 2 argument with the name of "session"! This is wrong');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
checkCommandArgumentTest();
|
checkCommandArgumentTest();
|
||||||
var checkCommandArgumentPresenceTest = function () {
|
var checkCommandArgumentPresenceTest = function () {
|
||||||
if (smartcli.check.commandArgumentPresence(1)) {
|
if (smartcli.check.commandArgumentPresence(1)) {
|
||||||
bl.success('There is a level 1 argument! Perfect!');
|
beautylog.success('There is a level 1 argument! Perfect!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error('There seems to be no level 1 argument... This is wrong');
|
beautylog.error('There seems to be no level 1 argument... This is wrong');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (!smartcli.check.commandArgumentPresence(2)) {
|
if (!smartcli.check.commandArgumentPresence(2)) {
|
||||||
bl.success('There is no level 2 argument! Perfect!');
|
beautylog.success('There is no level 2 argument! Perfect!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error('There seems to be a level 2 argument... This is wrong');
|
beautylog.error('There seems to be a level 2 argument... This is wrong');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -82,10 +80,10 @@ checkCommandArgumentPresenceTest();
|
|||||||
var getCommandTest = function () {
|
var getCommandTest = function () {
|
||||||
var cliCommand = smartcli.get.command();
|
var cliCommand = smartcli.get.command();
|
||||||
if (cliCommand.name == "jazz") {
|
if (cliCommand.name == "jazz") {
|
||||||
bl.success('The specified command name is "jazz". Perfect!');
|
beautylog.success('The specified command name is "jazz". Perfect!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error('The specified command name is not "jazz". Something is wrong!');
|
beautylog.error('The specified command name is not "jazz". Something is wrong!');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -94,17 +92,17 @@ var getCommandArgumentTest = function () {
|
|||||||
var cliArgument = smartcli.get.commandArgument(1);
|
var cliArgument = smartcli.get.commandArgument(1);
|
||||||
var cliArgument2 = smartcli.get.commandArgument(2);
|
var cliArgument2 = smartcli.get.commandArgument(2);
|
||||||
if (cliArgument.name == "jam") {
|
if (cliArgument.name == "jam") {
|
||||||
bl.success('The first specified command argument name is "jam". Perfect!');
|
beautylog.success('The first specified command argument name is "jam". Perfect!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error('The first specified command argument name is not "jam". Something is wrong!');
|
beautylog.error('The first specified command argument name is not "jam". Something is wrong!');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (cliArgument2.name == "undefined") {
|
if (cliArgument2.name == "undefined") {
|
||||||
bl.success('The second specified command argument name is "undefined". Perfect!');
|
beautylog.success('The second specified command argument name is "undefined". Perfect!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error('The second specified command argument name is not "undefined". Something is wrong!');
|
beautylog.error('The second specified command argument name is not "undefined". Something is wrong!');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -112,10 +110,10 @@ getCommandArgumentTest();
|
|||||||
var getCommandArgsTest = function () {
|
var getCommandArgsTest = function () {
|
||||||
var commandArgs = smartcli.get.commandArgs();
|
var commandArgs = smartcli.get.commandArgs();
|
||||||
if (commandArgs[0].name == "jam") {
|
if (commandArgs[0].name == "jam") {
|
||||||
bl.success("first command argument is 'jam'. Perfect!");
|
beautylog.success("first command argument is 'jam'. Perfect!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error("first command argument is not 'jam'. Something is wromg!");
|
beautylog.error("first command argument is not 'jam'. Something is wromg!");
|
||||||
console.log(commandArgs[0].name);
|
console.log(commandArgs[0].name);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
@ -125,23 +123,23 @@ var getOptionTest = function () {
|
|||||||
var cliOption = smartcli.get.option("awesome");
|
var cliOption = smartcli.get.option("awesome");
|
||||||
var cliOption2 = smartcli.get.option("terrific");
|
var cliOption2 = smartcli.get.option("terrific");
|
||||||
if (cliOption.specified) {
|
if (cliOption.specified) {
|
||||||
bl.success("awesome is specified. Perfect!");
|
beautylog.success("awesome is specified. Perfect!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error("awesome is not specified. Somehthing is wrong");
|
beautylog.error("awesome is not specified. Somehthing is wrong");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (!cliOption2.specified) {
|
if (!cliOption2.specified) {
|
||||||
bl.success("terrific is not specified. Perfect!");
|
beautylog.success("terrific is not specified. Perfect!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.error("terrific is specified. Somehthing is wrong");
|
beautylog.error("terrific is specified. Somehthing is wrong");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getOptionTest();
|
getOptionTest();
|
||||||
var getCwdTest = function () {
|
var getCwdTest = function () {
|
||||||
bl.info('The current directory is: ' + smartcli.get.cwd().path);
|
beautylog.info('The current directory is: ' + smartcli.get.cwd().path);
|
||||||
};
|
};
|
||||||
getCwdTest();
|
getCwdTest();
|
||||||
/* ------------------------------------------------------------------ *
|
/* ------------------------------------------------------------------ *
|
||||||
@ -160,14 +158,15 @@ var interactionGetChoiceTest = function () {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
var endTests = function () {
|
var endTests = function () {
|
||||||
bl.ok("No more tests!");
|
beautylog.ok("No more tests!");
|
||||||
bl.success("Tests completed successfully!");
|
beautylog.success("Tests completed successfully!");
|
||||||
};
|
};
|
||||||
if (!smartcli.check.option("silent")) {
|
if (!smartcli.check.option("silent")) {
|
||||||
interactionGetAnswerTest();
|
interactionGetAnswerTest();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bl.info("--silent option is specified, thus we are not running interaction tests.");
|
beautylog.info("--silent option is specified, thus we are not running interaction tests.");
|
||||||
endTests();
|
endTests();
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
//# sourceMappingURL=test.js.map
|
1
test/test.js.map
Normal file
1
test/test.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -1,16 +1,13 @@
|
|||||||
/// <reference path="typings/tsd.d.ts" />
|
/// <reference path="typings/main.d.ts" />
|
||||||
var smartcli = require("./index.js");
|
var smartcli = require("../index.js");
|
||||||
var bl = require("beautylog")("os");
|
var beautylog = require("beautylog");
|
||||||
|
|
||||||
bl.log('now starting Test');
|
|
||||||
bl.log('starting with initial CLI commands and options');
|
|
||||||
|
|
||||||
var commandsString:string = 'You specified the following commands:';
|
var commandsString:string = 'You specified the following commands:';
|
||||||
var commands = smartcli.get.commandArray();
|
var commands = smartcli.get.commandArray();
|
||||||
for (var key in commands) {
|
for (var key in commands) {
|
||||||
commandsString = commandsString + ' ' + commands[key];
|
commandsString = commandsString + ' ' + commands[key];
|
||||||
}
|
}
|
||||||
bl.log(commandsString);
|
beautylog.log(commandsString);
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ *
|
/* ------------------------------------------------------------------ *
|
||||||
@ -23,15 +20,15 @@ bl.log(commandsString);
|
|||||||
*/
|
*/
|
||||||
var checkCommandTest = function() {
|
var checkCommandTest = function() {
|
||||||
if (smartcli.check.command('jazz')) {
|
if (smartcli.check.command('jazz')) {
|
||||||
bl.success('One of your commands is jazz. It is supposed to be there. Perfect!');
|
beautylog.success('One of your commands is jazz. It is supposed to be there. Perfect!');
|
||||||
} else {
|
} else {
|
||||||
bl.error('None of your commands is jazz. You need to check this');
|
beautylog.error('None of your commands is jazz. You need to check this');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (!smartcli.check.command('punk')) {
|
if (!smartcli.check.command('punk')) {
|
||||||
bl.success('None of your commands is punk. It is not supposed to be there. Perfect!');
|
beautylog.success('None of your commands is punk. It is not supposed to be there. Perfect!');
|
||||||
} else {
|
} else {
|
||||||
bl.error('One of your commands seems to be punk. Something is wrong here');
|
beautylog.error('One of your commands seems to be punk. Something is wrong here');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -40,9 +37,9 @@ checkCommandTest();
|
|||||||
|
|
||||||
var checkCommandPresenceTest = function() {
|
var checkCommandPresenceTest = function() {
|
||||||
if (smartcli.check.commandPresence()) {
|
if (smartcli.check.commandPresence()) {
|
||||||
bl.success('There are commands present, like supposed to. Perfect!');
|
beautylog.success('There are commands present, like supposed to. Perfect!');
|
||||||
} else {
|
} else {
|
||||||
bl.error('There do not seem to be any commands present... This is wrong');
|
beautylog.error('There do not seem to be any commands present... This is wrong');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -51,15 +48,15 @@ checkCommandPresenceTest();
|
|||||||
|
|
||||||
var checkCommandArgumentTest = function() {
|
var checkCommandArgumentTest = function() {
|
||||||
if (smartcli.check.commandArgument("jam",1)) {
|
if (smartcli.check.commandArgument("jam",1)) {
|
||||||
bl.success('There is a level 1 argument! Perfect!');
|
beautylog.success('There is a level 1 argument! Perfect!');
|
||||||
} else {
|
} else {
|
||||||
bl.error('There seems to be no level 1 argument... This is wrong');
|
beautylog.error('There seems to be no level 1 argument... This is wrong');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (!smartcli.check.commandArgument("session",2)) {
|
if (!smartcli.check.commandArgument("session",2)) {
|
||||||
bl.success('There is no level 2 argument with the name of "session"! Perfect!');
|
beautylog.success('There is no level 2 argument with the name of "session"! Perfect!');
|
||||||
} else {
|
} else {
|
||||||
bl.error('There seems to be a level 2 argument with the name of "session"! This is wrong');
|
beautylog.error('There seems to be a level 2 argument with the name of "session"! This is wrong');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -67,15 +64,15 @@ checkCommandArgumentTest();
|
|||||||
|
|
||||||
var checkCommandArgumentPresenceTest = function() {
|
var checkCommandArgumentPresenceTest = function() {
|
||||||
if (smartcli.check.commandArgumentPresence(1)) {
|
if (smartcli.check.commandArgumentPresence(1)) {
|
||||||
bl.success('There is a level 1 argument! Perfect!');
|
beautylog.success('There is a level 1 argument! Perfect!');
|
||||||
} else {
|
} else {
|
||||||
bl.error('There seems to be no level 1 argument... This is wrong');
|
beautylog.error('There seems to be no level 1 argument... This is wrong');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (!smartcli.check.commandArgumentPresence(2)) {
|
if (!smartcli.check.commandArgumentPresence(2)) {
|
||||||
bl.success('There is no level 2 argument! Perfect!');
|
beautylog.success('There is no level 2 argument! Perfect!');
|
||||||
} else {
|
} else {
|
||||||
bl.error('There seems to be a level 2 argument... This is wrong');
|
beautylog.error('There seems to be a level 2 argument... This is wrong');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -87,9 +84,9 @@ checkCommandArgumentPresenceTest();
|
|||||||
var getCommandTest = function(){
|
var getCommandTest = function(){
|
||||||
var cliCommand = smartcli.get.command();
|
var cliCommand = smartcli.get.command();
|
||||||
if(cliCommand.name == "jazz") {
|
if(cliCommand.name == "jazz") {
|
||||||
bl.success('The specified command name is "jazz". Perfect!');
|
beautylog.success('The specified command name is "jazz". Perfect!');
|
||||||
} else {
|
} else {
|
||||||
bl.error('The specified command name is not "jazz". Something is wrong!');
|
beautylog.error('The specified command name is not "jazz". Something is wrong!');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,16 +97,16 @@ var getCommandArgumentTest = function() {
|
|||||||
var cliArgument = smartcli.get.commandArgument(1);
|
var cliArgument = smartcli.get.commandArgument(1);
|
||||||
var cliArgument2 = smartcli.get.commandArgument(2);
|
var cliArgument2 = smartcli.get.commandArgument(2);
|
||||||
if(cliArgument.name == "jam") {
|
if(cliArgument.name == "jam") {
|
||||||
bl.success('The first specified command argument name is "jam". Perfect!');
|
beautylog.success('The first specified command argument name is "jam". Perfect!');
|
||||||
} else {
|
} else {
|
||||||
bl.error('The first specified command argument name is not "jam". Something is wrong!');
|
beautylog.error('The first specified command argument name is not "jam". Something is wrong!');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cliArgument2.name == "undefined") {
|
if(cliArgument2.name == "undefined") {
|
||||||
bl.success('The second specified command argument name is "undefined". Perfect!');
|
beautylog.success('The second specified command argument name is "undefined". Perfect!');
|
||||||
} else {
|
} else {
|
||||||
bl.error('The second specified command argument name is not "undefined". Something is wrong!');
|
beautylog.error('The second specified command argument name is not "undefined". Something is wrong!');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -118,9 +115,9 @@ getCommandArgumentTest();
|
|||||||
var getCommandArgsTest = function() {
|
var getCommandArgsTest = function() {
|
||||||
var commandArgs = smartcli.get.commandArgs();
|
var commandArgs = smartcli.get.commandArgs();
|
||||||
if(commandArgs[0].name == "jam") {
|
if(commandArgs[0].name == "jam") {
|
||||||
bl.success("first command argument is 'jam'. Perfect!");
|
beautylog.success("first command argument is 'jam'. Perfect!");
|
||||||
} else {
|
} else {
|
||||||
bl.error("first command argument is not 'jam'. Something is wromg!");
|
beautylog.error("first command argument is not 'jam'. Something is wromg!");
|
||||||
console.log(commandArgs[0].name);
|
console.log(commandArgs[0].name);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
@ -131,22 +128,22 @@ var getOptionTest = function() {
|
|||||||
var cliOption = smartcli.get.option("awesome");
|
var cliOption = smartcli.get.option("awesome");
|
||||||
var cliOption2 = smartcli.get.option("terrific");
|
var cliOption2 = smartcli.get.option("terrific");
|
||||||
if(cliOption.specified){
|
if(cliOption.specified){
|
||||||
bl.success("awesome is specified. Perfect!")
|
beautylog.success("awesome is specified. Perfect!")
|
||||||
} else {
|
} else {
|
||||||
bl.error("awesome is not specified. Somehthing is wrong");
|
beautylog.error("awesome is not specified. Somehthing is wrong");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if(!cliOption2.specified){
|
if(!cliOption2.specified){
|
||||||
bl.success("terrific is not specified. Perfect!")
|
beautylog.success("terrific is not specified. Perfect!")
|
||||||
} else {
|
} else {
|
||||||
bl.error("terrific is specified. Somehthing is wrong");
|
beautylog.error("terrific is specified. Somehthing is wrong");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getOptionTest();
|
getOptionTest();
|
||||||
|
|
||||||
var getCwdTest = function(){
|
var getCwdTest = function(){
|
||||||
bl.info('The current directory is: ' + smartcli.get.cwd().path);
|
beautylog.info('The current directory is: ' + smartcli.get.cwd().path);
|
||||||
};
|
};
|
||||||
getCwdTest();
|
getCwdTest();
|
||||||
|
|
||||||
@ -173,14 +170,14 @@ var interactionGetChoiceTest = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var endTests = function() {
|
var endTests = function() {
|
||||||
bl.ok("No more tests!");
|
beautylog.ok("No more tests!");
|
||||||
bl.success("Tests completed successfully!");
|
beautylog.success("Tests completed successfully!");
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!smartcli.check.option("silent")){
|
if(!smartcli.check.option("silent")){
|
||||||
interactionGetAnswerTest();
|
interactionGetAnswerTest();
|
||||||
} else {
|
} else {
|
||||||
bl.info("--silent option is specified, thus we are not running interaction tests.");
|
beautylog.info("--silent option is specified, thus we are not running interaction tests.");
|
||||||
endTests();
|
endTests();
|
||||||
};
|
};
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
// import gulp
|
|
||||||
var gulp = require("gulp"),
|
|
||||||
gulpTypescript = require("gulp-typescript");
|
|
||||||
|
|
||||||
gulp.task('compileTS', function() {
|
|
||||||
var stream = gulp.src('../index.ts')
|
|
||||||
.pipe(gulpTypescript({
|
|
||||||
out: "index.js"
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest("../../"));
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('compileTestTS', function() {
|
|
||||||
var stream = gulp.src('../test.ts')
|
|
||||||
.pipe(gulpTypescript({
|
|
||||||
out: "test.js"
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest("../../"));
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('default',['compileTS','compileTestTS'], function() {
|
|
||||||
console.log('Typescript compiled');
|
|
||||||
});
|
|
||||||
gulp.start.apply(gulp, ['default']);
|
|
@ -1,2 +0,0 @@
|
|||||||
# How to compile.
|
|
||||||
Make sure gulp and gulp-taypescript from npm are available. Then run the gulpfile in this directory.
|
|
28
ts/index.ts
28
ts/index.ts
@ -1,25 +1,25 @@
|
|||||||
/// <reference path="typings/tsd.d.ts" />
|
/// <reference path="typings/main.d.ts" />
|
||||||
/// <reference path="./smartcli.plugins.ts" />
|
|
||||||
/// <reference path="./smartcli.interfaces.ts" />
|
/// <reference path="./smartcli.interfaces.ts" />
|
||||||
/// <reference path="./smartcli.checks.ts" />
|
|
||||||
/// <reference path="./smartcli.getters.ts" />
|
/// <reference path="./smartcli.getters.ts" />
|
||||||
/// <reference path="./smartcli.interaction.ts" />
|
/// <reference path="./smartcli.interaction.ts" />
|
||||||
|
|
||||||
var plugins = smartcliPlugins.init(); //get all the required npm modules under plugins
|
import plugins = require("./smartcli.plugins");
|
||||||
|
import SmartcliChecks = require("./smartcli.checks");
|
||||||
|
|
||||||
|
/* ------------------------------------------------ *
|
||||||
|
* ---------- plugins for direct use -------------- *
|
||||||
|
* ------------------------------------------------ */
|
||||||
|
export let inquirer = plugins.inquirer; //inquirer is for asking questions
|
||||||
|
export let cliff = plugins.cliff; // formats cli output
|
||||||
|
export let argv = plugins.argv; //argv gets initial cli commands and options.
|
||||||
|
|
||||||
|
/* ------------------------------------------------ *
|
||||||
|
* ---------- checks -------------- *
|
||||||
|
* ------------------------------------------------ */
|
||||||
|
|
||||||
//define the smartcli object
|
|
||||||
var smartcli:any = {};
|
|
||||||
|
|
||||||
//add plugins from above for direct use
|
|
||||||
smartcli.inquirer = plugins.inquirer; //inquirer is for asking questions
|
|
||||||
smartcli.cliff = plugins.cliff; // formats cli output
|
|
||||||
smartcli.argv = plugins.argv; //argv gets initial cli commands and options.
|
|
||||||
|
|
||||||
//init checks. Checks return boolean. That means they can be used as question with an answer of yes or no.
|
//init checks. Checks return boolean. That means they can be used as question with an answer of yes or no.
|
||||||
|
|
||||||
SmartcliChecks.init(); // is defined in smartcli.checks.ts
|
|
||||||
SmartcliGetters.init(); // is defined in smartcli.getters.ts
|
SmartcliGetters.init(); // is defined in smartcli.getters.ts
|
||||||
SmartcliInteraction.init(); // is defined in smartcli.interaction.ts
|
SmartcliInteraction.init(); // is defined in smartcli.interaction.ts
|
||||||
|
|
||||||
|
|
||||||
module.exports = smartcli; // expose smartcli to outside world
|
|
||||||
|
@ -1,70 +1,63 @@
|
|||||||
/// <reference path="./index.ts" />
|
/// <reference path="typings/main.d.ts" />
|
||||||
module SmartcliChecks {
|
|
||||||
export function init() {
|
|
||||||
/**
|
|
||||||
* all functions in smartcli.check return a boolean
|
|
||||||
* @type {{}}
|
|
||||||
*/
|
|
||||||
smartcli.check = {};
|
|
||||||
|
|
||||||
/**
|
import plugins = require("./smartcli.plugins");
|
||||||
* checks for a special command string and returns true if found.
|
|
||||||
* @param commandString
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
smartcli.check.command = function(commandString:string):boolean {
|
|
||||||
if (plugins.argv._.indexOf(commandString) == 0) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks if a command is present, returns true if yes, false if no.
|
* checks for a special command string and returns true if found.
|
||||||
* @returns {boolean}
|
* @param commandString
|
||||||
*/
|
* @returns {boolean}
|
||||||
smartcli.check.commandPresence = function():boolean {
|
*/
|
||||||
if(plugins.argv._.length > 0){
|
export let command = function(commandString:string):boolean {
|
||||||
return true;
|
if (plugins.argv._.indexOf(commandString) == 0) {
|
||||||
}
|
return true
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* checks for an special command argument at a certain position, returns true if matches, returns false if not
|
|
||||||
* @param level
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
smartcli.check.commandArgument = function(commandArgumentString:string,level:number = 1):boolean {
|
|
||||||
if(smartcli.check.commandArgumentPresence(level) && (plugins.argv._[level] == commandArgumentString )) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
smartcli.check.commandArgumentPresence = function(level:number = 1) {
|
|
||||||
if(plugins.argv._.length >= (level + 1)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* checks for a specific option string, returns true if yes, returns false if no
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
smartcli.check.option = function(optionString):boolean {
|
|
||||||
if(plugins.smartparam.exists(plugins.argv, optionString)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
smartcli.check.optionPresence = function():boolean {
|
|
||||||
if (plugins.argv.indexOf() != -1) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks if a command is present, returns true if yes, false if no.
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export let commandPresence = function():boolean {
|
||||||
|
if(plugins.argv._.length > 0){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks for an special command argument at a certain position, returns true if matches, returns false if not
|
||||||
|
* @param level
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export let commandArgument = function(commandArgumentString:string,level:number = 1):boolean {
|
||||||
|
if(commandArgumentPresence(level) && (plugins.argv._[level] == commandArgumentString )) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
export let commandArgumentPresence = function(level:number = 1) {
|
||||||
|
if(plugins.argv._.length >= (level + 1)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks for a specific option string, returns true if yes, returns false if no
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export let option = function(optionString):boolean {
|
||||||
|
if(plugins.smartparam.exists(plugins.argv, optionString)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
export let optionPresence = function():boolean {
|
||||||
|
if (plugins.argv.indexOf() != -1) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
@ -1,4 +1,4 @@
|
|||||||
/// <reference path="./index.ts" />
|
/// <reference path="typings/main.d.ts" />
|
||||||
module SmartcliGetters {
|
module SmartcliGetters {
|
||||||
export function init() {
|
export function init() {
|
||||||
smartcli.get = {};
|
smartcli.get = {};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/// <reference path="./index.ts" />
|
/// <reference path="typings/main.d.ts" />
|
||||||
module SmartcliInteraction {
|
module SmartcliInteraction {
|
||||||
export function init(){
|
export function init(){
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/// <reference path="index.ts" />
|
/// <reference path="typings/main.d.ts" />
|
||||||
|
|
||||||
interface CliOption {
|
interface CliOption {
|
||||||
name: string;
|
name: string;
|
||||||
specified:boolean;
|
specified:boolean;
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
/// <reference path="./index.ts" />
|
/// <reference path="typings/main.d.ts" />
|
||||||
|
|
||||||
module smartcliPlugins {
|
export let path = require("path");
|
||||||
var plugins:any = {};
|
export let beautylog = require("beautylog");
|
||||||
export function init() {
|
export let cliff = require("cliff");
|
||||||
plugins.path = require("path");
|
export let inquirer = require("inquirer");
|
||||||
plugins.beautylog = require("beautylog")("os");
|
export let smartparam = require("smartparam");
|
||||||
plugins.cliff = require("cliff");
|
export let argv = require('yargs').argv;
|
||||||
plugins.inquirer = require("inquirer");
|
|
||||||
plugins.smartparam = require("smartparam");
|
|
||||||
plugins.argv = require('yargs').argv;
|
|
||||||
return plugins;
|
|
||||||
}
|
|
||||||
}
|
|
12
ts/tsd.json
12
ts/tsd.json
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "v4",
|
|
||||||
"repo": "borisyankov/DefinitelyTyped",
|
|
||||||
"ref": "master",
|
|
||||||
"path": "typings",
|
|
||||||
"bundle": "typings/tsd.d.ts",
|
|
||||||
"installed": {
|
|
||||||
"node/node.d.ts": {
|
|
||||||
"commit": "efa0c1196d7280640e624ac1e7fa604502e7bd63"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
5
ts/typings.json
Normal file
5
ts/typings.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"ambientDependencies": {
|
||||||
|
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts"
|
||||||
|
}
|
||||||
|
}
|
1
ts/typings/browser.d.ts
vendored
Normal file
1
ts/typings/browser.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/// <reference path="browser/ambient/node/node.d.ts" />
|
@ -1,14 +1,21 @@
|
|||||||
// Type definitions for Node.js v0.12.0
|
// Compiled using typings@0.6.4
|
||||||
|
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/node/node.d.ts
|
||||||
|
// Type definitions for Node.js v4.x
|
||||||
// Project: http://nodejs.org/
|
// Project: http://nodejs.org/
|
||||||
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/borisyankov/DefinitelyTyped>
|
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/borisyankov/DefinitelyTyped>
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* *
|
* *
|
||||||
* Node.js v0.12.0 API *
|
* Node.js v4.x API *
|
||||||
* *
|
* *
|
||||||
************************************************/
|
************************************************/
|
||||||
|
|
||||||
|
interface Error {
|
||||||
|
stack?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// compat for TypeScript 1.5.3
|
// compat for TypeScript 1.5.3
|
||||||
// if you use with --target es3 or --target es5 and use below definitions,
|
// if you use with --target es3 or --target es5 and use below definitions,
|
||||||
// use the lib.es6.d.ts that is bundled with TypeScript 1.5.3.
|
// use the lib.es6.d.ts that is bundled with TypeScript 1.5.3.
|
||||||
@ -108,13 +115,19 @@ declare var Buffer: {
|
|||||||
* @param array The octets to store.
|
* @param array The octets to store.
|
||||||
*/
|
*/
|
||||||
new (array: any[]): Buffer;
|
new (array: any[]): Buffer;
|
||||||
|
/**
|
||||||
|
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
||||||
|
*
|
||||||
|
* @param buffer The buffer to copy.
|
||||||
|
*/
|
||||||
|
new (buffer: Buffer): Buffer;
|
||||||
prototype: Buffer;
|
prototype: Buffer;
|
||||||
/**
|
/**
|
||||||
* Returns true if {obj} is a Buffer
|
* Returns true if {obj} is a Buffer
|
||||||
*
|
*
|
||||||
* @param obj object to test.
|
* @param obj object to test.
|
||||||
*/
|
*/
|
||||||
isBuffer(obj: any): boolean;
|
isBuffer(obj: any): obj is Buffer;
|
||||||
/**
|
/**
|
||||||
* Returns true if {encoding} is a valid encoding argument.
|
* Returns true if {encoding} is a valid encoding argument.
|
||||||
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
||||||
@ -168,9 +181,11 @@ declare module NodeJS {
|
|||||||
once(event: string, listener: Function): EventEmitter;
|
once(event: string, listener: Function): EventEmitter;
|
||||||
removeListener(event: string, listener: Function): EventEmitter;
|
removeListener(event: string, listener: Function): EventEmitter;
|
||||||
removeAllListeners(event?: string): EventEmitter;
|
removeAllListeners(event?: string): EventEmitter;
|
||||||
setMaxListeners(n: number): void;
|
setMaxListeners(n: number): EventEmitter;
|
||||||
|
getMaxListeners(): number;
|
||||||
listeners(event: string): Function[];
|
listeners(event: string): Function[];
|
||||||
emit(event: string, ...args: any[]): boolean;
|
emit(event: string, ...args: any[]): boolean;
|
||||||
|
listenerCount(type: string): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReadableStream extends EventEmitter {
|
export interface ReadableStream extends EventEmitter {
|
||||||
@ -188,8 +203,7 @@ declare module NodeJS {
|
|||||||
|
|
||||||
export interface WritableStream extends EventEmitter {
|
export interface WritableStream extends EventEmitter {
|
||||||
writable: boolean;
|
writable: boolean;
|
||||||
write(buffer: Buffer, cb?: Function): boolean;
|
write(buffer: Buffer|string, cb?: Function): boolean;
|
||||||
write(str: string, cb?: Function): boolean;
|
|
||||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
write(str: string, encoding?: string, cb?: Function): boolean;
|
||||||
end(): void;
|
end(): void;
|
||||||
end(buffer: Buffer, cb?: Function): void;
|
end(buffer: Buffer, cb?: Function): void;
|
||||||
@ -252,7 +266,7 @@ declare module NodeJS {
|
|||||||
visibility: string;
|
visibility: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
kill(pid: number, signal?: string): void;
|
kill(pid:number, signal?: string|number): void;
|
||||||
pid: number;
|
pid: number;
|
||||||
title: string;
|
title: string;
|
||||||
arch: string;
|
arch: string;
|
||||||
@ -330,6 +344,7 @@ declare module NodeJS {
|
|||||||
undefined: typeof undefined;
|
undefined: typeof undefined;
|
||||||
unescape: (str: string) => string;
|
unescape: (str: string) => string;
|
||||||
gc: () => void;
|
gc: () => void;
|
||||||
|
v8debug?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Timer {
|
export interface Timer {
|
||||||
@ -373,21 +388,22 @@ interface NodeBuffer {
|
|||||||
readFloatBE(offset: number, noAssert?: boolean): number;
|
readFloatBE(offset: number, noAssert?: boolean): number;
|
||||||
readDoubleLE(offset: number, noAssert?: boolean): number;
|
readDoubleLE(offset: number, noAssert?: boolean): number;
|
||||||
readDoubleBE(offset: number, noAssert?: boolean): number;
|
readDoubleBE(offset: number, noAssert?: boolean): number;
|
||||||
writeUInt8(value: number, offset: number, noAssert?: boolean): void;
|
writeUInt8(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeUInt16LE(value: number, offset: number, noAssert?: boolean): void;
|
writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeUInt16BE(value: number, offset: number, noAssert?: boolean): void;
|
writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeUInt32LE(value: number, offset: number, noAssert?: boolean): void;
|
writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeUInt32BE(value: number, offset: number, noAssert?: boolean): void;
|
writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeInt8(value: number, offset: number, noAssert?: boolean): void;
|
writeInt8(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeInt16LE(value: number, offset: number, noAssert?: boolean): void;
|
writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeInt16BE(value: number, offset: number, noAssert?: boolean): void;
|
writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeInt32LE(value: number, offset: number, noAssert?: boolean): void;
|
writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeInt32BE(value: number, offset: number, noAssert?: boolean): void;
|
writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeFloatLE(value: number, offset: number, noAssert?: boolean): void;
|
writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeFloatBE(value: number, offset: number, noAssert?: boolean): void;
|
writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeDoubleLE(value: number, offset: number, noAssert?: boolean): void;
|
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
writeDoubleBE(value: number, offset: number, noAssert?: boolean): void;
|
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
||||||
fill(value: any, offset?: number, end?: number): void;
|
fill(value: any, offset?: number, end?: number): Buffer;
|
||||||
|
indexOf(value: string | number | Buffer, byteOffset?: number): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
@ -400,25 +416,39 @@ declare module "buffer" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module "querystring" {
|
declare module "querystring" {
|
||||||
export function stringify(obj: any, sep?: string, eq?: string): string;
|
export interface StringifyOptions {
|
||||||
export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any;
|
encodeURIComponent?: Function;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ParseOptions {
|
||||||
|
maxKeys?: number;
|
||||||
|
decodeURIComponent?: Function;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function stringify<T>(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string;
|
||||||
|
export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): any;
|
||||||
|
export function parse<T extends {}>(str: string, sep?: string, eq?: string, options?: ParseOptions): T;
|
||||||
export function escape(str: string): string;
|
export function escape(str: string): string;
|
||||||
export function unescape(str: string): string;
|
export function unescape(str: string): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "events" {
|
declare module "events" {
|
||||||
export class EventEmitter implements NodeJS.EventEmitter {
|
export class EventEmitter implements NodeJS.EventEmitter {
|
||||||
static listenerCount(emitter: EventEmitter, event: string): number;
|
static EventEmitter: EventEmitter;
|
||||||
|
static listenerCount(emitter: EventEmitter, event: string): number; // deprecated
|
||||||
|
static defaultMaxListeners: number;
|
||||||
|
|
||||||
addListener(event: string, listener: Function): EventEmitter;
|
addListener(event: string, listener: Function): EventEmitter;
|
||||||
on(event: string, listener: Function): EventEmitter;
|
on(event: string, listener: Function): EventEmitter;
|
||||||
once(event: string, listener: Function): EventEmitter;
|
once(event: string, listener: Function): EventEmitter;
|
||||||
removeListener(event: string, listener: Function): EventEmitter;
|
removeListener(event: string, listener: Function): EventEmitter;
|
||||||
removeAllListeners(event?: string): EventEmitter;
|
removeAllListeners(event?: string): EventEmitter;
|
||||||
setMaxListeners(n: number): void;
|
setMaxListeners(n: number): EventEmitter;
|
||||||
|
getMaxListeners(): number;
|
||||||
listeners(event: string): Function[];
|
listeners(event: string): Function[];
|
||||||
emit(event: string, ...args: any[]): boolean;
|
emit(event: string, ...args: any[]): boolean;
|
||||||
}
|
listenerCount(type: string): number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "http" {
|
declare module "http" {
|
||||||
@ -426,6 +456,21 @@ declare module "http" {
|
|||||||
import * as net from "net";
|
import * as net from "net";
|
||||||
import * as stream from "stream";
|
import * as stream from "stream";
|
||||||
|
|
||||||
|
export interface RequestOptions {
|
||||||
|
protocol?: string;
|
||||||
|
host?: string;
|
||||||
|
hostname?: string;
|
||||||
|
family?: number;
|
||||||
|
port?: number;
|
||||||
|
localAddress?: string;
|
||||||
|
socketPath?: string;
|
||||||
|
method?: string;
|
||||||
|
path?: string;
|
||||||
|
headers?: { [key: string]: any };
|
||||||
|
auth?: string;
|
||||||
|
agent?: Agent|boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Server extends events.EventEmitter {
|
export interface Server extends events.EventEmitter {
|
||||||
listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server;
|
listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server;
|
||||||
listen(port: number, hostname?: string, callback?: Function): Server;
|
listen(port: number, hostname?: string, callback?: Function): Server;
|
||||||
@ -454,6 +499,7 @@ declare module "http" {
|
|||||||
writeHead(statusCode: number, headers?: any): void;
|
writeHead(statusCode: number, headers?: any): void;
|
||||||
statusCode: number;
|
statusCode: number;
|
||||||
statusMessage: string;
|
statusMessage: string;
|
||||||
|
headersSent: boolean;
|
||||||
setHeader(name: string, value: string): void;
|
setHeader(name: string, value: string): void;
|
||||||
sendDate: boolean;
|
sendDate: boolean;
|
||||||
getHeader(name: string): string;
|
getHeader(name: string): string;
|
||||||
@ -563,7 +609,7 @@ declare module "http" {
|
|||||||
};
|
};
|
||||||
export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server;
|
export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server;
|
||||||
export function createClient(port?: number, host?: string): any;
|
export function createClient(port?: number, host?: string): any;
|
||||||
export function request(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
|
export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||||
export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
|
export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||||
export var globalAgent: Agent;
|
export var globalAgent: Agent;
|
||||||
}
|
}
|
||||||
@ -599,6 +645,13 @@ declare module "cluster" {
|
|||||||
|
|
||||||
// Event emitter
|
// Event emitter
|
||||||
export function addListener(event: string, listener: Function): void;
|
export function addListener(event: string, listener: Function): void;
|
||||||
|
export function on(event: "disconnect", listener: (worker: Worker) => void): void;
|
||||||
|
export function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): void;
|
||||||
|
export function on(event: "fork", listener: (worker: Worker) => void): void;
|
||||||
|
export function on(event: "listening", listener: (worker: Worker, address: any) => void): void;
|
||||||
|
export function on(event: "message", listener: (worker: Worker, message: any) => void): void;
|
||||||
|
export function on(event: "online", listener: (worker: Worker) => void): void;
|
||||||
|
export function on(event: "setup", listener: (settings: any) => void): void;
|
||||||
export function on(event: string, listener: Function): any;
|
export function on(event: string, listener: Function): any;
|
||||||
export function once(event: string, listener: Function): void;
|
export function once(event: string, listener: Function): void;
|
||||||
export function removeListener(event: string, listener: Function): void;
|
export function removeListener(event: string, listener: Function): void;
|
||||||
@ -678,7 +731,29 @@ declare module "zlib" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module "os" {
|
declare module "os" {
|
||||||
|
export interface CpuInfo {
|
||||||
|
model: string;
|
||||||
|
speed: number;
|
||||||
|
times: {
|
||||||
|
user: number;
|
||||||
|
nice: number;
|
||||||
|
sys: number;
|
||||||
|
idle: number;
|
||||||
|
irq: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NetworkInterfaceInfo {
|
||||||
|
address: string;
|
||||||
|
netmask: string;
|
||||||
|
family: string;
|
||||||
|
mac: string;
|
||||||
|
internal: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export function tmpdir(): string;
|
export function tmpdir(): string;
|
||||||
|
export function homedir(): string;
|
||||||
|
export function endianness(): string;
|
||||||
export function hostname(): string;
|
export function hostname(): string;
|
||||||
export function type(): string;
|
export function type(): string;
|
||||||
export function platform(): string;
|
export function platform(): string;
|
||||||
@ -688,8 +763,8 @@ declare module "os" {
|
|||||||
export function loadavg(): number[];
|
export function loadavg(): number[];
|
||||||
export function totalmem(): number;
|
export function totalmem(): number;
|
||||||
export function freemem(): number;
|
export function freemem(): number;
|
||||||
export function cpus(): { model: string; speed: number; times: { user: number; nice: number; sys: number; idle: number; irq: number; }; }[];
|
export function cpus(): CpuInfo[];
|
||||||
export function networkInterfaces(): any;
|
export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]};
|
||||||
export var EOL: string;
|
export var EOL: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,15 +788,7 @@ declare module "https" {
|
|||||||
SNICallback?: (servername: string) => any;
|
SNICallback?: (servername: string) => any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RequestOptions {
|
export interface RequestOptions extends http.RequestOptions{
|
||||||
host?: string;
|
|
||||||
hostname?: string;
|
|
||||||
port?: number;
|
|
||||||
path?: string;
|
|
||||||
method?: string;
|
|
||||||
headers?: any;
|
|
||||||
auth?: string;
|
|
||||||
agent?: any;
|
|
||||||
pfx?: any;
|
pfx?: any;
|
||||||
key?: any;
|
key?: any;
|
||||||
passphrase?: string;
|
passphrase?: string;
|
||||||
@ -729,6 +796,7 @@ declare module "https" {
|
|||||||
ca?: any;
|
ca?: any;
|
||||||
ciphers?: string;
|
ciphers?: string;
|
||||||
rejectUnauthorized?: boolean;
|
rejectUnauthorized?: boolean;
|
||||||
|
secureProtocol?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Agent {
|
export interface Agent {
|
||||||
@ -753,7 +821,7 @@ declare module "punycode" {
|
|||||||
export function toASCII(domain: string): string;
|
export function toASCII(domain: string): string;
|
||||||
export var ucs2: ucs2;
|
export var ucs2: ucs2;
|
||||||
interface ucs2 {
|
interface ucs2 {
|
||||||
decode(string: string): string;
|
decode(string: string): number[];
|
||||||
encode(codePoints: number[]): string;
|
encode(codePoints: number[]): string;
|
||||||
}
|
}
|
||||||
export var version: any;
|
export var version: any;
|
||||||
@ -781,22 +849,49 @@ declare module "readline" {
|
|||||||
import * as events from "events";
|
import * as events from "events";
|
||||||
import * as stream from "stream";
|
import * as stream from "stream";
|
||||||
|
|
||||||
|
export interface Key {
|
||||||
|
sequence?: string;
|
||||||
|
name?: string;
|
||||||
|
ctrl?: boolean;
|
||||||
|
meta?: boolean;
|
||||||
|
shift?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ReadLine extends events.EventEmitter {
|
export interface ReadLine extends events.EventEmitter {
|
||||||
setPrompt(prompt: string): void;
|
setPrompt(prompt: string): void;
|
||||||
prompt(preserveCursor?: boolean): void;
|
prompt(preserveCursor?: boolean): void;
|
||||||
question(query: string, callback: Function): void;
|
question(query: string, callback: (answer: string) => void): void;
|
||||||
pause(): void;
|
pause(): ReadLine;
|
||||||
resume(): void;
|
resume(): ReadLine;
|
||||||
close(): void;
|
close(): void;
|
||||||
write(data: any, key?: any): void;
|
write(data: string|Buffer, key?: Key): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Completer {
|
||||||
|
(line: string): CompleterResult;
|
||||||
|
(line: string, callback: (err: any, result: CompleterResult) => void): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CompleterResult {
|
||||||
|
completions: string[];
|
||||||
|
line: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ReadLineOptions {
|
export interface ReadLineOptions {
|
||||||
input: NodeJS.ReadableStream;
|
input: NodeJS.ReadableStream;
|
||||||
output: NodeJS.WritableStream;
|
output?: NodeJS.WritableStream;
|
||||||
completer?: Function;
|
completer?: Completer;
|
||||||
terminal?: boolean;
|
terminal?: boolean;
|
||||||
|
historySize?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean): ReadLine;
|
||||||
export function createInterface(options: ReadLineOptions): ReadLine;
|
export function createInterface(options: ReadLineOptions): ReadLine;
|
||||||
|
|
||||||
|
export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void;
|
||||||
|
export function moveCursor(stream: NodeJS.WritableStream, dx: number|string, dy: number|string): void;
|
||||||
|
export function clearLine(stream: NodeJS.WritableStream, dir: number): void;
|
||||||
|
export function clearScreenDown(stream: NodeJS.WritableStream): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "vm" {
|
declare module "vm" {
|
||||||
@ -856,14 +951,38 @@ declare module "child_process" {
|
|||||||
env?: any;
|
env?: any;
|
||||||
encoding?: string;
|
encoding?: string;
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
maxBuffer?: string;
|
maxBuffer?: number;
|
||||||
killSignal?: string;
|
killSignal?: string;
|
||||||
}, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
}, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
|
||||||
export function fork(modulePath: string, args?: string[], options?: {
|
export function fork(modulePath: string, args?: string[], options?: {
|
||||||
cwd?: string;
|
cwd?: string;
|
||||||
env?: any;
|
env?: any;
|
||||||
encoding?: string;
|
execPath?: string;
|
||||||
|
execArgv?: string[];
|
||||||
|
silent?: boolean;
|
||||||
|
uid?: number;
|
||||||
|
gid?: number;
|
||||||
}): ChildProcess;
|
}): ChildProcess;
|
||||||
|
export function spawnSync(command: string, args?: string[], options?: {
|
||||||
|
cwd?: string;
|
||||||
|
input?: string | Buffer;
|
||||||
|
stdio?: any;
|
||||||
|
env?: any;
|
||||||
|
uid?: number;
|
||||||
|
gid?: number;
|
||||||
|
timeout?: number;
|
||||||
|
maxBuffer?: number;
|
||||||
|
killSignal?: string;
|
||||||
|
encoding?: string;
|
||||||
|
}): {
|
||||||
|
pid: number;
|
||||||
|
output: string[];
|
||||||
|
stdout: string | Buffer;
|
||||||
|
stderr: string | Buffer;
|
||||||
|
status: number;
|
||||||
|
signal: string;
|
||||||
|
error: Error;
|
||||||
|
};
|
||||||
export function execSync(command: string, options?: {
|
export function execSync(command: string, options?: {
|
||||||
cwd?: string;
|
cwd?: string;
|
||||||
input?: string|Buffer;
|
input?: string|Buffer;
|
||||||
@ -875,7 +994,7 @@ declare module "child_process" {
|
|||||||
maxBuffer?: number;
|
maxBuffer?: number;
|
||||||
killSignal?: string;
|
killSignal?: string;
|
||||||
encoding?: string;
|
encoding?: string;
|
||||||
}): ChildProcess;
|
}): string | Buffer;
|
||||||
export function execFileSync(command: string, args?: string[], options?: {
|
export function execFileSync(command: string, args?: string[], options?: {
|
||||||
cwd?: string;
|
cwd?: string;
|
||||||
input?: string|Buffer;
|
input?: string|Buffer;
|
||||||
@ -887,26 +1006,12 @@ declare module "child_process" {
|
|||||||
maxBuffer?: number;
|
maxBuffer?: number;
|
||||||
killSignal?: string;
|
killSignal?: string;
|
||||||
encoding?: string;
|
encoding?: string;
|
||||||
}): ChildProcess;
|
}): string | Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "url" {
|
declare module "url" {
|
||||||
export interface Url {
|
export interface Url {
|
||||||
href: string;
|
href?: string;
|
||||||
protocol: string;
|
|
||||||
auth: string;
|
|
||||||
hostname: string;
|
|
||||||
port: string;
|
|
||||||
host: string;
|
|
||||||
pathname: string;
|
|
||||||
search: string;
|
|
||||||
query: any; // string | Object
|
|
||||||
slashes: boolean;
|
|
||||||
hash?: string;
|
|
||||||
path?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UrlOptions {
|
|
||||||
protocol?: string;
|
protocol?: string;
|
||||||
auth?: string;
|
auth?: string;
|
||||||
hostname?: string;
|
hostname?: string;
|
||||||
@ -914,13 +1019,14 @@ declare module "url" {
|
|||||||
host?: string;
|
host?: string;
|
||||||
pathname?: string;
|
pathname?: string;
|
||||||
search?: string;
|
search?: string;
|
||||||
query?: any;
|
query?: any; // string | Object
|
||||||
|
slashes?: boolean;
|
||||||
hash?: string;
|
hash?: string;
|
||||||
path?: string;
|
path?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url;
|
export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url;
|
||||||
export function format(url: UrlOptions): string;
|
export function format(url: Url): string;
|
||||||
export function resolve(from: string, to: string): string;
|
export function resolve(from: string, to: string): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -996,10 +1102,10 @@ declare module "net" {
|
|||||||
}
|
}
|
||||||
export function createServer(connectionListener?: (socket: Socket) =>void ): Server;
|
export function createServer(connectionListener?: (socket: Socket) =>void ): Server;
|
||||||
export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server;
|
export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server;
|
||||||
export function connect(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
export function connect(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
||||||
export function connect(port: number, host?: string, connectionListener?: Function): Socket;
|
export function connect(port: number, host?: string, connectionListener?: Function): Socket;
|
||||||
export function connect(path: string, connectionListener?: Function): Socket;
|
export function connect(path: string, connectionListener?: Function): Socket;
|
||||||
export function createConnection(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
export function createConnection(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
|
||||||
export function createConnection(port: number, host?: string, connectionListener?: Function): Socket;
|
export function createConnection(port: number, host?: string, connectionListener?: Function): Socket;
|
||||||
export function createConnection(path: string, connectionListener?: Function): Socket;
|
export function createConnection(path: string, connectionListener?: Function): Socket;
|
||||||
export function isIP(input: string): number;
|
export function isIP(input: string): number;
|
||||||
@ -1062,6 +1168,7 @@ declare module "fs" {
|
|||||||
atime: Date;
|
atime: Date;
|
||||||
mtime: Date;
|
mtime: Date;
|
||||||
ctime: Date;
|
ctime: Date;
|
||||||
|
birthtime: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FSWatcher extends events.EventEmitter {
|
interface FSWatcher extends events.EventEmitter {
|
||||||
@ -1214,6 +1321,9 @@ declare module "fs" {
|
|||||||
export function fsyncSync(fd: number): void;
|
export function fsyncSync(fd: number): void;
|
||||||
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
||||||
export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
|
||||||
|
export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
|
||||||
|
export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
|
||||||
|
export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
|
||||||
export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||||
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
|
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
|
||||||
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
|
||||||
@ -1302,21 +1412,15 @@ declare module "fs" {
|
|||||||
export function createReadStream(path: string, options?: {
|
export function createReadStream(path: string, options?: {
|
||||||
flags?: string;
|
flags?: string;
|
||||||
encoding?: string;
|
encoding?: string;
|
||||||
fd?: string;
|
fd?: number;
|
||||||
mode?: number;
|
mode?: number;
|
||||||
bufferSize?: number;
|
autoClose?: boolean;
|
||||||
}): ReadStream;
|
|
||||||
export function createReadStream(path: string, options?: {
|
|
||||||
flags?: string;
|
|
||||||
encoding?: string;
|
|
||||||
fd?: string;
|
|
||||||
mode?: string;
|
|
||||||
bufferSize?: number;
|
|
||||||
}): ReadStream;
|
}): ReadStream;
|
||||||
export function createWriteStream(path: string, options?: {
|
export function createWriteStream(path: string, options?: {
|
||||||
flags?: string;
|
flags?: string;
|
||||||
encoding?: string;
|
encoding?: string;
|
||||||
string?: string;
|
fd?: number;
|
||||||
|
mode?: number;
|
||||||
}): WriteStream;
|
}): WriteStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1485,6 +1589,8 @@ declare module "tls" {
|
|||||||
var CLIENT_RENEG_WINDOW: number;
|
var CLIENT_RENEG_WINDOW: number;
|
||||||
|
|
||||||
export interface TlsOptions {
|
export interface TlsOptions {
|
||||||
|
host?: string;
|
||||||
|
port?: number;
|
||||||
pfx?: any; //string or buffer
|
pfx?: any; //string or buffer
|
||||||
key?: any; //string or buffer
|
key?: any; //string or buffer
|
||||||
passphrase?: string;
|
passphrase?: string;
|
||||||
@ -1591,13 +1697,13 @@ declare module "crypto" {
|
|||||||
export function createHash(algorithm: string): Hash;
|
export function createHash(algorithm: string): Hash;
|
||||||
export function createHmac(algorithm: string, key: string): Hmac;
|
export function createHmac(algorithm: string, key: string): Hmac;
|
||||||
export function createHmac(algorithm: string, key: Buffer): Hmac;
|
export function createHmac(algorithm: string, key: Buffer): Hmac;
|
||||||
interface Hash {
|
export interface Hash {
|
||||||
update(data: any, input_encoding?: string): Hash;
|
update(data: any, input_encoding?: string): Hash;
|
||||||
digest(encoding: 'buffer'): Buffer;
|
digest(encoding: 'buffer'): Buffer;
|
||||||
digest(encoding: string): any;
|
digest(encoding: string): any;
|
||||||
digest(): Buffer;
|
digest(): Buffer;
|
||||||
}
|
}
|
||||||
interface Hmac {
|
export interface Hmac extends NodeJS.ReadWriteStream {
|
||||||
update(data: any, input_encoding?: string): Hmac;
|
update(data: any, input_encoding?: string): Hmac;
|
||||||
digest(encoding: 'buffer'): Buffer;
|
digest(encoding: 'buffer'): Buffer;
|
||||||
digest(encoding: string): any;
|
digest(encoding: string): any;
|
||||||
@ -1605,7 +1711,7 @@ declare module "crypto" {
|
|||||||
}
|
}
|
||||||
export function createCipher(algorithm: string, password: any): Cipher;
|
export function createCipher(algorithm: string, password: any): Cipher;
|
||||||
export function createCipheriv(algorithm: string, key: any, iv: any): Cipher;
|
export function createCipheriv(algorithm: string, key: any, iv: any): Cipher;
|
||||||
interface Cipher {
|
export interface Cipher {
|
||||||
update(data: Buffer): Buffer;
|
update(data: Buffer): Buffer;
|
||||||
update(data: string, input_encoding?: string, output_encoding?: string): string;
|
update(data: string, input_encoding?: string, output_encoding?: string): string;
|
||||||
final(): Buffer;
|
final(): Buffer;
|
||||||
@ -1614,7 +1720,7 @@ declare module "crypto" {
|
|||||||
}
|
}
|
||||||
export function createDecipher(algorithm: string, password: any): Decipher;
|
export function createDecipher(algorithm: string, password: any): Decipher;
|
||||||
export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
|
export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
|
||||||
interface Decipher {
|
export interface Decipher {
|
||||||
update(data: Buffer): Buffer;
|
update(data: Buffer): Buffer;
|
||||||
update(data: string, input_encoding?: string, output_encoding?: string): string;
|
update(data: string, input_encoding?: string, output_encoding?: string): string;
|
||||||
final(): Buffer;
|
final(): Buffer;
|
||||||
@ -1622,18 +1728,18 @@ declare module "crypto" {
|
|||||||
setAutoPadding(auto_padding: boolean): void;
|
setAutoPadding(auto_padding: boolean): void;
|
||||||
}
|
}
|
||||||
export function createSign(algorithm: string): Signer;
|
export function createSign(algorithm: string): Signer;
|
||||||
interface Signer {
|
export interface Signer extends NodeJS.WritableStream {
|
||||||
update(data: any): void;
|
update(data: any): void;
|
||||||
sign(private_key: string, output_format: string): string;
|
sign(private_key: string, output_format: string): string;
|
||||||
}
|
}
|
||||||
export function createVerify(algorith: string): Verify;
|
export function createVerify(algorith: string): Verify;
|
||||||
interface Verify {
|
export interface Verify extends NodeJS.WritableStream {
|
||||||
update(data: any): void;
|
update(data: any): void;
|
||||||
verify(object: string, signature: string, signature_format?: string): boolean;
|
verify(object: string, signature: string, signature_format?: string): boolean;
|
||||||
}
|
}
|
||||||
export function createDiffieHellman(prime_length: number): DiffieHellman;
|
export function createDiffieHellman(prime_length: number): DiffieHellman;
|
||||||
export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman;
|
export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman;
|
||||||
interface DiffieHellman {
|
export interface DiffieHellman {
|
||||||
generateKeys(encoding?: string): string;
|
generateKeys(encoding?: string): string;
|
||||||
computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string;
|
computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string;
|
||||||
getPrime(encoding?: string): string;
|
getPrime(encoding?: string): string;
|
||||||
@ -1644,10 +1750,10 @@ declare module "crypto" {
|
|||||||
setPrivateKey(public_key: string, encoding?: string): void;
|
setPrivateKey(public_key: string, encoding?: string): void;
|
||||||
}
|
}
|
||||||
export function getDiffieHellman(group_name: string): DiffieHellman;
|
export function getDiffieHellman(group_name: string): DiffieHellman;
|
||||||
export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void;
|
export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||||
export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void;
|
export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||||
export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer;
|
export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer;
|
||||||
export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number, digest: string) : Buffer;
|
export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string) : Buffer;
|
||||||
export function randomBytes(size: number): Buffer;
|
export function randomBytes(size: number): Buffer;
|
||||||
export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
|
export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
|
||||||
export function pseudoRandomBytes(size: number): Buffer;
|
export function pseudoRandomBytes(size: number): Buffer;
|
||||||
@ -1657,7 +1763,7 @@ declare module "crypto" {
|
|||||||
declare module "stream" {
|
declare module "stream" {
|
||||||
import * as events from "events";
|
import * as events from "events";
|
||||||
|
|
||||||
export interface Stream extends events.EventEmitter {
|
export class Stream extends events.EventEmitter {
|
||||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1671,14 +1777,13 @@ declare module "stream" {
|
|||||||
readable: boolean;
|
readable: boolean;
|
||||||
constructor(opts?: ReadableOptions);
|
constructor(opts?: ReadableOptions);
|
||||||
_read(size: number): void;
|
_read(size: number): void;
|
||||||
read(size?: number): string|Buffer;
|
read(size?: number): any;
|
||||||
setEncoding(encoding: string): void;
|
setEncoding(encoding: string): void;
|
||||||
pause(): void;
|
pause(): void;
|
||||||
resume(): void;
|
resume(): void;
|
||||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||||
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
||||||
unshift(chunk: string): void;
|
unshift(chunk: any): void;
|
||||||
unshift(chunk: Buffer): void;
|
|
||||||
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
||||||
push(chunk: any, encoding?: string): boolean;
|
push(chunk: any, encoding?: string): boolean;
|
||||||
}
|
}
|
||||||
@ -1686,20 +1791,18 @@ declare module "stream" {
|
|||||||
export interface WritableOptions {
|
export interface WritableOptions {
|
||||||
highWaterMark?: number;
|
highWaterMark?: number;
|
||||||
decodeStrings?: boolean;
|
decodeStrings?: boolean;
|
||||||
|
objectMode?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
|
export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
|
||||||
writable: boolean;
|
writable: boolean;
|
||||||
constructor(opts?: WritableOptions);
|
constructor(opts?: WritableOptions);
|
||||||
_write(data: Buffer, encoding: string, callback: Function): void;
|
_write(chunk: any, encoding: string, callback: Function): void;
|
||||||
_write(data: string, encoding: string, callback: Function): void;
|
write(chunk: any, cb?: Function): boolean;
|
||||||
write(buffer: Buffer, cb?: Function): boolean;
|
write(chunk: any, encoding?: string, cb?: Function): boolean;
|
||||||
write(str: string, cb?: Function): boolean;
|
|
||||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
|
||||||
end(): void;
|
end(): void;
|
||||||
end(buffer: Buffer, cb?: Function): void;
|
end(chunk: any, cb?: Function): void;
|
||||||
end(str: string, cb?: Function): void;
|
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||||
end(str: string, encoding?: string, cb?: Function): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DuplexOptions extends ReadableOptions, WritableOptions {
|
export interface DuplexOptions extends ReadableOptions, WritableOptions {
|
||||||
@ -1710,15 +1813,12 @@ declare module "stream" {
|
|||||||
export class Duplex extends Readable implements NodeJS.ReadWriteStream {
|
export class Duplex extends Readable implements NodeJS.ReadWriteStream {
|
||||||
writable: boolean;
|
writable: boolean;
|
||||||
constructor(opts?: DuplexOptions);
|
constructor(opts?: DuplexOptions);
|
||||||
_write(data: Buffer, encoding: string, callback: Function): void;
|
_write(chunk: any, encoding: string, callback: Function): void;
|
||||||
_write(data: string, encoding: string, callback: Function): void;
|
write(chunk: any, cb?: Function): boolean;
|
||||||
write(buffer: Buffer, cb?: Function): boolean;
|
write(chunk: any, encoding?: string, cb?: Function): boolean;
|
||||||
write(str: string, cb?: Function): boolean;
|
|
||||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
|
||||||
end(): void;
|
end(): void;
|
||||||
end(buffer: Buffer, cb?: Function): void;
|
end(chunk: any, cb?: Function): void;
|
||||||
end(str: string, cb?: Function): void;
|
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||||
end(str: string, encoding?: string, cb?: Function): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TransformOptions extends ReadableOptions, WritableOptions {}
|
export interface TransformOptions extends ReadableOptions, WritableOptions {}
|
||||||
@ -1728,8 +1828,7 @@ declare module "stream" {
|
|||||||
readable: boolean;
|
readable: boolean;
|
||||||
writable: boolean;
|
writable: boolean;
|
||||||
constructor(opts?: TransformOptions);
|
constructor(opts?: TransformOptions);
|
||||||
_transform(chunk: Buffer, encoding: string, callback: Function): void;
|
_transform(chunk: any, encoding: string, callback: Function): void;
|
||||||
_transform(chunk: string, encoding: string, callback: Function): void;
|
|
||||||
_flush(callback: Function): void;
|
_flush(callback: Function): void;
|
||||||
read(size?: number): any;
|
read(size?: number): any;
|
||||||
setEncoding(encoding: string): void;
|
setEncoding(encoding: string): void;
|
||||||
@ -1737,17 +1836,14 @@ declare module "stream" {
|
|||||||
resume(): void;
|
resume(): void;
|
||||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||||
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
|
||||||
unshift(chunk: string): void;
|
unshift(chunk: any): void;
|
||||||
unshift(chunk: Buffer): void;
|
|
||||||
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
|
||||||
push(chunk: any, encoding?: string): boolean;
|
push(chunk: any, encoding?: string): boolean;
|
||||||
write(buffer: Buffer, cb?: Function): boolean;
|
write(chunk: any, cb?: Function): boolean;
|
||||||
write(str: string, cb?: Function): boolean;
|
write(chunk: any, encoding?: string, cb?: Function): boolean;
|
||||||
write(str: string, encoding?: string, cb?: Function): boolean;
|
|
||||||
end(): void;
|
end(): void;
|
||||||
end(buffer: Buffer, cb?: Function): void;
|
end(chunk: any, cb?: Function): void;
|
||||||
end(str: string, cb?: Function): void;
|
end(chunk: any, encoding?: string, cb?: Function): void;
|
||||||
end(str: string, encoding?: string, cb?: Function): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PassThrough extends Transform {}
|
export class PassThrough extends Transform {}
|
||||||
@ -1774,6 +1870,7 @@ declare module "util" {
|
|||||||
export function isDate(object: any): boolean;
|
export function isDate(object: any): boolean;
|
||||||
export function isError(object: any): boolean;
|
export function isError(object: any): boolean;
|
||||||
export function inherits(constructor: any, superConstructor: any): void;
|
export function inherits(constructor: any, superConstructor: any): void;
|
||||||
|
export function debuglog(key:string): (msg:string,...param: any[])=>void;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "assert" {
|
declare module "assert" {
|
||||||
@ -1799,6 +1896,8 @@ declare module "assert" {
|
|||||||
export function notDeepEqual(acutal: any, expected: any, message?: string): void;
|
export function notDeepEqual(acutal: any, expected: any, message?: string): void;
|
||||||
export function strictEqual(actual: any, expected: any, message?: string): void;
|
export function strictEqual(actual: any, expected: any, message?: string): void;
|
||||||
export function notStrictEqual(actual: any, expected: any, message?: string): void;
|
export function notStrictEqual(actual: any, expected: any, message?: string): void;
|
||||||
|
export function deepStrictEqual(actual: any, expected: any, message?: string): void;
|
||||||
|
export function notDeepStrictEqual(actual: any, expected: any, message?: string): void;
|
||||||
export var throws: {
|
export var throws: {
|
||||||
(block: Function, message?: string): void;
|
(block: Function, message?: string): void;
|
||||||
(block: Function, error: Function, message?: string): void;
|
(block: Function, error: Function, message?: string): void;
|
||||||
@ -1826,10 +1925,12 @@ declare module "tty" {
|
|||||||
export interface ReadStream extends net.Socket {
|
export interface ReadStream extends net.Socket {
|
||||||
isRaw: boolean;
|
isRaw: boolean;
|
||||||
setRawMode(mode: boolean): void;
|
setRawMode(mode: boolean): void;
|
||||||
|
isTTY: boolean;
|
||||||
}
|
}
|
||||||
export interface WriteStream extends net.Socket {
|
export interface WriteStream extends net.Socket {
|
||||||
columns: number;
|
columns: number;
|
||||||
rows: number;
|
rows: number;
|
||||||
|
isTTY: boolean;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2076,4 +2177,4 @@ declare module "constants" {
|
|||||||
export var W_OK: number;
|
export var W_OK: number;
|
||||||
export var X_OK: number;
|
export var X_OK: number;
|
||||||
export var UV_UDP_REUSEADDR: number;
|
export var UV_UDP_REUSEADDR: number;
|
||||||
}
|
}
|
1
ts/typings/main.d.ts
vendored
Normal file
1
ts/typings/main.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/// <reference path="main/ambient/node/node.d.ts" />
|
2180
ts/typings/main/ambient/node/node.d.ts
vendored
Normal file
2180
ts/typings/main/ambient/node/node.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
ts/typings/tsd.d.ts
vendored
1
ts/typings/tsd.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
/// <reference path="node/node.d.ts" />
|
|
Loading…
Reference in New Issue
Block a user