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

Reorganize src folder structure #751

Closed
Shinigami92 opened this issue Apr 1, 2022 · 2 comments · Fixed by #909
Closed

Reorganize src folder structure #751

Shinigami92 opened this issue Apr 1, 2022 · 2 comments · Fixed by #909
Assignees
Labels
c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug

Comments

@Shinigami92
Copy link
Member

Shinigami92 commented Apr 1, 2022

Move all modules into a src/modules folder

As this will mostly destroy work from active open PRs, we should do this when we have a low amount of open PRs
As I also don't know which side effects this could potentially cause, I would like to earliest target this for v7, also so we can currently focus on more important stuff right now

@Shinigami92 Shinigami92 added c: chore PR that doesn't affect the runtime behavior p: 1-normal Nothing urgent labels Apr 1, 2022
@Shinigami92 Shinigami92 added this to the v7 - Next Major milestone Apr 1, 2022
@Shinigami92 Shinigami92 moved this to Todo in Faker Roadmap Apr 1, 2022
@ST-DDT ST-DDT added the s: accepted Accepted feature / Confirmed bug label Apr 1, 2022
@Shinigami92 Shinigami92 changed the title Reorder internal src folder structure Reorganize src folder structure Apr 2, 2022
@Shinigami92
Copy link
Member Author

I highly recommend to follow a file structure like

- src/
  - modules/
    - address/
      - index.ts
      - module.ts
      - definition.ts
      - <...>.ts
    - /animal
      - ...
    - index.ts
  - index.ts

That way we do not need to open multiple path and search for loosely-coupled files and as a VSCode user I could benefit from file-nesting

@Shinigami92
Copy link
Member Author

Shinigami92 commented Apr 10, 2022

What about the actual locales data? The current structure is based on types (the definition files describe the folder structure for locales). If you structure them based on usage you have to do it consistently.

Yeah, I would like to move the content inside locales completely out of the src code and define them via static files that are accessible like assets and can be accessed from dist/esm and dist/cjs without duplicating them. So maybe bundled minified in dist/assets or dist/locales.
But I see this change after we are done with other stuff. (e.g. #823, #822)
Also I think we should not move them before that into my suggested src/modules/* because then I assume stuff inside https://github.com/faker-js/faker/blob/main/scripts/generateLocales.ts would break or at least will be harder to do.

@Shinigami92 Shinigami92 self-assigned this May 3, 2022
@Shinigami92 Shinigami92 moved this from Todo to In Progress in Faker Roadmap May 3, 2022
@Shinigami92 Shinigami92 linked a pull request May 3, 2022 that will close this issue
@Shinigami92 Shinigami92 added c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs and removed c: chore PR that doesn't affect the runtime behavior labels May 3, 2022
@Shinigami92 Shinigami92 moved this from In Progress to Awaiting Review in Faker Roadmap May 3, 2022
Repository owner moved this from Awaiting Review to Done in Faker Roadmap May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants