Skip to content

Instantly share code, notes, and snippets.

@GiladShoham
Last active July 1, 2019 09:17
Show Gist options
  • Save GiladShoham/b59ee81cd806aa1510b11cd2a1405420 to your computer and use it in GitHub Desktop.
Save GiladShoham/b59ee81cd806aa1510b11cd2a1405420 to your computer and use it in GitHub Desktop.
Bit add many - programmatic API example
const COMPONENT_ORIGINS = {
IMPORTED: 'IMPORTED',
AUTHORED: 'AUTHORED',
NESTED: 'NESTED' // which is a nested dependency
};
ComponentOrigin = $Keys<typeof COMPONENT_ORIGINS>;
type PathOsBased = string; // OS based format. On Windows it's Windows format, on Linux it's Linux format.
type PathOrDSL = PathOsBased | string; // can be a path or a DSL, e.g: tests/{PARENT}/{FILE_NAME}
type Warnings = {
alreadyUsed: Object,
emptyDirectory: string[]
};
type ComponentMapFile = {
name: string,
relativePath: PathLinux,
test: boolean
}
type AddResult = { id: string, files: ComponentMapFile[] };
type AddActionResults = { addedComponents: AddResult[], warnings: Warnings }
type AddProps = {
componentPaths: PathOsBased[],
id?: string,
main?: PathOsBased,
tests?: PathOrDSL[],
exclude?: PathOrDSL[],
override: boolean,
trackDirFeature?: boolean,
origin?: ComponentOrigin
};
addMany: async (components: AddProps[], alternateCwd?: string): Promise<AddActionResults[]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment