UNPKG

@netgrif/components

Version:

Netgrif Application Engine frontend Angular components

68 lines (67 loc) 4.55 kB
import * as ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript'; import { Rule, Tree } from '@angular-devkit/schematics'; import { FileEntry, UpdateRecorder, DirEntry } from '@angular-devkit/schematics/src/tree/interface'; import { Change } from '@schematics/angular/utility/change'; import { FileData } from './models/file-data'; import { ProjectInfo } from './models/project-info'; import { NetgrifApplicationEngine } from '@netgrif/components-core'; import { ImportToAdd } from '../_commons/import-to-add'; export declare function getProjectInfo(tree: Tree): ProjectInfo; export declare function getNaeConfigurationString(tree: Tree): string; export declare function getNaeConfiguration(tree: Tree): NetgrifApplicationEngine; export declare function commitChangesToFile(tree: Tree, file: FileEntry, changes: Array<Change>): void; export declare function createChangesRecorder(tree: Tree, file: FileEntry, changes: Array<Change>): UpdateRecorder; export declare function getAppModule(tree: Tree, projectPath: string): FileData; export declare function getFileData(tree: Tree, projectRootPath: string, relativeFilePath: string): FileData; export declare function fileEntryToTsSource(file: FileEntry, encoding?: string): ts.SourceFile; export declare function getTsSource(path: string, content: string): ts.SourceFile; /** * A convenience method that creates source files from template files and places them at the specified location in the file system. * @param pathToTemplates path relative to the location of the schematic entry-point file * (might not necessarily be the same as the file that contains the call!) * @param pathToMoveGeneratedFiles path relative to the workspace root where the generated files should be placed * @param options the object that supplies parameters to the template files */ export declare function createFilesFromTemplates(pathToTemplates: string, pathToMoveGeneratedFiles: string, options?: object): Rule; /** * computes the relative path from one file to another * @param sourcePath - path relative to project root of the source file * @param destinationPath - path relative to project root of the destination file * @return path that leads from source file to destination file */ export declare function createRelativePath(sourcePath: string, destinationPath: string): string; /** * Recursively iterates over every non-test, typescript source file in the project * and executes the given lambda with it as the input parameter. */ export declare function forEachSourceTsFile(tree: Tree, lambda: (fe: FileEntry) => void): void; /** * Recursively iterates over every file in the project and executes the given lambda with it as the input parameter. * @param tree tree to get access to the file system * @param lambda the function that is called with each of the project files as it's argument */ export declare function forEachProjectFile(tree: Tree, lambda: (fe: FileEntry) => void): void; /** * Recursively iterates over every file in the given directory and executes the given lambda with it as the input parameter. * @param subRoot the directory which should be recursively explored. * The files in the given directory and all it's subdirectories are processed by this function * @param lambda the function that is called with each of the files as it's argument */ export declare function forEachSubDirFile(subRoot: DirEntry, lambda: (fe: FileEntry) => void): void; /** * Finds all nodes of the given type among the child nodes of the given node. * @param start the node who's children should be searched * @param target the type of node that should be found * @param recursive whether children of children should be examined recursively or not * @returns an array of the children that are of the given type. Order of the children is not guaranteed. */ export declare function findNodesInChildren(start: ts.Node, target: ts.SyntaxKind, recursive?: boolean): Array<ts.Node>; /** * Adds another provider to the providers of a specified component * @param componentFile the file with the component * @param symbolName the class name of the added provider * @param importPath the path from which to import the symbol * @param insertedText? the text that should be inserted into the providers array */ export declare function addProviderToComponent(componentFile: FileEntry, symbolName: string, importPath?: string | null, insertedText?: string): Array<Change>; export declare function addImport(file: FileEntry, newImport: ImportToAdd): Change;