RFC: Apostrophe 3 modules directory name/nesting
See original GitHub issueIn Apostrophe 2.x, the directory containing individual module directories is lib/modules
. Having been involved with many Apostrophe sites over the last few years, I’ve only seen other files or directories directly in this root level lib
directory a couple of times. To my understanding, nesting modules
within the lib
directory was originally done due to concern that developers might be confused by having a modules
directory as a sibling of the common node_modules
directory. There was also desire to keep it feeling like a Node application, rather than a CMS that’s simply using Node, and so the structure was kept more generic.
With Apostrophe 3.x we have a chance to reconsider this. Given that the node_modules
directory is such a common concept for Javascript developers and, secondarily, that IDEs typically will fade directories like node_modules
that are ignored by git, I’m not totally convinced that developers would have much trouble managing the two directories.
A case for lib/modules
:
- There is no change for developers used to the Apostrophe 2.x structure
- This structure will not need to change when upgrading 2.x projects to 3.x.
- If the concern about confusing
modules
andnode_modules
is warranted, that confusion will be avoided
A case for modules
at project root level:
- Less unnecessary directory nesting
- We’re already requiring much more significant changes to modules when upgrading (e.g., naming, actual code structure), so simply shifting the parent directory to the project root seems trivial
- Arguably cleaner code structure, with the root level telling a clearer “story” of the application, with
app.js
already on the root level.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (9 by maintainers)
Top GitHub Comments
So far it looks like everyone likes
modules
at root level. Greg discussed the hypothetical wherelib
is the root of the whole project, but also said he prefers a flatter structure, so I assume he’s comfortable if we go withmodules
.Are we there?
We are there!