refactor: standardize entry points and project structure#347
Conversation
- Move main logic to root index.js - Update package.json entry points
jsumners
left a comment
There was a problem hiding this comment.
There's really no need for change.
I’ve submitted this change request in only 4 or 5 repositories; the others all have an |
|
Both of these are already "well organized." The primary, or only, source code for the plugin is in an appropriately named |
All the other plugins have an |
How does that benefit these independent projects? Why does the structure of another project's code affect the structure of some other project's structure? These changes are not inconsequential. They will introduce, at a minimum, annoyance when navigating the code history. I commented on the ones I have an interest in, but I noticed in another that an index file was created simplely to point to another file in a new directory. That introduces many file resolution cycles and an annoyance when navigating the code: clicking in to what one thinks is the entry point file only to see that it's at a different place. The manifest clearly states what the entry point is to both the runtime and the human. My reviews are not blocking reviews. I just don't see the point in these changes. |
To answer your question about how this benefits independent projects: the main goal isn’t to change the logic of this specific plugin, but to reduce the cognitive load for contributors who move between the various projects in the Fastify ecosystem. When every plugin o library follows the same pattern (structure, entry points, naming conventions), it becomes much easier to automate routine tasks and maintenance. While contributing to many repositories over the past few months, I’ve noticed that I often have to stop and examine the package.json file or the file tree just to identify the actual entry point. Personally, having a predictable |
|
You're absolutely right, the manifest is the source of truth for both the runtime and anyone looking for the technical entry point. My point is more about visual consistency and 'convention over configuration' across the organization. While the manifest tells you where to look, having a standardized structure allows a developer to navigate the code almost subconsciously, without having to open the package.json as a first step every time they switch between plugins or library. 😄 I’m happy to follow the consensus of the team on whether this level of standardization is desired for the ecosystem or if we prefer to keep each repository's unique structure 😉 |
|
Just saw your comment, @jsumners. I’m biased toward cleaning and harmonizing everything up, but that’s more of a personality trait than a rational position, so I don’t have a strong opinion. If you think this is useless and eventually annoying, we can reject the PRs. |
gurgunday
left a comment
There was a problem hiding this comment.
I'm also fine with either way, but I guess this doesn't hurt
|
In the same camp as @jean-michelet, making the plugin repos uniform is nice! |
Proposal:
Renamed the main plugin file to
index.jsto provide a standard entry point for the package. This simplifies imports and follows the common pattern used in the Fastify ecosystem.Changes:
plugin.js→index.jspackage.jsonmain field.See PR reference: