@o3r/schematics
Version:
Schematics module of the Otter framework
68 lines • 2.98 kB
TypeScript
import { Rule, type SchematicContext, type TaskId, Tree } from '@angular-devkit/schematics';
import { DependencyToAdd, NgAddSchematicOptions } from '../../interfaces';
import type { SupportedPackageManagers } from '../../utility';
export interface SetupDependenciesOptions {
/** Map of dependencies to install */
dependencies: Record<string, DependencyToAdd>;
/**
* Pattern of list of the dependency for which the ng-add run process is required
*/
ngAddToRun?: (RegExp | string)[];
/**
* Will skip install in the end of the package.json update.
* if `undefined`, the installation will be process only if a ngAdd run is required.
* If `true` the installation will not run in any case
* @default undefined
*/
skipInstall?: boolean;
/**
* Force the installation for a package even if it is already installed.
*/
forceInstall?: boolean;
/** Project Name */
projectName?: string;
/** default ng-add schematic option */
ngAddOptions?: NgAddSchematicOptions;
/** Enforce install package manager */
packageManager?: SupportedPackageManagers;
/** Task will run after the given task ID (if specified) */
runAfterTasks?: TaskId[];
/** Callback to run after the task ID is calculated */
scheduleTaskCallback?: (taskIds?: TaskId[]) => void;
/** Working directory for the installation process only */
workingDirectory?: string;
/**
* Enforce the usage of tilde instead of caret in a dependency range
* @default true
*/
enforceTildeRange?: boolean;
}
/** Result of the Setup Dependencies task scheduling process */
export interface SetupDependenciesResult {
/** List of the task ID resulting of the install process */
taskIds: TaskId[];
}
/**
* Determine if the context has information regarding the setup dependencies process
* @param context Schematic context
*/
export declare const hasSetupInformation: (context: SchematicContext) => context is SchematicContext & {
setupDependencies: SetupDependenciesResult;
};
/**
* Retrieve the package install configuration
* This is a workaround to ng-add to add the dependency to the sub-package
* @param packageJsonPath Path to the module package.json file
* @param tree Tree to read the file
* @param projectName Name of the project
* @param devDependencyOnly If true, the dependency will be added as devDependency
* @param exactO3rVersion Use a pinned version of the o3r package
*/
export declare const getPackageInstallConfig: (packageJsonPath: string, tree: Tree, projectName?: string, devDependencyOnly?: boolean, exactO3rVersion?: boolean) => Record<string, DependencyToAdd>;
/**
* Setup dependency to a repository.
* Will run manually the ngAdd schematics according to the parameters and install the packages if required
* @param options
*/
export declare const setupDependencies: (options: SetupDependenciesOptions) => Rule;
//# sourceMappingURL=dependencies.d.ts.map