-
Notifications
You must be signed in to change notification settings - Fork 138
Description
Tell us about your environment
- MarkBind Version: the next (unpublished) release
What actually happened? Please include the actual, raw output.
What did you do? Please include the actual source code causing the issue.
Suspected cause: we moved towards using relative file specifiers in package.json (@markbind/core: "file:packages/core") since the last release. I've confirmed that subpackage package.jsons are indeed published, however, when doing npm install -g, npm attempts to resolve the root package.json's dependencies first without having downloaded the entire package (including the subpackage's package.json). This causes the above error.
Attempted Solutions (from posts and articles)
npm cache clean --force+npm cache verify- dosen't work, and users shouldnt have to do this to upgrade.- using npm shrinkwrap, which is essentially a publishable
package-lock.json. This causes amaximum call stack size exceedederror with a not very useful debug log either.
Proposed solution
We opted for the current structure (a root markbind-cli package with 2 subpackages) for reasons of simplicity for now. From searching up similar issues, the working solutions all tended towards:
_private_ (unpublished) root package.json managed by lerna / yarn workspaces (simply a meta file, possibly containing dev dependencies, but not actually a package)
packages (all published independently)
- package A
- package B
- package C
- ...
which is also the structure many well known projects use (babel, react, gatsby, ...).
The devtools often used here are lerna (+ yarn workspaces).
Solution: Let's move towards this more conventional structure, and publish each package independently and separately using lerna as a high level helper (yarn workspaces can come later if really needed).
This also paves the way for future packages #1248 (comment).
- Move markbind-cli into
packages/cli(but retain package naming for "backwards naming compatibility") (PR 1) - setup lerna, edit the devguide sections accordingly (PR 2)
- publish
Reservations
It's a little strange for package.jsons to allow relative file:... specifiers but have them break when published. I haven't been able to find much on this (most solutions just tended towards lerna + yarn) so far either.
Likely, they are only intended to be used in development environments, but maybe I just haven't come across the right post / article. e.g. lerna uses this to hoist dependencies to the root in one of it's configurations. (lerna link convert) Would be nice if anyone has more relevant info on this.
