@o3r/schematics
Version:
Schematics module of the Otter framework
59 lines • 2.75 kB
TypeScript
import { logging } from '@angular-devkit/core';
import type { WorkspaceSchema } from '../interfaces/angular-workspace';
/** Support NPM package managers */
export type SupportedPackageManagers = 'npm' | 'yarn';
/** Support NPM package managers */
export type SupportedPackageManagerRunners = `${SupportedPackageManagers} run` | 'yarn';
/** Support NPM package managers */
export type SupportedPackageManagerExecutors = `${SupportedPackageManagers} exec` | 'yarn' | 'npx';
/** Option to determine Package Manager */
export interface PackageManagerOptions {
/** Workspace configuration */
workspaceConfig?: WorkspaceSchema | string | null;
/** Package manager to enforce, will be used if supported */
enforcedNpmManager?: string | null;
/** Logger to use to report call failure (as debug message) */
logger?: logging.LoggerApi;
}
/**
* Determine if the given packager manager is supported
* @param name Name of the package manager
*/
export declare function isSupportedPackageManager(name?: any): name is SupportedPackageManagers;
/**
* Get package manager used in runs
* Defaults to the package manager setup in process.env if no package manager set in angular.json
* @param options Option to determine the final package manager
*/
export declare function getPackageManager(options?: PackageManagerOptions): SupportedPackageManagers;
/**
* Get command to run scripts with your package manager
* @param workspaceConfig Workspace configuration
* @param packageName Name of the package of the workspace to run the script (name from package.json)
*/
export declare function getPackageManagerRunner(workspaceConfig?: WorkspaceSchema | string | null, packageName?: string): string;
/**
* Get command to execute bin command with your package manager
* @param workspaceConfig Workspace configuration
* @param packageName Name of the package of the workspace to execute the command
*/
export declare function getPackageManagerExecutor(workspaceConfig?: WorkspaceSchema | string | null, packageName?: string): string;
/**
* Determine if the given package is installed
* @param packageName name of the package to check
*/
export declare function isPackageInstalled(packageName: string): boolean;
/**
* Get package manager version
* @param options Option to determine the final package manager
*/
export declare function getPackageManagerVersion(options?: PackageManagerOptions): string | undefined;
/**
* Get package manager information
* @param options Option to determine the final package manager
*/
export declare function getPackageManagerInfo(options?: PackageManagerOptions): {
name: SupportedPackageManagers;
version: string | undefined;
};
//# sourceMappingURL=package-manager-runner.d.ts.map