UNPKG

@userfrosting/merge-package-dependencies

Version:

Merge NPM, Yarn or Bower package dependencies into one package, with semver rules respected.

83 lines (82 loc) 3.54 kB
export { LogicalException, InvalidArgumentException, InvalidNodePackageException, InvalidBowerPackageException, } from "./exceptions.js"; /** * @public */ export interface INodeTemplate { name?: string; private?: boolean; version?: string; dependencies?: { [x: string]: string; }; devDependencies?: { [x: string]: string; }; peerDependencies?: { [x: string]: string; }; resolutions?: { [x: string]: string; }; } /** * @public */ export interface IBowerTemplate { name: string; dependencies?: { [x: string]: string; }; devDependencies?: { [x: string]: string; }; resolutions?: { [x: string]: string; }; } /** * @public */ export declare type LogOption = boolean | ((message?: any, ...optionalParams: any[]) => void); /** * Merge specified npm packages together. * * @param template - Template that packages will be merged into. Is validated with [package-json-validator](https://www.npmjs.com/package/package-json-validator) with template.private == true overriding this. * @param paths - Paths to package.json files. EG: "path/to/" (package.json is prepended) or "path/to/package.json" or "path/to/different.json". * @param saveTo - If string, saves the generated package.json to the specified path. Like 'paths', has 'package.json' prepended if required. * @param log - If true, progress and errors will be logged. Has no affect on exceptions thrown. * * @public */ export declare function npm<TTemplate extends INodeTemplate>(template: TTemplate, paths: string[], saveTo?: string | null, log?: LogOption): TTemplate; /** * Merge specified yarn packages together. * * @param template - Template that packages will be merged into. Is validated with [package-json-validator](https://www.npmjs.com/package/package-json-validator) with template.private == true overriding this. * @param paths - Paths to package.json files. EG: "path/to/" (package.json is prepended) or "path/to/package.json" or "path/to/different.json". * @param saveTo - If string, saves the generated package.json to the specified path. Like 'paths', has 'package.json' prepended if required. * @param log - If true, progress and errors will be logged. Has no affect on exceptions thrown. * * @public */ export declare function yarn<TTemplate extends INodeTemplate>(template: TTemplate, paths: string[], saveTo?: string | null, log?: LogOption): TTemplate; /** * Merge specified bower packages together. * * @param template - Template that packages will be merged into. Is validated with [bower-json](https://www.npmjs.com/package/bower-json). * @param paths - Paths to bower.json files. EG: "path/to/" (bower.json is prepended) or "path/to/bower.json" or "path/to/different.json". * @param saveTo - If string, saves the generated bower.json to the specified path. Like 'paths', has 'bower.json' prepended if required. * @param log - If true, progress and errors will be logged. Has no affect on exceptions thrown. * * @public */ export declare function bower<TTemplate extends IBowerTemplate>(template: TTemplate, paths: string[], saveTo?: string | null, log?: LogOption): TTemplate; /** * Uses `yarn.lock` to detect if multiple versions of a dependency have been installed. * * @param p - Directory of `yarn.lock`. * @param log - If true, progress and errors will be logged. Has no affect on exceptions thrown. * * @public */ export declare function yarnIsFlat(p?: string, log?: LogOption): boolean;