Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify tracking main component files #1714

Closed
itaymendel opened this issue Jun 6, 2019 · 2 comments
Closed

Simplify tracking main component files #1714

itaymendel opened this issue Jun 6, 2019 · 2 comments

Comments

@itaymendel
Copy link
Contributor

itaymendel commented Jun 6, 2019

Bit needs to define a main file for each component. This file is used as the entry point for the package.json it generates. There are few rules in place to define one of the files as the main file. If all rules fail, Bit prompt an error asking the user to define them with the --main flag.

Seeing that many projects use a convention where all the files of a component are in the same directory, Bit should support it and better detect main files. This is relevant when tracking a directory as a component, or all files in a directory as a single component.

[partent-dir-name].js|ts|tsx|vue

Some teams prefer the main file of a component to be the name of the component, meaning - the same name of the directory that the component is implemented. For example:

$ tree src/components
├── button
│   ├── button.ts
│   ├── button.scss
│   └── button.spec.ts

In this example, for the directory button, the main file is button.ts.

davidfirst added a commit that referenced this issue Jul 26, 2019
…ame name as its dir. also, extract the logic of finding the mainFile from bitMap class to a new file and reoranize the code to loop through the different strategies
davidfirst added a commit that referenced this issue Jul 27, 2019
… as its dir (#1860)

* implement #1714, auto recognize mainFile when a file added with the same name as its dir. 

* extract the logic of finding the mainFile from bitMap class to a new file and reorganize the code to loop through the different strategies
@ranm8
Copy link
Member

ranm8 commented Mar 29, 2020

@davidfirst what is the status of this?

@davidfirst
Copy link
Member

@ranm8 , I verified that this was completed. The CHANGELOG file has this:
- [#1714](https://github.com/teambit/bit/issues/1714) auto recognize mainFile when a file added with the same name as its dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants