krml
krml8mo ago

tidy up `deno.lock`

Hey, is there something like go mod tidy (https://golangbyexample.com/go-mod-tidy/) in Deno? The background is that my deno.lock got a couple of entries that I no longer use and so I was wondering what the "most convinient" way it would be to get rid of those entries. Thanks in advance!
admin
Welcome To Golang By Example
What does go mod tidy do in Go (Golang) - Welcome To Golang By Example
Overview This command will basically match the go.mod file with the dependencies required in the source files. Download all the dependencies that are required in your source files and update go.mod file...
4 Replies
Deno AI Helper
Deno AI Helper8mo ago
According to the documentation, Deno does not provide a built-in command similar to go mod tidy to automatically clean up unused entries in the deno.lock file. The lock file in Deno is auto-generated and updated when you run your Deno application with the --lock and --lock-write flags. If you want to clean up unused entries, you might need to manually remove the unused dependencies from your code and then regenerate the lock file. Here's how you can do it: 1. Remove the unused dependencies from your code. 2. Delete the existing deno.lock file. 3. Run your Deno application with the --lock=deno.lock --lock-write flags to generate a new lock file. This will create a new deno.lock file that only includes the dependencies that are currently being used in your code. Please note that this information is not explicitly stated in the documentation, so proceed with caution and make sure to backup your deno.lock file before deleting it. 🦕
marvinh.
marvinh.8mo ago
I'm afraid there isn't such a command in deno. Most folks tend to regenerate the lockfile by deleting it
krml
krml8mo ago
Sounds like a plan, feels like a good enough solution since the result is what I want anyway. Thanks!
bebraw
bebraw8mo ago
i was wondering the same as the lockfiles keep growing. i hope they add a specific cleanup command one day