UNPKG

bit-bin

Version:

<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b

95 lines (94 loc) 3.62 kB
import { BitIds, BitId } from '../../bit-id'; import { ExtensionOptions } from '../../legacy-extensions/extension'; import { EnvExtensionOptions, EnvType } from '../../legacy-extensions/env-extension-types'; import { PathOsBased, PathLinux, PathOsBasedAbsolute, PathOsBasedRelative } from '../../utils/path'; import { AbstractVinyl } from '../component/sources'; import { ExtensionDataList } from './extension-data'; export declare type RegularExtensionObject = { rawConfig: Record<string, any>; options: ExtensionOptions; }; export declare type EnvFile = { [key: string]: PathLinux; }; export declare type EnvExtensionObject = { rawConfig: Record<string, any>; options: EnvExtensionOptions; files: string[]; }; export declare type TesterExtensionObject = EnvExtensionObject; export declare type CompilerExtensionObject = EnvExtensionObject; export declare type Envs = { [envName: string]: EnvExtensionObject; }; export declare type Compilers = { [compilerName: string]: CompilerExtensionObject; }; export declare type Testers = { [testerName: string]: TesterExtensionObject; }; export declare type AbstractConfigProps = { compiler?: string | Compilers; tester?: string | Testers; dependencies?: Record<string, any>; devDependencies?: Record<string, any>; compilerDependencies?: Record<string, any>; testerDependencies?: Record<string, any>; lang?: string; bindingPrefix?: string; extensions?: ExtensionDataList; }; export default class AbstractConfig { path: string; _compiler: Compilers | string; _tester: Testers | string; dependencies: { [key: string]: string; }; devDependencies: { [key: string]: string; }; compilerDependencies: { [key: string]: string; }; testerDependencies: { [key: string]: string; }; lang: string; bindingPrefix: string; extensions: ExtensionDataList; writeToPackageJson: boolean; writeToBitJson: boolean; constructor(props: AbstractConfigProps); get compiler(): Compilers | undefined; setCompiler(compiler: string | Compilers): void; get tester(): Testers | undefined; setTester(tester: string | Testers): void; addDependencies(bitIds: BitId[]): this; addDependency(bitId: BitId): this; hasCompiler(): boolean; hasTester(): boolean; getEnvsByType(type: EnvType): Compilers | null | undefined | Testers; static convertEnvToStringIfPossible(envObj: Envs | null | undefined): string | null | undefined | Envs; getDependencies(): BitIds; toPlainObject(): Record<string, any>; write({ workspaceDir, componentDir }: { workspaceDir: PathOsBasedAbsolute; componentDir?: PathOsBasedRelative; }): Promise<string[]>; prepareToWrite({ workspaceDir, componentDir }: { workspaceDir: PathOsBasedAbsolute; componentDir?: PathOsBasedRelative; }): Promise<AbstractVinyl[]>; toVinyl({ workspaceDir, componentDir }: { workspaceDir: PathOsBasedAbsolute; componentDir?: PathOsBasedRelative; }): Promise<AbstractVinyl[]>; static composeBitJsonPath(bitPath: PathOsBased): PathOsBased; static composePackageJsonPath(bitPath: PathOsBased): PathOsBased; static pathHasBitJson(bitPath: string): Promise<boolean>; static pathHasPackageJson(bitPath: string): Promise<boolean>; static loadJsonFileIfExist(jsonFilePath: string): Promise<Record<string, any> | null | undefined>; static removeIfExist(bitPath: string): Promise<boolean>; static transformEnvToObject(env: string | Record<string, any>): Envs; }