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) 4.3 kB
import Consumer from '../../../consumer/consumer'; import BitMap from '../../../consumer/bit-map'; import { BitId } from '../../../bit-id'; import { BitIdStr } from '../../../bit-id/bit-id'; import { ComponentMapFile, ComponentOrigin } from '../../bit-map/component-map'; import ComponentMap from '../../bit-map/component-map'; import { PathLinux, PathOsBased } from '../../../utils/path'; import { ModelComponent } from '../../../scope/models'; export declare type AddResult = { id: string; files: ComponentMapFile[]; }; declare type Warnings = { alreadyUsed: Record<string, any>; emptyDirectory: string[]; existInScope: BitId[]; }; export declare type AddActionResults = { addedComponents: AddResult[]; warnings: Warnings; }; export declare type PathOrDSL = PathOsBased | string; declare type PathsStats = {}; export declare type AddedComponent = { componentId: BitId; files: ComponentMapFile[]; mainFile?: PathOsBased | null | undefined; trackDir?: PathOsBased; idFromPath: { name: string; namespace: string; } | null | undefined; immediateDir?: string; }; export declare type AddProps = { componentPaths: PathOsBased[]; id?: string; main?: PathOsBased; namespace?: string; tests?: PathOrDSL[]; exclude?: PathOrDSL[]; override: boolean; trackDirFeature?: boolean; origin?: ComponentOrigin; }; export declare type AddContext = { consumer: Consumer; alternateCwd?: string; }; export default class AddComponents { consumer: Consumer; bitMap: BitMap; componentPaths: PathOsBased[]; id: string | null | undefined; main: PathOsBased | null | undefined; namespace: string | null | undefined; tests: PathOrDSL[]; exclude: PathOrDSL[]; override: boolean; trackDirFeature: boolean | null | undefined; warnings: Warnings; ignoreList: string[]; gitIgnore: any; origin: ComponentOrigin; alternateCwd: string | null | undefined; addedComponents: AddResult[]; constructor(context: AddContext, addProps: AddProps); joinConsumerPathIfNeeded(paths: PathOrDSL[]): PathOrDSL[]; getFilesAccordingToDsl(files: PathLinux[], filesWithPotentialDsl: PathOrDSL[]): Promise<PathLinux[]>; _isGeneratedForUnsupportedFiles(fileRelativePath: PathLinux, componentId: BitId, componentMap: ComponentMap): Promise<boolean>; _isPackageJsonOnRootDir(pathRelativeToConsumerRoot: PathLinux, componentMap: ComponentMap): boolean; _isOutsideOfWrapDir(pathRelativeToConsumerRoot: PathLinux, componentMap: ComponentMap): boolean; addOrUpdateComponentInBitMap(component: AddedComponent): Promise<AddResult | null | undefined>; _updateFilesAccordingToExistingRootDir(foundComponentFromBitMap: ComponentMap, componentFiles: ComponentMapFile[], component: AddedComponent): void; _mergeFilesWithExistingComponentMapFiles(componentFiles: ComponentMapFile[], existingComponentMapFile: ComponentMapFile[]): any; _updateFilesWithCurrentLetterCases(currentComponentMap: ComponentMap, newFiles: ComponentMapFile[]): void; _getComponentFromScopeIfExist(id: BitId): Promise<ModelComponent | null | undefined>; removeExcludedFiles(componentsWithFiles: AddedComponent[]): Promise<void>; _getIdAccordingToExistingComponent(currentId: BitIdStr): BitId; _getIdAccordingToTrackDir(dir: PathOsBased): BitId | null | undefined; _addMainFileToFiles(files: ComponentMapFile[]): PathOsBased | null | undefined; _findMainFileInFiles(mainFile: string, files: ComponentMapFile[]): ComponentMapFile | undefined; _mergeTestFilesWithFiles(files: ComponentMapFile[]): Promise<ComponentMapFile[]>; addOneComponent(componentPathsStats: PathsStats): Promise<AddedComponent>; getIgnoreList(): Promise<string[]>; add(): Promise<AddActionResults>; addMultipleComponents(componentPathsStats: PathsStats): Promise<void>; _removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats: PathsStats): void; _addMultipleToBitMap(added: AddedComponent[]): Promise<void>; _removeNamespaceIfNotNeeded(addedComponents: AddedComponent[]): void; _tryAddingMultiple(componentPathsStats: PathsStats): Promise<AddedComponent[]>; _throwForOutsideConsumer(relativeToConsumerPath: PathOsBased): void; } export {};