@o3r/schematics
Version:
Schematics module of the Otter framework
91 lines • 4.15 kB
TypeScript
import type { DirEntry, FileEntry } from '@angular-devkit/schematics';
import { Tree } from '@angular-devkit/schematics';
import { NodeDependencyType } from '@schematics/angular/utility/dependencies';
import type { PackageJson } from 'type-fest';
import type { WorkspaceProject, WorkspaceSchema } from '../interfaces/index';
/**
*
* Helper function that looks for files in the Tree
* @param directory where to perform the search
* @param fileMatchesCriteria a function defining the criteria to look for
* @param ignoreDirectories optional parameter to ignore folders
*/
export declare function findFilesInTree(directory: DirEntry, fileMatchesCriteria: (file: string) => boolean, ignoreDirectories?: string[]): FileEntry[];
/**
* Load the Workspace configuration object
* @param tree File tree
* @param workspaceConfigFile Workspace config file path, /angular.json in an Angular project
* @returns null if the given config file does not exist
*/
export declare function getWorkspaceConfig<T extends WorkspaceSchema = WorkspaceSchema>(tree: Tree, workspaceConfigFile?: string): WorkspaceSchema | null;
/**
* Update angular.json file
* @param tree File tree
* @param workspace Angular workspace
* @param angularJsonFile Angular.json file path
*/
export declare function writeAngularJson(tree: Tree, workspace: WorkspaceSchema, angularJsonFile?: string): import("@angular-devkit/schematics/src/tree/interface").Tree;
/**
* Load the target's package.json file
* @param tree File tree
* @param workspaceProject Angular workspace project
* @throws Package JSON invalid or non exist
*/
export declare function readPackageJson(tree: Tree, workspaceProject: WorkspaceProject): PackageJson;
/**
* Return the types of install to run depending on the project type
* @param project
*/
export declare function getProjectNewDependenciesTypes(project?: WorkspaceProject): NodeDependencyType[];
/**
* Get the folder of the templates for a specific sub-schematics
* @param rootPath Root directory of the schematics ran
* @param currentPath Directory of the current sub-schematics ran
* @param templateFolder Folder containing the templates
*/
export declare function getTemplateFolder(rootPath: string, currentPath: string, templateFolder?: string): string;
/**
* Get the path of all the files in the Tree
* @param tree Schematics file tree
* @param basePath Base path from which starting the list
* @param excludes Array of globs to be ignored
* @param recursive determine if the function will walk through the sub folders
*/
export declare function getAllFilesInTree(tree: Tree, basePath?: string, excludes?: string[], recursive?: boolean): string[];
/**
* Get the path of all the files in the Tree
* @param tree Schematics file tree
* @param patterns Array of globs to be search in the tree
*/
export declare function globInTree(tree: Tree, patterns: string[]): string[];
/**
* Get all files with specific extension from the specified folder for all the projects described in the workspace
* @param tree
* @param folderInProject
* @param extension
*/
export declare function getFilesInFolderFromWorkspaceProjectsInTree(tree: Tree, folderInProject: string, extension: string): string[];
/**
* Get all files with specific extension from the tree
* @param tree
* @param extension
*/
export declare function getFilesWithExtensionFromTree(tree: Tree, extension: string): string[];
/**
* Get all files with specific extension from the root of all the projects described in the workspace
* @param tree
* @param extension
*/
export declare function getFilesFromRootOfWorkspaceProjects(tree: Tree, extension: string): string[];
/**
* Get all files with specific extension from the src folder for all the projects described in the workspace
* @param tree
* @param extension
*/
export declare function getFilesFromWorkspaceProjects(tree: Tree, extension: string): string[];
/**
* Get all the typescript files from the src folder for all the projects described in the workspace
* @param tree
*/
export declare function getSourceFilesFromWorkspaceProjects(tree: Tree): string[];
//# sourceMappingURL=loaders.d.ts.map