/// import * as readPkg from 'read-pkg'; import { IEngine } from './engine'; import { IPJSON } from './pjson'; import { ITopic } from './topic'; export declare type PlatformTypes = 'darwin' | 'linux' | 'win32' | 'aix' | 'freebsd' | 'openbsd' | 'sunos'; export declare type ArchTypes = 'arm' | 'arm64' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x32' | 'x64' | 'x86'; export interface IConfig { /** * @anycli/config version */ _base: string; /** * base path of root plugin */ root: string; /** * process.arch */ arch: ArchTypes; /** * bin name of CLI command */ bin: string; /** * cache directory to use for CLI * * example ~/Library/Caches/mycli or ~/.cache/mycli */ cacheDir: string; /** * full path to command dir of plugin */ commandsDir: string | undefined; /** * full path to command dir of plugin's typescript files for development */ commandsDirTS?: string; /** * normalized full paths to hooks */ hooks: { [k: string]: string[]; }; /** * normalized full paths to typescript hooks */ hooksTS?: { [k: string]: string[]; }; /** * if plugins points to a module this is the full path to that module * * for dynamic plugin loading */ pluginsModule: string | undefined; /** * if plugins points to a module this is the full path to that module's typescript */ pluginsModuleTS: string | undefined; /** * config directory to use for CLI * * example: ~/.config/mycli */ configDir: string; /** * data directory to use for CLI * * example: ~/.local/share/mycli */ dataDir: string; /** * base dirname to use in cacheDir/configDir/dataDir */ dirname: string; /** * points to a file that should be appended to for error logs * * example: ~/Library/Caches/mycli/error.log */ errlog: string; /** * path to home directory * * example: /home/myuser */ home: string; /** * CLI name from package.json */ name: string; /** * full package.json * * parsed with read-pkg */ pjson: IPJSON; /** * process.platform */ platform: PlatformTypes; /** * active shell */ shell: string; /** * parsed tsconfig.json */ tsconfig: TSConfig | undefined; /** * user agent to use for http calls * * example: mycli/1.2.3 (darwin-x64) node-9.0.0 */ userAgent: string; /** * cli version from package.json * * example: 1.2.3 */ version: string; /** * if windows */ windows: boolean; /** * debugging level * * set by ${BIN}_DEBUG or DEBUG=$BIN */ debug: number; /** * active @anycli/engine */ engine: IEngine; /** * npm registry to use for installing plugins */ npmRegistry: string; /** * a Heroku pre-anycli plugin */ legacy: boolean; /** * list of topics */ topics: ITopic[]; } export interface TSConfig { compilerOptions: { rootDirs?: string[]; outDir?: string; }; } export interface ConfigOptions { name?: string; root?: string; baseConfig?: IConfig; } export declare class Config implements IConfig { /** * registers ts-node for reading typescript source (./src) instead of compiled js files (./lib) * there are likely issues doing this any the tsconfig.json files are not compatible with others */ readonly _base: string; arch: ArchTypes; bin: string; cacheDir: string; configDir: string; dataDir: string; dirname: string; errlog: string; home: string; name: string; pjson: any; platform: PlatformTypes; root: string; shell: string; version: string; windows: boolean; userAgent: string; commandsDir: string | undefined; commandsDirTS: string | undefined; pluginsModule: string | undefined; pluginsModuleTS: string | undefined; tsconfig: TSConfig | undefined; debug: number; hooks: { [k: string]: string[]; }; hooksTS?: { [k: string]: string[]; }; engine: IEngine; npmRegistry: string; legacy: boolean; topics: ITopic[]; constructor(); load(root: string, pjson: readPkg.Package, baseConfig?: IConfig): Promise; scopedEnvVar(k: string): string | undefined; scopedEnvVarTrue(k: string): boolean; scopedEnvVarKey(k: string): string; protected _topics(): void; private dir(category); private windowsHome(); private windowsHomedriveHome(); private windowsUserprofileHome(); private macosCacheDir(); private _tsConfig(); /** * convert a path from the compiled ./lib files to the ./src typescript source * this is for developing typescript plugins/CLIs * if there is a tsconfig and the original sources exist, it attempts to require ts- */ private _tsPath(orig); private _hooks(); private _shell(); private _debug(); } /** * returns true if config is instantiated and not ConfigOptions */ export declare function isIConfig(o: any): o is IConfig; /** * reads a plugin/CLI's config */ export declare function read(opts?: ConfigOptions): Promise;