I encounter a bug when adding files contained in a component directory generated by Angular. Bit tells me: “can not add 3 components with the same ID”. Someone would have a trick to by-pass this without changing the name of my files generated by Angular CLI?
Can you please paste here an example of the directory tree you have and the
bit add syntax you tried?
It’s a typical initial Angular project (
ng new my project; angular cli version is 7.3.9). I just add one component with the command
ng generate component cube in a terminal located in Myapp/src/app/components (in my case “cube” is the name of the component).
Next I execute
bit init in the root folder of the project : work fine.
And I go to (cd command) Myapp/src/app/components and execute
bit add .\cube\* and here is my error :
unable to add 3 components with the same ID: cube/cubecomponent : src/app/components/cube/cube.component.css,src/app/com
When I change the name of the part of the cube component like : cubeHTML.component.html , cubeTS.component.ts, cubeCSS.component.css for example then the add command works…
Do you have any clue ? I don’t want to rename my component all the time to “bit add” them.
Can you try and run
bit add src/app/cube/* --main cube.component.ts --id cube?
When you want to track an entire directory as a component you should either state a specific ID for the component or drop the asterisk (`bit add src/app/cube --main cub.components.ts).
The reason I’m using the
main flag is that Bit defaults to
index files as the entry point of components. ng does not seem to generate such files, so I have to point it to the correct one.
It works ! Thank you for your help !