1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

feat(info): add information about npm modules cache (#15750)

This commit is contained in:
Bartek Iwańczuk 2022-09-03 15:31:01 +02:00 committed by GitHub
parent 26f5d608ee
commit 223403e899
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 0 deletions

View file

@ -133,6 +133,7 @@ fn print_cache_info(
) -> Result<(), AnyError> { ) -> Result<(), AnyError> {
let deno_dir = &state.dir.root; let deno_dir = &state.dir.root;
let modules_cache = &state.file_fetcher.get_http_cache_location(); let modules_cache = &state.file_fetcher.get_http_cache_location();
let npm_cache = &state.npm_resolver.get_cache_location();
let typescript_cache = &state.dir.gen_cache.location; let typescript_cache = &state.dir.gen_cache.location;
let registry_cache = let registry_cache =
&state.dir.root.join(lsp::language_server::REGISTRIES_PATH); &state.dir.root.join(lsp::language_server::REGISTRIES_PATH);
@ -149,6 +150,7 @@ fn print_cache_info(
let mut output = json!({ let mut output = json!({
"denoDir": deno_dir, "denoDir": deno_dir,
"modulesCache": modules_cache, "modulesCache": modules_cache,
"npmCache": npm_cache,
"typescriptCache": typescript_cache, "typescriptCache": typescript_cache,
"registryCache": registry_cache, "registryCache": registry_cache,
"originStorage": origin_dir, "originStorage": origin_dir,
@ -170,6 +172,11 @@ fn print_cache_info(
colors::bold("Remote modules cache:"), colors::bold("Remote modules cache:"),
modules_cache.display() modules_cache.display()
); );
println!(
"{} {}",
colors::bold("npm modules cache:"),
npm_cache.display()
);
println!( println!(
"{} {}", "{} {}",
colors::bold("Emitted modules cache:"), colors::bold("Emitted modules cache:"),

View file

@ -162,6 +162,10 @@ impl ReadonlyNpmCache {
version: NpmVersion::parse(version).unwrap(), version: NpmVersion::parse(version).unwrap(),
}) })
} }
pub fn get_cache_location(&self) -> PathBuf {
self.root_dir.clone()
}
} }
/// Stores a single copy of npm packages in a cache. /// Stores a single copy of npm packages in a cache.

View file

@ -184,6 +184,10 @@ impl GlobalNpmPackageResolver {
registry_url: self.registry_url.clone(), registry_url: self.registry_url.clone(),
} }
} }
pub fn get_cache_location(&self) -> PathBuf {
self.cache.as_readonly().get_cache_location()
}
} }
impl NpmPackageResolver for GlobalNpmPackageResolver { impl NpmPackageResolver for GlobalNpmPackageResolver {

View file

@ -1,5 +1,6 @@
DENO_DIR location: [WILDCARD] DENO_DIR location: [WILDCARD]
Remote modules cache: [WILDCARD]deps Remote modules cache: [WILDCARD]deps
npm modules cache: [WILDCARD]npm
Emitted modules cache: [WILDCARD]gen Emitted modules cache: [WILDCARD]gen
Language server registries cache: [WILDCARD]registries Language server registries cache: [WILDCARD]registries
Origin storage: [WILDCARD]location_data Origin storage: [WILDCARD]location_data

View file

@ -1,5 +1,6 @@
DENO_DIR location: [WILDCARD] DENO_DIR location: [WILDCARD]
Remote modules cache: [WILDCARD]deps Remote modules cache: [WILDCARD]deps
npm modules cache: [WILDCARD]npm
Emitted modules cache: [WILDCARD]gen Emitted modules cache: [WILDCARD]gen
Language server registries cache: [WILDCARD]registries Language server registries cache: [WILDCARD]registries
Origin storage: [WILDCARD]location_data[WILDCARD] Origin storage: [WILDCARD]location_data[WILDCARD]

View file

@ -1,6 +1,7 @@
{ {
"denoDir": "[WILDCARD]", "denoDir": "[WILDCARD]",
"modulesCache": "[WILDCARD]deps", "modulesCache": "[WILDCARD]deps",
"npmCache": "[WILDCARD]npm",
"typescriptCache": "[WILDCARD]gen", "typescriptCache": "[WILDCARD]gen",
"registryCache": "[WILDCARD]registries", "registryCache": "[WILDCARD]registries",
"originStorage": "[WILDCARD]location_data" "originStorage": "[WILDCARD]location_data"

View file

@ -1,6 +1,7 @@
{ {
"denoDir": "[WILDCARD]", "denoDir": "[WILDCARD]",
"modulesCache": "[WILDCARD]deps", "modulesCache": "[WILDCARD]deps",
"npmCache": "[WILDCARD]npm",
"typescriptCache": "[WILDCARD]gen", "typescriptCache": "[WILDCARD]gen",
"registryCache": "[WILDCARD]registries", "registryCache": "[WILDCARD]registries",
"originStorage": "[WILDCARD]location_data[WILDCARD]", "originStorage": "[WILDCARD]location_data[WILDCARD]",