You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got an expensive command that I only want to run when a specific dependency's version changes. While I can manually log the hash to a file, it would be preferable to be able to include this within the packagehash from package-changed.
My imagined usage would go something like this:
const{
isChanged,
monitoredPackagesChanged,// Record<packageName, isChanged for that package>
writeHash,}=awaitisPackageChanged({hashFilename: '.packagehash',monitorPackages: ['foo']});if(isChanged){// do some stuff always
...
if(monitoredPackagesChanged.foo){// do the expensive thing here}writeHash();}
I imagine that would necessitate turning the packagehash file into a JSON object
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion. Would you be up for submitting a PR for this?
I would though prefer to use the following:
--only, -O only include the dependencies of which the name matches given regex in calculated hash
So if you want to run some command when a single package changed.
npx package-changed --only some-dependency --run 'echo "some-dependency was updated"
If you still need to know when any package changed you have to run the package-changed command twice with different arguments and using a different hash file.
Tentatively, I'm up for submitting a PR for this, but it will depend on me finding the time.
Regarding the --only: would you be OK with me changing the packagehash file to a JSON object? I'd prefer not to create a bunch of separate files. Even when added to .gitignore in projects, that's just extra clutter.
People using package-changed without the new functionality would end up with a file like
I've got an expensive command that I only want to run when a specific dependency's version changes. While I can manually log the hash to a file, it would be preferable to be able to include this within the packagehash from package-changed.
My imagined usage would go something like this:
I imagine that would necessitate turning the packagehash file into a JSON object
The text was updated successfully, but these errors were encountered: