-
Notifications
You must be signed in to change notification settings - Fork 100
Description
(Note: I'm specifically referencing yarn since that's what I'm familiar with, but this issue is relevant for npm as well).
By default, installing npm dependencies with scalajs-bundler+yarn will also possibly change/update versions of transitive npm dependencies (and modify the lockfile yarn.lock). This can cause issues like #259. The solution is that yarn should be run with --frozen-lockfile so that the versions in the lockfile are actually respected (i.e., you get a reproducible build), unless you are specifically intending to update your npm dependencies.
In fact, this issue of frozen lockfiles will be directly addressed in the next major version of yarn: yarnpkg/yarn#4147 (comment)
IMHO the --frozen-lockfile argument is important enough that it should be exposed as an sbt setting and/or there should be alternative versions of tasks available to install npm dependencies with/without freezing the lockfile. Even better it should be frozen by default. Arguably this is the expected behaviour for those of us used to maven/sonatype (i.e., transitive dependency versions don't randomly change between builds).
This would facilitate integration with plugins such as sbt-github-actions (which have knowledge of whether the build is running in CI).
This would also be extremely helpful in scala-steward so that it is easily able to disable freezing and update a lockfile while updating Scala dependencies. This is critical when changes in npm dependencies are inherited transitively from a Scala dependency. See scala-steward-org/scala-steward#2252.