UNPKG

@storm-software/config-tools

Version:

A package containing various utilities to support custom workspace configurations and environment management for Storm Software projects, including configuration file handling, environment variable management, and logging utilities.

190 lines (188 loc) 5 kB
interface CargoToml { workspace?: { members: string[]; }; package: any; dependencies?: Record<string, string | { version: string; features?: string[]; optional?: boolean; }>; "dev-dependencies"?: Record<string, string | { version: string; features: string[]; }>; [key: string]: any; } interface CargoMetadata { packages: Package[]; workspace_members: string[]; resolve: Resolve; target_directory: string; version: number; workspace_root: string; metadata: Metadata2; } interface Package { name: string; version: string; id: string; license: string; license_file: string; description: string; source: any; dependencies: Dependency[]; targets: Target[]; features: Features; manifest_path: string; metadata: Metadata; /** * From the docs: * "List of registries to which this package may be published. * Publishing is unrestricted if null, and forbidden if an empty array." * * Additional observation: * false can be used by the end user but it will be converted to an empty * array in the cargo metadata output. */ publish?: string[] | boolean | null; authors: string[]; categories: string[]; default_run: any; rust_version: string; keywords: string[]; readme: string; repository: string; homepage: string; documentation: string; edition: string; links: any; } interface Dependency { name: string; source: string; req: string; kind: any; rename: any; optional: boolean; uses_default_features: boolean; features: any[]; target: string; path: string; registry: any; workspace: boolean; } interface Target { kind: string[]; crate_types: string[]; name: string; src_path: string; edition: string; "required-features": string[]; doc: boolean; doctest: boolean; test: boolean; } interface Features { default: string[]; feat1: any[]; feat2: any[]; } interface Metadata { docs: Docs; } interface Docs { rs: Rs; } interface Rs { "all-features": boolean; } interface Resolve { nodes: Node[]; root: string; } interface Node { id: string; dependencies: string[]; deps: Dep[]; features: string[]; } interface Dep { name: string; pkg: string; dep_kinds: DepKind[]; } interface DepKind { kind: any; target: string; } interface Metadata2 { docs: Docs2; } interface Docs2 { rs: Rs2; } interface Rs2 { "all-features": boolean; } /** * Virtual file system tree. */ interface Tree { /** * Root of the workspace. All paths are relative to this. */ root: string; /** * Read the contents of a file. * @param filePath A path to a file. */ read(filePath: string): Buffer | null; /** * Read the contents of a file as string. * @param filePath A path to a file. * @param encoding the encoding for the result */ read(filePath: string, encoding: BufferEncoding): string | null; /** * Update the contents of a file or create a new file. */ write(filePath: string, content: Buffer | string, options?: any): void; /** * Check if a file exists. */ exists(filePath: string): boolean; /** * Delete the file. */ delete(filePath: string): void; /** * Rename the file or the folder. */ rename(from: string, to: string): void; /** * Check if this is a file or not. */ isFile(filePath: string): boolean; /** * Returns the list of children of a folder. */ children(dirPath: string): string[]; /** * Returns the list of currently recorded changes. */ listChanges(): any[]; /** * Changes permissions of a file. * @param filePath A path to a file. * @param mode The permission to be granted on the file, given as a string (e.g `755`) or octal integer (e.g `0o755`). * See https://nodejs.org/api/fs.html#fs_file_modes. */ changePermissions(filePath: string, mode: string): void; } declare function parseCargoTomlWithTree(tree: Tree, projectRoot: string, projectName: string): CargoToml; declare function parseCargoToml(cargoString?: string): CargoToml; declare function stringifyCargoToml(cargoToml: CargoToml): string; declare function modifyCargoTable(toml: CargoToml, section: string, key: string, value: string | object | any[] | (() => any)): void; declare function modifyCargoNestedTable(toml: CargoToml, section: string, key: string, value: object): void; export { type CargoMetadata, type CargoToml, type Dep, type DepKind, type Dependency, type Docs, type Docs2, type Features, type Metadata, type Metadata2, type Node, type Package, type Resolve, type Rs, type Rs2, type Target, type Tree, modifyCargoNestedTable, modifyCargoTable, parseCargoToml, parseCargoTomlWithTree, stringifyCargoToml };