apostrophecms / apostrophecms/apostrophe
Should throw a hard error if a module has a slash in its name and is not following the npm namespacing convention
- Dominant language
- JavaScript
- Stars
- 4.6k
- Forks
- 650
- Avg merge
- 19h 21m
- Merged PRs (30d)
- 23
Description
## To reproduce
Step by step instructions to reproduce the behavior:
> 1. Pull a fresh version of A3 boilerplate: https://github.com/apostrophecms/a3-boilerplate/
> 2. Create a module in a subdirectory, for example `modules/nested/stuff/index.js`:
> ```js
> module.exports = {
> init: (self, options) => console.log(self.__meta.name, 'loaded')
> }
> ```
> 3. Declare said module in app.js
> ```js
> modules: {
> ...
> 'nested/stuff': {}
> ```
> 3. Run the server
> 4. Check the server output
## Expected behavior
The module should be loaded without warning.
## Describe the bug
At startup, the module `nested/stuff` is loaded and fully functional, but the warning below will appear:
> You have a /path/to/your/project/modules/nested folder, but that module is not activated in app.js and it is not a base class of any other active module. Right now that code doesn't do anything.
Which doesn't make sense in this case, as `nested` is part of the name of the actual module, not a module by itself. At the same time, one can create nested modules that are not loaded without a warning being raised.
## Details
**Version of Node.js:** 14
**Apostrophe version used:** 3.0.0-alpha.2
Contributor guide
Research direction
Reproduce the behavior using the A3 boilerplate with modules/nested/stuff/index.js and the corresponding app.js declaration, then inspect the module-loading path reached during server startup. Compare how nested/stuff is treated with an inactive nested module, and verify that the resulting startup behavior matches the requested namespacing and error handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100