0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-08 07:16:56 -05:00

chore: update ensure_registry_files_local to handle scoped packages (#27801)

This commit is contained in:
Yoshiya Hinosawa 2025-01-24 21:47:15 +09:00 committed by GitHub
parent 0697578d3e
commit 3d8834f957
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 7 deletions

1
Cargo.lock generated
View file

@ -880,6 +880,7 @@ dependencies = [
"tokio",
"url",
"uuid",
"walkdir",
"zeromq",
]

View file

@ -219,6 +219,7 @@ tower-service = "0.3.2"
twox-hash = "=1.6.3"
url = { version = "2.5", features = ["serde", "expose_internals"] }
uuid = { version = "1.3.0", features = ["v4"] }
walkdir = "=2.3.2"
webpki-root-certs = "0.26.5"
webpki-roots = "0.26"
which = "6"

View file

@ -170,7 +170,7 @@ tracing = { version = "0.1", features = ["log", "default"] }
twox-hash.workspace = true
typed-arena = "=2.0.2"
uuid = { workspace = true, features = ["serde"] }
walkdir = "=2.3.2"
walkdir.workspace = true
which.workspace = true
zeromq.workspace = true
zip = { version = "2.1.6", default-features = false, features = ["deflate-flate2"] }

View file

@ -64,6 +64,7 @@ tokio.workspace = true
tower-lsp.workspace = true
url.workspace = true
uuid = { workspace = true, features = ["serde"] }
walkdir.workspace = true
zeromq.workspace = true
[target.'cfg(unix)'.dev-dependencies]

View file

@ -395,22 +395,24 @@ fn node_modules_dir_cache() {
fn ensure_registry_files_local() {
// ensures the registry files all point at local tarballs
let registry_dir_path = util::tests_path().join("registry").join("npm");
for entry in std::fs::read_dir(&registry_dir_path).unwrap() {
for entry in walkdir::WalkDir::new(&registry_dir_path).max_depth(2) {
let entry = entry.unwrap();
if entry.metadata().unwrap().is_dir() {
let registry_json_path = registry_dir_path
.join(entry.file_name())
.join("registry.json");
let registry_json_path = entry.path().join("registry.json");
if registry_json_path.exists() {
let file_text = std::fs::read_to_string(&registry_json_path).unwrap();
if file_text.contains(&format!(
"https://registry.npmjs.org/{}/-/",
entry.file_name().to_string_lossy()
entry
.path()
.strip_prefix(&registry_dir_path)
.unwrap()
.to_string_lossy()
)) {
panic!(
"file {} contained a reference to the npm registry",
registry_json_path
registry_json_path.display()
);
}
}