EHOIST_ROOT_VERSION warning hoisting question
See original GitHub issueA general question about the warning EHOIST_ROOT_VERSION
. Given the log information below, does this mean foo
would be duplicated in the leaf package or is lerna smart enough to know it satisfies semver and is ok to be hoisted?
04:23:43 lerna WARN EHOIST_ROOT_VERSION The repository root depends on foo@~0.0.10, which differs from the more common foo@0.0.x.
I ask because later on in my logs I see the following message as well:
04:23:43 lerna WARN EHOIST_PKG_VERSION "bar" package depends on foo@0.0.x, which differs from the hoisted foo@~0.0.10.
According to semver both 0.0.x
and ~0.0.10
should resolve to the same version and hoisted appropriately. Is my assumption incorrect?
lerna.json
{
"lerna": "2.0.0-rc.4",
"version": "independent"
}
Context
Your Environment
Executable | Version |
---|---|
lerna --version |
2.0.0-rc.5 |
npm --version |
5.0.0 |
node --version |
v8.0.0 |
OS | Version |
---|---|
NAME | VERSION |
macOS Sierra | 10.12.5 |
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Function Hoisting & Hoisting Interview Questions
I'll expand on function hoisting in this one along with some common and tricky interview questions on hoisting (variable and function) which ...
Read more >Hoisting demystified with popular interview questions | by Vivek
In this post, we will learn about one of the most frequently asked questions in an interview, hoisting in javascript.
Read more >Why variable hoisting after return works on some browsers ...
In JavaScript variables are moved to the top of script and then run. So when you run it will do var myVar1; alert(myVar1);...
Read more >Understanding Hoisting in JavaScript - DigitalOcean
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution.
Read more >Javascript hoisting | javascript interview questions - YouTube
hoisting #interview #javascriptHi Everyone,In this week's video, we take a look at one of the core concepts of Javascript, that is Hoisting.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I get annoyed by those messages too, but I agree with @ricky that it’s better to be explicit. Especially when hoisting from a root
node_modules
that is governed by a lockfile (yarn.lock
,package-lock.json
, ornpm-shrinkwrap.json
), you really need to be explicit.I have been noodling about adding a
lerna hoist
subcommand that would streamline some of these operations, similar to howyarn workspaces
goes about things (but always from the root, not the package directory directly).While
bootstrap
usessemvar.satisfies
when looking up local packages for the internal dependency graph, it otherwise just uses the version string to group like dependencies.So, hoisting common versions turns out to be a straight string comparison on the values in
package.json
files. Whether this is a feature or a bug is question for the original authors. My guess is that someone felt that semvar matching under-the-hood was a more complex solution than simply putting the onus on the end users to manually synchronize their package dependencies.IMO, what’s necessary is to be as consistent as possible, rather than as generic as possible. For example, if you have two packages that truly depend on “react”: “^15.0.0”, then make sure they’re declared w/ the same string (always “react”: “^15.0.0”, and not “react”: “15.x.x” or “react”: “^15.1.0” in some packages). This may require a little manual intervention when using npm install --save and how much of a PITA that is obviously scales linearly with the number of packages in your project…