@salesforce/plugin-release-management
Version:
A plugin for preparing and publishing npm packages
88 lines (87 loc) • 2.89 kB
TypeScript
import { AsyncOptionalCreatable } from '@salesforce/kit';
import { AnyJson, Nullable } from '@salesforce/ts-types';
export declare type PackageJson = {
name: string;
version: string;
dependencies: Record<string, string>;
devDependencies: Record<string, string>;
scripts: Record<string, string>;
files?: string[];
pinnedDependencies?: string[];
resolutions?: Record<string, string>;
repository?: string;
homepage?: string;
sfdx?: PackageJsonSfdxProperty;
oclif?: {
plugins: string[];
};
} & AnyJson;
export declare type PackageJsonSfdxProperty = {
publicKeyUrl: string;
signatureUrl: string;
};
export declare type ChangedPackageVersions = Array<{
name: string;
version: string;
tag: string;
}>;
export declare type NpmPackage = {
name: string;
version: string;
versions: string[];
'dist-tags': Record<string, string>;
time?: Record<string, string>;
} & Partial<PackageJson>;
export interface VersionValidation {
nextVersion: string;
currentVersion: string;
valid: boolean;
name: string;
}
interface DependencyInfo {
dependencyName: string;
packageName: string;
alias: Nullable<string>;
currentVersion?: string;
finalVersion?: string;
}
export declare function parseAliasedPackageName(alias: string): string;
export declare function parsePackageVersion(alias: string): string;
export declare class Package extends AsyncOptionalCreatable {
name: string;
npmPackage: NpmPackage;
packageJson: PackageJson;
location: string;
private logger;
private nextVersion;
private registry;
constructor(location: string);
readPackageJson(): Promise<PackageJson>;
/**
* Retrieve the npm package info using `npm view`
*
* It'll first try to find the package with the version listed in the package.json
* If that version doesn't exist, it'll find the version tagged as latest
*/
retrieveNpmPackage(): NpmPackage;
validateNextVersion(): VersionValidation;
setNextVersion(version: string): void;
getNextVersion(): string;
nextVersionIsAvailable(): boolean;
writePackageJson(rootDir?: string): void;
getDistTags(name: string): Record<string, string>;
bumpResolutions(tag: string): void;
getDependencyInfo(name: string, dependencies: Record<string, string>): DependencyInfo;
bumpDependencyVersions(targetDependencies: string[]): DependencyInfo[];
getNextRCVersion(tag: string, isPatch?: boolean): string;
pinDependencyVersions(targetTag: string): ChangedPackageVersions;
/**
* Returns true if the version specified in the package.json has not been
* published to the registry
*/
nextVersionIsHardcoded(): boolean;
hasScript(scriptName: string): boolean;
protected init(): Promise<void>;
private createDefaultNpmPackage;
}
export {};