Replies: 1 comment
-
After I started retrieving the package metadata from the npm API to replace it with the latest version in the lock file in the hook, I realized a mistake in my previous deletion script. module.exports = {
hooks: {
afterAllResolved: async lockfile => {
Object.keys(lockfile.packages)
.filter(pkg => pkg.startsWith('my-package'))
.forEach(pkg => {
delete lockfile.packages[pkg];
});
Object.keys(lockfile.importers['my-test-package'].dependencies)
.filter(pkg => pkg === 'my-package')
.forEach(pkg => {
delete lockfile.importers['my-test-package'].dependencies[pkg];
});
return lockfile;
}
}
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a project, where I use preversions for testing, e.g.
1.0.1-20242108.0
with a specific dist tag, e.g.canary
.Now in my tests I always want to pick the latest
canary
tag.When running
pnpm install
, it does not update the lock file.Ideally, I would like to just skip adding this to the lock file at all. I tried to use hooks for this, but when I remove something from the lock file, installation fails because there is an error in the lock file.
I then tried
pnpm install package@canary
manually, but this updated thepackage.json
with the cryptic version1.0.1-20242108.0
instead ofcanary
. I tried adding--save-prod=false --save-dev=false
but it is still added to thepackage.json
.Does anyone have an idea on how I could achieve this?
Beta Was this translation helpful? Give feedback.
All reactions