Open AB-xdev opened 3 years ago
The results of mvn clean install -Pproduction in package-lock.json should not differ when either having an existing package.json/package-lock.json or having none"
I think this expectation is wrong because the whole point of package-lock.json
from the point of view of npm
is that the versions mentioned in package-lock.json
are installed. If you have a package-lock.json
that says ini
version 1.3.5
should be used, then npm
will install that. If you do not have a package-lock.json
containing ini
, then npm
will pick the latest version available that matches requirements of other packages. In this case, ^1.3.5
will be resolved to 1.3.8
and then 1.3.8
will be entered in package-lock.json
to ensure that the next npm install
will install that version.
At first: Thanks for the quick feedback 😄
Okay that ... kind of makes sense. I don't think I'm going to like that behavior but I understand the circumstances.
However isn't there a way of "forcing" updates (beside deleting the package-lock.json
) when running build-frontend
?
So when running "npm install" all versions that are not fixed (e.g. ^1.3.5
) get updated to the most recent version (1.3.8
).
It doesn't sound good when GitHub recommends security updates to you for npm packages and they are impossible to fix because npm doesn't update them.
You can run npm update
manually and should get the same result as when removing package-lock.json
but Flow is not running that automatically
There is the opposite problem that sometimes new npm packages are broken. If everything was always auto updated then all projects in the world would end up in a broken state immediately when a broken npm package is released.
Basically Vaadin should in NPM mode (but not for pnpm) clean up the package-lock.json
and node_modules
in the case where the Vaadin version has updated by comparing the shrinkwrap versions.
This should be done automatically even for bugfix changes.
Description of the bug
Backstory:
We recently switched from Vaadin 14.4.3 to 14.4.8 in https://github.com/xdev-software/vaadin-date-range-picker/pull/63. We expected that this also closes the following security alert: https://github.com/xdev-software/vaadin-date-range-picker/pull/55
Dependabot created a PR, where it updated the Vaadin-Version in the pom.xml, however we still have to update the
package.json
andpackage-lock.json
manually, because dependabot can't do that. So I checked out the branch and executedmvn clean install -Pproduction
. This updated thepackage.json
. But it looks like it failed to update thepackage-lock.json
completely.We only noticed this weird circumstance because the security warning was still there, beside being on the (then) latest Vaadin version.
The problem was solved by deleting
node_modules
,package.json
,package-lock.json
,webpack.config.js
locally and rerunningmvn clean install -Pproduction
: https://github.com/xdev-software/vaadin-date-range-picker/commit/89c3b86484cf8186a53ff37c3c42d0f5d202ddf6Minimal reproducible example
git checkout 3a7660c
mvn clean install -Pproduction
→ This should generate the node_modulesgit checkout 0cc7df6
mvn clean install -Pproduction
again. As you see, thepackage.json
andpackage-lock.json
get updated. Howeverpackage-lock.json
's "ini" dependency should now be on version 1.3.8, but it's just 1.3.5package.json
package-lock.json
node_modules
webpack.config.js
mvn clean install -Pproduction
the files are different and the package-lock.json is now fully updated as expected.Expected behavior
mvn clean install -Pproduction
inpackage-lock.json
should not differ when eitherpackage.json
/package-lock.json
Suggested workaround
package.json
,package-lock.json
andwebpack.config.js
in gitVersions: