UNPKG

@deepbrainspace/nx-surrealdb

Version:

NX plugin for SurrealDB migrations with modular architecture

51 lines (50 loc) 1.86 kB
import { Tree } from '@nx/devkit'; /** * Shared utilities for working with NX Tree API across generators */ export declare class TreeUtils { /** * Find a matching subdirectory based on a pattern (number, name, or full identifier) * Supports patterns like: "010", "auth", "010_auth", etc. */ static findMatchingSubdirectory(tree: Tree, basePath: string, pattern: string): string | null; /** * Get the next migration number for a module using Tree API */ static getNextMigrationNumber(tree: Tree, modulePath: string): string; /** * Get all migration files from a module directory using Tree API */ static getMigrationFiles(tree: Tree, modulePath: string): string[]; /** * Check if a path exists and is a directory using Tree API */ static isDirectory(tree: Tree, dirPath: string): boolean; /** * Ensure a directory exists in the Tree (creates if needed) */ static ensureDirectory(tree: Tree, dirPath: string): void; /** * Copy files from source to destination using Tree API */ static copyFiles(tree: Tree, sourcePath: string, destPath: string, fileFilter?: (filename: string) => boolean): void; /** * Get all subdirectories matching a pattern using Tree API */ static getMatchingDirectories(tree: Tree, basePath: string, pattern: RegExp): string[]; /** * Read and parse JSON file using Tree API */ static readJsonFile<T = unknown>(tree: Tree, filePath: string): T | null; /** * Write JSON file using Tree API */ static writeJsonFile(tree: Tree, filePath: string, data: unknown): void; /** * Find all module directories in a migrations path */ static findModuleDirectories(tree: Tree, migrationsPath: string): Array<{ name: string; path: string; }>; }