Problem with install and linking (on fresh monorepo)
- Dominant language
- JavaScript
- Stars
- 2.4k
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
| Title | Description
| --------------------|------------
| Version | ^0.20.7
| Type | issue
| node | 10.3.0, yarn 1.7
| Operating System | ArchLinux
| Short Description | fresh `bolt install` problem
**Detailed description**
I have fresh monorepo with 4 packages in it.
Link to it https://github.com/olstenlarck/hela/tree/v3-major.
Basic assumption is to just run `bolt install` in the project root and everything to be installed and linked. But it errors with that it can't link external dependencies of the each project.
```
~/tunnckoCore/hela v3-major *
❯ bolt install
⚡️ bolt v0.20.7 (node v10.3.0)
🔎 [1/3] Validating project...
📦 [2/3] Installing project dependencies...
$ /home/charlike/.config/yarn/global/node_modules/bolt/node_modules/.bin/yarn config get user-agent yarn/1.7.0 npm/?node/v10.3.0 linux x64
yarn install v1.7.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.58s.
🔗 [3/3] Linking workspace dependencies...
error Package "@hela/core" dependency "execa-pro" must be added to project dependencies.
error Package "@hela/core" dependency "sade" must be added to project dependencies.
error Cannot symlink invalid set of dependencies.
```
I figured out that Bolt needs to install each dependency for each project seprately, using `bolt` like
```
bolt w @hela/cli add
bolt w @hela/core add
bolt w @hela/dargs add
bolt w @hela/config-tunnckocore add
```
So it adds all of them to the root `dependencies` and [once they are there](https://github.com/olstenlarck/hela/blob/b78fcce172213e14f73e5fbed12da5258d15e33e/package.json#L37-L42), then cleaning all of the packages' node_modules (e.g. `rm -rf packages/cli/node_modules`) and running `bolt install` on the root - everything works without errors.
I can understand why this is needed. But first, there is no docs for this. And second, it would be better before doing anything and the install, to scan each package deps in the defined workpaces, add then add them to the project root and after that start the install process.
This will simplify the manual process that i've done.
So `bolt install` should act like that:
Oh, okey, workspaces is `packages/*`, i'm going to scan each package deps - there is `packages/core` with two deps in its `package.json` - I'm going to add them as `dependencies` to the project root (e.g. `bolw w @hela/core `).
Okey, there is `packages/cli` with 3 dependencies, one of which is the `packages/core` - i'm going to add them to the project root, except the package from `packages/core`.
Okey, i'm done, i'll run `bolt install` now.
Contributor guide
Research direction
Reproduce the failure with the linked hela monorepo and its root and workspace package.json files by running bolt install. Trace how workspace dependencies are validated and linked, then define completion as a fresh install that discovers external dependencies from each workspace without requiring them to be manually added to the root; the required documentation should also explain the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100