UNPKG

@now/build-utils

Version:
49 lines (48 loc) 2.67 kB
/// <reference types="node" /> import { SpawnOptions } from 'child_process'; import { Meta, PackageJson, NodeVersion, Config } from '../types'; interface SpawnOptionsExtended extends SpawnOptions { prettyCommand?: string; } export declare function spawnAsync(command: string, args: string[], opts?: SpawnOptionsExtended): Promise<void>; export declare function execAsync(command: string, args: string[], opts?: SpawnOptionsExtended): Promise<{ stdout: string; stderr: string; code: number; }>; export declare function spawnCommand(command: string, options?: SpawnOptions): import("child_process").ChildProcess; export declare function execCommand(command: string, options?: SpawnOptions): Promise<boolean>; export declare function getNodeBinPath({ cwd }: { cwd: string; }): Promise<string>; export declare function runShellScript(fsPath: string, args?: string[], spawnOpts?: SpawnOptions): Promise<boolean>; export declare function getSpawnOptions(meta: Meta, nodeVersion: NodeVersion): SpawnOptions; export declare function getNodeVersion(destPath: string, _nodeVersion?: string, _config?: Config, meta?: Meta): Promise<NodeVersion>; interface WalkParentDirsProps { /** * The highest directory, typically the workPath root of the project. * If this directory is reached and it doesn't contain the file, null is returned. */ base: string; /** * The directory to start searching, typically the same directory of the entrypoint. * If this directory doesn't contain the file, the parent is checked, etc. */ start: string; /** * The name of the file to search for, typically `package.json` or `Gemfile`. */ filename: string; } export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>; export declare function runNpmInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>; export declare function runBundleInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>; export declare function runPipInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>; export declare function getScriptName(pkg: Pick<PackageJson, 'scripts'> | null | undefined, possibleNames: Iterable<string>): string | null; export declare function runPackageJsonScript(destPath: string, scriptNames: string | Iterable<string>, spawnOpts?: SpawnOptions): Promise<boolean>; /** * @deprecate installDependencies() is deprecated. * Please use runNpmInstall() instead. */ export declare const installDependencies: typeof runNpmInstall; export {};