diff --git a/types/npm/index.d.ts b/types/npm/index.d.ts index 066a932440..3051fba096 100644 --- a/types/npm/index.d.ts +++ b/types/npm/index.d.ts @@ -37,7 +37,6 @@ declare namespace NPM { //#region Commands Interfaces export interface Commands { - // Commands install: CommandFunction; uninstall: CommandFunction; cache: CommandFunction; @@ -68,7 +67,6 @@ declare namespace NPM { "help-search": CommandFunction; ls: CommandFunction; search: CommandFunction; - view: CommandFunction; init: CommandFunction; version: CommandFunction; edit: CommandFunction; @@ -82,6 +80,16 @@ declare namespace NPM { bin: CommandFunction; whoami: CommandFunction; + // view and its aliases + view(args: string[], callback: CommandCallback): void; + view(args: string[], silent: boolean, callback: CommandCallback): void; + info(args: string[], callback: CommandCallback): void; + info(args: string[], silent: boolean, callback: CommandCallback): void; + show(args: string[], callback: CommandCallback): void; + show(args: string[], silent: boolean, callback: CommandCallback): void; + v(args: string[], callback: CommandCallback): void; + v(args: string[], silent: boolean, callback: CommandCallback): void; + test: CommandFunction; stop: CommandFunction; start: CommandFunction; @@ -103,8 +111,6 @@ declare namespace NPM { isntall: CommandFunction; // install up: CommandFunction; // update c: CommandFunction; // config - info: CommandFunction; // view - show: CommandFunction; // view find: CommandFunction; // search s: CommandFunction; // search se: CommandFunction; // search @@ -119,7 +125,7 @@ declare namespace NPM { t: CommandFunction; // test "find-dupes": CommandFunction; // dedupe ddp: CommandFunction; // dedupe - v: CommandFunction; // view + // plumbing build: CommandFunction; @@ -129,11 +135,9 @@ declare namespace NPM { visnup: CommandFunction; } - export interface CommandFunction { (args: string[], callback: CommandCallback): void; } - export interface CommandCallback { (err?: Error, result?: any, result2?: any, result3?: any, result4?: any): void; } diff --git a/types/npm/npm-tests.ts b/types/npm/npm-tests.ts index 460e6f450a..b784ab7d4b 100644 --- a/types/npm/npm-tests.ts +++ b/types/npm/npm-tests.ts @@ -4,7 +4,7 @@ * Created by using code samples from https://github.com/npm/npm#using-npm-programmatically. */ -import npm = require("npm"); +import * as npm from 'npm'; npm.load({}, function (er) { if (er) { @@ -19,9 +19,12 @@ npm.load({}, function (er) { // command succeeded, and data might have some info }); + npm.commands.view(["some", "args"], true, function () {}); // silent: true + npm.commands.view(["some", "args"], function () {}); + npm.on("log", function (message: string) { console.log(message); }); - + npm.config.set('audit', false); })