-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: CLI cache clean commands #2297
Comments
I'm for this. I think the most common use case would be to delete the dependencies of a script, so maybe that shouldn't need a flag:
I think the dep exclusion sounds good, maybe with the --exclude flag? |
@ry I'm actually slightly worried about the "delete the dependencies of a script" use case. Since we do not really have the concept of a "project" in fixed locations and thus cannot do reference count of certain dep usage for all Deno scripts, if a script happened to import from common modules like |
clear > clean. |
I think people would prefer an aggressive clear/clean. With the ability to exclude stuff, I think it would be overkill to automatically exclude dependencies for one script that are used by another script. While there are chances that it might invalidate the cache of something else and then replace it with something that makes the other script not work, just as much of the reverse is true as well and good reason why people shouldn't let their dependencies float. |
@kitsonk I think there is a potentially better use scenario for the exclusion feature: assume that user defines their own |
yes, I can see "clean everything but what X needs" is a more common use case to reduce size... One side thought in general about generating a dependency graph, how do we deal with dynamic |
I believe I have raised a similar question for |
Hi, we've made a simple script that deletes the https cache (from the directory that |
Thanks for this. Works! |
Related, it would be good to have some other cache interactively. In deno lambda I do a weird remapping of artifacts because the script path (on a users machine) is not the same as the script path on lambda. It'd be nice if that were a deno cache command... Perhaps it's too niche a use case? |
I think it's logical for this functionality to be an additional argument to An example: Caching: % deno cache --reload http://localhost:8080/local-modules/[email protected]/mod.ts
Download http://localhost:8080/local-modules/[email protected]/mod.ts
Download http://localhost:8080/local-modules/[email protected]/deps.ts
Download https://deno.land/x/[email protected]/mod.ts
Download https://deno.land/[email protected]/testing/asserts.ts
Download http://localhost:8080/local-modules/[email protected]/mod.ts
Download https://deno.land/[email protected]/fmt/colors.ts
Download https://deno.land/[email protected]/testing/diff.ts
Compile http://localhost:8080/local-modules/[email protected]/mod.ts Deleting: % deno cache --delete http://localhost:8080/local-modules/[email protected]/mod.ts
Delete http://localhost:8080/local-modules/[email protected]/mod.ts
Delete http://localhost:8080/local-modules/[email protected]/deps.ts
Delete https://deno.land/x/[email protected]/mod.ts
Delete https://deno.land/[email protected]/testing/asserts.ts
Delete http://localhost:8080/local-modules/[email protected]/mod.ts
Delete https://deno.land/[email protected]/fmt/colors.ts
Delete https://deno.land/[email protected]/testing/diff.ts |
Closing as duplicate of #3437, as it is more detailed. |
Thanks I made a variant in deno inspired by your script #!/usr/bin/env deno run --allow-run --allow-write
const p = Deno.run({
cmd: ['deno', 'info'],
stdout: 'piped',
env: {NO_COLOR: "1"} // No color in output
})
const status = await p.status()
if (! status.success) {
Deno.exit(status.code)
}
const t = new TextDecoder()
const output = t.decode(await p.output())
p.close()
const m = output.match(/Remote modules cache: "([^"]+)"/)
if (! m) {
console.log('Remote modules cache not found')
Deno.exit(1)
}
const folder = m[1]
if (confirm(`Are you sure you want to delete "${folder}"?`)) {
console.log('deleting...')
Deno.remove(folder, {recursive: true})
} |
(Migrated from gitter)
We could potentially introduce some basic cache cleaning commands for Deno.
Currently 2 super-duper simple and crude ideas:
deno clean https://github.com
deletes all cached files under that domain (this one is somewhat easy to implement)deno clean -d https://unpkg.com/[email protected]/
deno clean -p ./mydeps.ts
. Ifmydeps.ts
imports from allhttps://deno.land/std/
, running this command would delete every cached remote files except for deno_std onesThe text was updated successfully, but these errors were encountered: