#49594 closed enhancement (fixed)
Consider using the "install-changed" package
Reported by: | azaozz | Owned by: | azaozz |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch |
Focuses: | Cc: |
Description
Follow-up from #48154.
From https://www.npmjs.com/package/install-changed:
This package is a quick and easy way of figuring out whether or not package.json has been modified. It executes
npm install
if the file has been modified, otherwise it does nothing.
This would be a convenience/nice-to-have to prevent building with outdated packages, then wandering why things don't work. Would also prevent erroneous changes in built files that are committed like in wp-includes/blocks
or wp-includes/assets
.
Attachments (1)
Change History (9)
#2
@
5 years ago
- Keywords has-patch needs-testing added
In 49594.diff: Add install-changed and run it when starting Grunt.
#4
follow-up:
↓ 5
@
5 years ago
- Keywords needs-testing removed
This worked for me when changing the version of @babel/polyfill.
Note that package.js was not marked as modified when the WordPress version was updated. The plugin only appears to check if package versions change, not general file changes.
Ready for commit?
#5
in reply to:
↑ 4
@
5 years ago
Replying to bookdude13:
Ready for commit?
Yes, think so. Thanks for testing.
The plugin only appears to check if package versions change, not general file changes.
Yep, it is pretty simple. Stores a hash from package.json and compares it when run. This makes it very good not only after the packages have been updated but also when the working copy was "reverted" to an earlier revision. It will "revert" node_modules to the proper versions.
#6
@
5 years ago
- Owner set to azaozz
- Resolution set to fixed
- Status changed from new to closed
In 47497:
The long version of this is to always do
npm install
(programmatically, hard-coded) beforenpm run build
andnpm run dev
, but that would slow down every build.