UNPKG

@salesforce/plugin-trust

Version:

validate a digital signature for a npm package

76 lines (75 loc) 2.21 kB
import shelljs, { ShellString } from 'shelljs'; export type NpmMeta = { tarballUrl?: string; signatureUrl?: string; publicKeyUrl?: string; tarballLocalPath?: string; verified?: boolean; moduleName?: string; version?: string; tarballFilename?: string; }; export type NpmShowResults = { versions: string[]; 'dist-tags': { [name: string]: string; }; sfdx?: { publicKeyUrl: string; signatureUrl: string; }; dist?: { [name: string]: string; }; }; type NpmCommandOptions = shelljs.ExecOptions & { json?: boolean; registry?: string; cliRoot?: string; }; type NpmCommandResult = shelljs.ShellString; export declare class NpmCommand { static runNpmCmd(cmd: string, options?: NpmCommandOptions): NpmCommandResult; static npxCli(): string; /** * Locate node executable and return its absolute path * First it tries to locate the node executable on the root path passed in * If not found then tries to use whatver 'node' resolves to on the user's PATH * If found return absolute path to the executable * If the node executable cannot be found, an error is thrown * * @private */ static findNode(root?: string): string; /** * Returns the path to the npm-cli.js file in this package's node_modules * * @private */ private static npmCli; /** * Finds the bin directory in the sfdx installation root path * * @param sfdxPath * @private */ private static findSfdxBinDirs; } export declare class NpmModule { private module; private version; private cliRoot?; npmMeta: NpmMeta; constructor(module: string, version?: string, cliRoot?: string | undefined); ping(registry?: string): { registry: string; time: number; details: Record<string, unknown>; }; run(command: string): ShellString; show(registry: string): NpmShowResults; pack(registry: string, options?: shelljs.ExecOptions): void; fetchTarball(registry: string, options?: shelljs.ExecOptions): Promise<void>; pollForAvailability(checkFn: () => void): Promise<void>; } export {};