I am trying to make a monorepo with lerna, but when i try to watch the workspace with lerna watch it show inconsistent results
My project and workflow
The following image shows my workflow with :
- top window : lerna output of :
npx -c 'lerna watch -- echo \$LERNA_PACKAGE_NAME \$LERNA_FILE_CHANGES'which echoes whenever it detect changes in the project (command taken from here) - bottom left : me with ranger (file explorer) and vim (code editor) editing random files until it works
- bottom right : output of nx logs :
tail blurred_path/lernatest/node_modules/.cache/nx/d/daemon.log --follow
My test project looks like this (tree --gitignore)
.
├── lerna.json
├── package.json
├── package-lock.json
└── packages
├── pkgA
│ ├── main.js
│ └── package.json
├── pkgB
│ ├── main.js
│ └── package.json
└── pkgC
├── main.js
└── package.json
Problem
When I edit files (any ./packages/pkg*/main.js or ./packages/pkg*/package.json), new lines are printed in nx logs (bottom right window),
And most of the time no new lines on lerna watch output (top window)
But sometime it does! Idk, I found no pattern ... Only when i run npx nx reset, the first edit always output a new line on lerna watch
I only once had a perfect run where each file write resulted in a new line, but when i stopped the process (^C) and retried, it restarted to be inconsistent
My system
Output of npx lerna info :
Environment info:
System:
OS: Linux 6.5 Arch Linux
CPU: (8) x64 AMD Ryzen 3 5300U with Radeon Graphics
Binaries:
Node: 20.9.0 - /sbin/node
npm: 10.2.2 - /sbin/npm
Utilities:
Git: 2.42.0 - /sbin/git
npmPackages:
lerna: ^7.4.2 => 7.4.2
Some of my files
# ./package.json
{
"name": "lernatest",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"workspaces": [
"packages/*"
],
"author": "",
"license": "ISC",
"devDependencies": {
"lerna": "^7.4.2"
}
}
# ./lerna.json
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "0.0.0"
}
# ./packages/pkgA/package.json
{
"name": "pkga",
"version": "1.0.0",
"description": "a",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Note
Btw, yes I use Arch, and ranger, and vim..
For arch i actually cannot know if it's the problem, i don't have any other computer to test on, but it's not vim, I tested on sublime text, and It shows the same inconsistencies
