mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
feat(info): add information about npm modules cache (#15750)
This commit is contained in:
parent
26f5d608ee
commit
223403e899
7 changed files with 19 additions and 0 deletions
|
@ -133,6 +133,7 @@ fn print_cache_info(
|
|||
) -> Result<(), AnyError> {
|
||||
let deno_dir = &state.dir.root;
|
||||
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 registry_cache =
|
||||
&state.dir.root.join(lsp::language_server::REGISTRIES_PATH);
|
||||
|
@ -149,6 +150,7 @@ fn print_cache_info(
|
|||
let mut output = json!({
|
||||
"denoDir": deno_dir,
|
||||
"modulesCache": modules_cache,
|
||||
"npmCache": npm_cache,
|
||||
"typescriptCache": typescript_cache,
|
||||
"registryCache": registry_cache,
|
||||
"originStorage": origin_dir,
|
||||
|
@ -170,6 +172,11 @@ fn print_cache_info(
|
|||
colors::bold("Remote modules cache:"),
|
||||
modules_cache.display()
|
||||
);
|
||||
println!(
|
||||
"{} {}",
|
||||
colors::bold("npm modules cache:"),
|
||||
npm_cache.display()
|
||||
);
|
||||
println!(
|
||||
"{} {}",
|
||||
colors::bold("Emitted modules cache:"),
|
||||
|
|
|
@ -162,6 +162,10 @@ impl ReadonlyNpmCache {
|
|||
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.
|
||||
|
|
|
@ -184,6 +184,10 @@ impl GlobalNpmPackageResolver {
|
|||
registry_url: self.registry_url.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_cache_location(&self) -> PathBuf {
|
||||
self.cache.as_readonly().get_cache_location()
|
||||
}
|
||||
}
|
||||
|
||||
impl NpmPackageResolver for GlobalNpmPackageResolver {
|
||||
|
|
1
cli/tests/testdata/041_info_flag.out
vendored
1
cli/tests/testdata/041_info_flag.out
vendored
|
@ -1,5 +1,6 @@
|
|||
DENO_DIR location: [WILDCARD]
|
||||
Remote modules cache: [WILDCARD]deps
|
||||
npm modules cache: [WILDCARD]npm
|
||||
Emitted modules cache: [WILDCARD]gen
|
||||
Language server registries cache: [WILDCARD]registries
|
||||
Origin storage: [WILDCARD]location_data
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
DENO_DIR location: [WILDCARD]
|
||||
Remote modules cache: [WILDCARD]deps
|
||||
npm modules cache: [WILDCARD]npm
|
||||
Emitted modules cache: [WILDCARD]gen
|
||||
Language server registries cache: [WILDCARD]registries
|
||||
Origin storage: [WILDCARD]location_data[WILDCARD]
|
||||
|
|
1
cli/tests/testdata/info_json.out
vendored
1
cli/tests/testdata/info_json.out
vendored
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"denoDir": "[WILDCARD]",
|
||||
"modulesCache": "[WILDCARD]deps",
|
||||
"npmCache": "[WILDCARD]npm",
|
||||
"typescriptCache": "[WILDCARD]gen",
|
||||
"registryCache": "[WILDCARD]registries",
|
||||
"originStorage": "[WILDCARD]location_data"
|
||||
|
|
1
cli/tests/testdata/info_json_location.out
vendored
1
cli/tests/testdata/info_json_location.out
vendored
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"denoDir": "[WILDCARD]",
|
||||
"modulesCache": "[WILDCARD]deps",
|
||||
"npmCache": "[WILDCARD]npm",
|
||||
"typescriptCache": "[WILDCARD]gen",
|
||||
"registryCache": "[WILDCARD]registries",
|
||||
"originStorage": "[WILDCARD]location_data[WILDCARD]",
|
||||
|
|
Loading…
Reference in a new issue