UNPKG

yaml-js-include

Version:

Extension for yaml-js library to be able to include files/directories in yaml files

70 lines (69 loc) 2.05 kB
import * as yaml from 'js-yaml'; import { YamlInclude } from './include'; export declare function recursiveReaddirSync(path: string, recursive?: boolean): string[]; export interface BaseIncludeDirOptions { /** * Always include these file * @default [] */ include?: string[]; /** * Always exclude this files * @default [] */ exclude?: string[]; /** * Determines whether to allow empty entries * @default false */ allowEmpty: boolean; /** * Determines whether to look for files recursively * @default true */ recursive: boolean; /** * List of allowed file extensions * @default ['.yaml', '.yml'] */ extensions: string[]; /** * Prefix of the file names to be ignored * @default '_' */ ignoreIndicator: string; } /** Describes options for including directories */ export interface IncludeDirOptions extends BaseIncludeDirOptions { /** * Determines whether to include top directory directly and not inside of top directory name property * @default true */ ignoreTopLevelDir: boolean; /** * Determines whether to ignore dir structure for constructing properties */ ignoreDirStructure: boolean; /** * Determines whether to remove path separator ('/') from top directory name * @default true */ excludeTopLevelDirSeparator: boolean; /** * Determines whether to convert property names into lower case * @default false */ lowerKeys: boolean; /** * Separator to use when constructing property names based on the directory structure * @default '_' * @example File inside `books/chapters/first.yaml` will be converted to `book_chapters_first` property name */ pathSeparator: string; } /** * Gets a schema for including directories * @param yamlInclude YAML include object * @returns {yaml.Type} YAML type for a schema */ export declare const getDirectoryIncludeType: (yamlInclude: YamlInclude) => yaml.Type;