Bit: Importing single file components

Created on 10 Jun 2020  路  3Comments  路  Source: teambit/bit

Description

I have a bunch of components that are single files, I don't need to have them in their own directories, is there some way to import them into a directory of my choosing using the -p argument, without having to use --override to delete all contents of the directory?

typhelp wanted wontfix

Most helpful comment

@JGJP That will be a pretty big list, you can find some of it here.
I'll just write down some of the advantages shortly. (there are more in the list)
In general bit and npm are not serve exactly the same purpose, the npm install of component is a small part of bit eco system.

So here is a short list:

  1. bit enable you to publish hundreds of components from the same repo without the overhead of set it all up. with much faster ops about the components (like build and test).
  2. almost zero setup of ops like compiling, testing, listing configuration. with the ability to share and reuse those configuration across organization in an easy way.
  3. ability to import and change the component from any other project - bit manages source code, npm manage distribution files.
  4. soon bit will give you a local environment of documenting and rendering the component.
  5. bit manage your dependency automatically - identify and resolve them for you. resolve the versions for you.
  6. bit manage the versions for you for the entire graph, but individually for each component. it's a very hard task to do in scale.

in case you also use bit.dev cloud service you can also get:

  1. real discovery of components - search, filter, docs with a contextual search like by dependencies, by size, by ranking etc.
  2. ci in the component level (the fastest one exist since it knows to only run on the relevant parts of your entire graph).
  3. portal to see all of your components with auto rendering and playground

If you want to discuss it more, our slack channel is the place for this.

All 3 comments

@JGJP
While we understand your case, this is not something you can do at the moment.
We also not plan to implement it in the near future, we are also deprecating the option to track single file components soon (in order to make the author and import environment the same).
The rationale is mainly about the need for components to have their own config / package.json and their own node_modules sometime.
Making everything a directory makes bit much more predictable and stable.

If components would need to have their own package.json then what is the advantage of using Bit instead of private npm packages or Git submodules?

@JGJP That will be a pretty big list, you can find some of it here.
I'll just write down some of the advantages shortly. (there are more in the list)
In general bit and npm are not serve exactly the same purpose, the npm install of component is a small part of bit eco system.

So here is a short list:

  1. bit enable you to publish hundreds of components from the same repo without the overhead of set it all up. with much faster ops about the components (like build and test).
  2. almost zero setup of ops like compiling, testing, listing configuration. with the ability to share and reuse those configuration across organization in an easy way.
  3. ability to import and change the component from any other project - bit manages source code, npm manage distribution files.
  4. soon bit will give you a local environment of documenting and rendering the component.
  5. bit manage your dependency automatically - identify and resolve them for you. resolve the versions for you.
  6. bit manage the versions for you for the entire graph, but individually for each component. it's a very hard task to do in scale.

in case you also use bit.dev cloud service you can also get:

  1. real discovery of components - search, filter, docs with a contextual search like by dependencies, by size, by ranking etc.
  2. ci in the component level (the fastest one exist since it knows to only run on the relevant parts of your entire graph).
  3. portal to see all of your components with auto rendering and playground

If you want to discuss it more, our slack channel is the place for this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manuel-minniti picture manuel-minniti  路  3Comments

idkjs picture idkjs  路  4Comments

williamluke4 picture williamluke4  路  4Comments

itaymendel picture itaymendel  路  4Comments

KutnerUri picture KutnerUri  路  3Comments