@ts-common/azure-js-dev-tools
Version:
Developer dependencies for TypeScript related projects
165 lines • 6.26 kB
TypeScript
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
import { StringMap } from "./common";
import { RunOptions, RunResult } from "./run";
/**
* Get the executable that will be used to run NPM commands.
* @param osPlatform The platform that this script is being run on.
*/
export declare function npmExecutable(osPlatform?: string): string;
/**
* Run a NPM command.
* @param args The arguments to the NPM command.
* @param options The optional arguments that can be added to the NPM command.
* @returns The result of running the NPM command.
*/
export declare function npm(args: string[], options?: RunOptions): Promise<RunResult>;
/**
* Run a script specified in the package.json file.
* @param args The arguments for the NPM run command.
* @param options The optional arguments that can be added to the NPM command.
* @returns The result of running the NPM command.
*/
export declare function npmRun(args: string[], options?: RunOptions): Promise<RunResult>;
/**
* Run "npm pack" from the optional packageFolderPath.
* @param options The optional arguments that can be added to the NPM command.
* @returns The result of running the NPM command.
*/
export declare function npmPack(options?: RunOptions): Promise<RunResult>;
/**
* Options that can be passed to "npm install" commands.
*/
export interface NPMInstallOptions extends RunOptions {
/**
* The source of the package to install. This can be an NPM package's name (with or without the
* package version), a Git URL, a path to a tarball, or a path to a folder.
*/
installSource?: string;
/**
* Whether or not to update the execution folder path's package.json file with this installation.
* If this property is undefined, then the package.json won't be updated. If this property is
* defined, then it's value will be appended to the `--save` command-line argument name. For
* example, if you specified `save: "prod"`, then the command-line would add a `--save-prod`
* argument.
*/
save?: string;
}
/**
* Run "npm install" from the optional packageFolderPath, or if packageFolderPath isn't specified,
* then run "npm install" from the current directory.
* @param options The optional arguments that can be added to the NPM command.
* @returns The result of running the NPM command.
*/
export declare function npmInstall(options?: NPMInstallOptions): Promise<RunResult>;
/**
* The optional arguments that can be passed to npmView().
*/
export interface NPMViewOptions extends RunOptions {
/**
* The name of the package to get details for. If this is undefined or empty, the package in the
* executionFolderPath will be used instead.
*/
packageName?: string;
}
/**
* The result of running a npm view command.
*/
export interface NPMViewResult extends RunResult {
_id?: string;
_rev?: string;
name?: string;
description?: string;
"dist-tags"?: StringMap<string>;
versions?: string[];
maintainers?: string[];
time?: StringMap<string>;
homepage?: string;
keywords?: string[];
repository?: {
type: string;
url: string;
};
author?: string;
bugs?: {
url: string;
};
readmeFilename?: string;
license?: string;
_etag?: string;
_lastModified?: string;
version?: string;
dependencies?: StringMap<string>;
main?: string;
types?: string;
_npmVersion?: string;
_nodeVersion?: string;
_npmUser?: string;
dist?: {
integrity: string;
shasum: string;
tarball: string;
fileCount: number;
unpackedSize: number;
"npm-signature": string;
};
_hasShrinkwrap?: boolean;
error?: Error & {
code?: string;
summary?: string;
detail?: string;
};
}
/**
* Run "npm view". If a packageName is provided in the options, then it will be used, otherwise the
* package in the folder specified in the executionFolderPath will be used.
* @param options The optional arguments that can be added to the NPM command.
* @returns The result of running the NPM command.
*/
export declare function npmView(options?: NPMViewOptions): Promise<NPMViewResult>;
/**
* A scope object that specifies a set of default options that will be used with any NPM command run
* by this scope.
*/
export declare class NPMScope {
private defaultOptions;
constructor(defaultOptions: RunOptions);
/**
* Run a NPM command.
* @param args The arguments to the NPM command.
* @param options The optional arguments that can be added to the NPM command.
* @returns The result of running the NPM command.
*/
npm(args: string[], options?: RunOptions): Promise<RunResult>;
/**
* Run a script specified in the package.json file.
* @param args The arguments for the NPM run command.
* @param options The optional arguments that can be added to the NPM command.
* @returns The result of running the NPM command.
*/
run(args: string[], options?: RunOptions): Promise<RunResult>;
/**
* Run "npm install" from the optional packageFolderPath, or if packageFolderPath isn't specified,
* then run "npm install" from the current directory.
* @param options The optional arguments that can be added to the NPM command.
* @returns The result of running the NPM command.
*/
install(options?: NPMInstallOptions): Promise<RunResult>;
/**
* Run "npm view". If a packageName is provided in the options, then it will be used, otherwise the
* package in the folder specified in the executionFolderPath will be used.
* @param options The optional arguments that can be added to the NPM command.
* @returns The result of running the NPM command.
*/
view(options?: NPMViewOptions): Promise<NPMViewResult>;
/**
* Run "npm pack" from the optional packageFolderPath.
* @param options The optional arguments that can be added to the NPM command.
* @returns The result of running the NPM command.
*/
pack(options?: RunOptions): Promise<RunResult>;
}
//# sourceMappingURL=npm.d.ts.map