@ts-common/azure-js-dev-tools
Version:
Developer dependencies for TypeScript related projects
87 lines • 3.63 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";
/**
* Read and parse the PackageJson object found at the provided file path.
* @param packageJsonFilePath The path to the file that will be parsed as a PackageJson object.
* @returns The parsed PackageJson object.
*/
export declare function readPackageLockJsonFileSync(packageJsonFilePath: string): PackageLockJson;
/**
* Save to the provided PackageJson object to the file at the provided file path.
* @param packageLockJson The PackageLockJson object to save.
* @param packageJsonFilePath The path to the file where the PackageLockJson object will be saved to.
*/
export declare function writePackageLockJsonFileSync(packageLockJson: PackageLockJson, packageJsonFilePath: string): void;
/**
* Find a package.json file at the provided path or in one of its ancestor folders.
* @param pathString The path where the search for the package.json file will begin.
* @returns The path to the found package.json file, or undefined if no file was found.
*/
export declare function findPackageJsonFileSync(pathString: string): string | undefined;
/**
* Read and parse the PackageJson object found at the provided file path.
* @param packageJsonFilePath The path to the file that will be parsed as a PackageJson object.
* @returns The parsed PackageJson object.
*/
export declare function readPackageJsonFileSync(packageJsonFilePath: string): PackageJson;
/**
* Save to the provided PackageJson object to the file at the provided file path.
* @param packageJson The PackageJson object to save.
* @param packageJsonFilePath The path to the file where the PackageJson object will be saved to.
*/
export declare function writePackageJsonFileSync(packageJson: PackageJson, packageJsonFilePath: string): void;
/**
* If a version is specified in the provided PackageJson object, then increment the version's minor
* number.
* @param packageJson The PackageJson object to update.
* @returns Whether or not the version number was successfully updated.
*/
export declare function incrementPackageJsonMinorVersion(packageJson: PackageJson): boolean;
/**
* Get whether or not the provided packageJson has been published to NPM.
* @param packageJson The packageJson to check.
* @returns Whether or not the provided packageJson has been published to NPM.
*/
export declare function isPackageJsonPublished(packageJson: PackageJson): Promise<boolean>;
/**
* An individual depdendency reference within a PackageLockJson object.
*/
export interface PackageLockDependency {
version: string;
resolved: string;
integrity: string;
dev?: boolean;
requires?: StringMap<string>;
}
/**
* An interface describing the properties in a package-lock.json file object.
*/
export interface PackageLockJson {
name: string;
version: string;
lockfileVersion: number;
requires: boolean;
dependencies: StringMap<PackageLockDependency>;
}
export declare function removePackageLockJsonDependencies(packageLockJson: PackageLockJson, ...dependenciesToRemove: string[]): void;
/**
* An interface describing the properties in a package.json file object.
*/
export interface PackageJson {
name?: string;
version?: string;
private?: boolean;
license?: string;
author?: {
name?: string;
email?: string;
};
dependencies?: StringMap<string>;
devDependencies?: StringMap<string>;
scripts?: StringMap<string>;
}
//# sourceMappingURL=packageJson.d.ts.map