-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use normalized version constraints (#38)
- Loading branch information
Showing
20 changed files
with
169 additions
and
153 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,10 +243,7 @@ impl LockfileContent { | |
let mut specifiers = | ||
HashMap::with_capacity(deserialized_specifiers.len()); | ||
for (key, value) in deserialized_specifiers { | ||
let dep = JsrDepPackageReq::from_str(&key).map_err(|_err| { | ||
// todo(dsherret): surface internal error here | ||
DeserializationError::InvalidPackageSpecifier(key.to_string()) | ||
})?; | ||
let dep = JsrDepPackageReq::from_str(&key)?; | ||
specifiers.insert(dep, value); | ||
} | ||
|
||
|
@@ -458,14 +455,14 @@ impl Lockfile { | |
if opts.content.trim().is_empty() { | ||
return Err(Box::new(LockfileError { | ||
file_path: opts.file_path.display().to_string(), | ||
reason: LockfileErrorReason::Empty, | ||
source: LockfileErrorReason::Empty, | ||
})); | ||
} | ||
|
||
let content = | ||
load_content(opts.content).map_err(|reason| LockfileError { | ||
file_path: opts.file_path.display().to_string(), | ||
reason, | ||
source: reason, | ||
})?; | ||
Ok(Lockfile { | ||
overwrite: opts.overwrite, | ||
|
@@ -850,18 +847,18 @@ mod tests { | |
#[test] | ||
fn future_version_unsupported() { | ||
let file_path = PathBuf::from("lockfile.json"); | ||
assert_eq!( | ||
Lockfile::new( | ||
NewLockfileOptions { | ||
file_path, | ||
content: "{ \"version\": \"2000\" }", | ||
overwrite: false, | ||
} | ||
) | ||
.err() | ||
.unwrap().to_string(), | ||
"Unsupported lockfile version '2000'. Try upgrading Deno or recreating the lockfile at 'lockfile.json'.".to_string() | ||
); | ||
let err = Lockfile::new(NewLockfileOptions { | ||
file_path, | ||
content: "{ \"version\": \"2000\" }", | ||
overwrite: false, | ||
}) | ||
.unwrap_err(); | ||
match err.source { | ||
LockfileErrorReason::UnsupportedVersion { version } => { | ||
assert_eq!(version, "2000") | ||
} | ||
_ => unreachable!(), | ||
} | ||
} | ||
|
||
#[test] | ||
|
@@ -1154,8 +1151,8 @@ mod tests { | |
r#"{ | ||
"version": "4", | ||
"specifiers": { | ||
"jsr:@foo/bar@^2": "jsr:@foo/[email protected]", | ||
"jsr:path": "jsr:@std/[email protected]" | ||
"jsr:@foo/bar@2": "jsr:@foo/[email protected]", | ||
"jsr:path@*": "jsr:@std/[email protected]" | ||
} | ||
} | ||
"#, | ||
|
@@ -1283,9 +1280,6 @@ mod tests { | |
}) | ||
.err() | ||
.unwrap(); | ||
assert_eq!( | ||
err.to_string(), | ||
"Unable to read lockfile. Lockfile was empty at 'lockfile.json'." | ||
); | ||
assert!(matches!(err.source, LockfileErrorReason::Empty)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -944,7 +944,7 @@ | |
{ | ||
"version": "4", | ||
"specifiers": { | ||
"npm:@spotify/web-api-ts-sdk": "1.2.0", | ||
"npm:@spotify/web-api-ts-sdk@*": "1.2.0", | ||
"npm:[email protected]": "[email protected]", | ||
"npm:[email protected]": "[email protected]", | ||
"npm:[email protected]": "8.4.31" | ||
|
@@ -1414,7 +1414,7 @@ | |
}, | ||
"workspace": { | ||
"dependencies": [ | ||
"npm:@spotify/web-api-ts-sdk" | ||
"npm:@spotify/web-api-ts-sdk@*" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,11 +206,11 @@ | |
{ | ||
"version": "4", | ||
"specifiers": { | ||
"jsr:@scope/package_a": "0.0.1", | ||
"jsr:@scope/package_b": "0.0.1", | ||
"jsr:@scope/package_c": "0.0.1", | ||
"jsr:@scope/package_orphan": "0.0.1", | ||
"npm:ts-morph": "21.0.1" | ||
"jsr:@scope/package_a@*": "0.0.1", | ||
"jsr:@scope/package_b@*": "0.0.1", | ||
"jsr:@scope/package_c@*": "0.0.1", | ||
"jsr:@scope/package_orphan@*": "0.0.1", | ||
"npm:ts-morph@*": "21.0.1" | ||
}, | ||
"jsr": { | ||
"@scope/[email protected]": { | ||
|
@@ -376,11 +376,11 @@ | |
}, | ||
"workspace": { | ||
"dependencies": [ | ||
"jsr:@scope/package_a" | ||
"jsr:@scope/package_a@*" | ||
], | ||
"packageJson": { | ||
"dependencies": [ | ||
"npm:ts-morph" | ||
"npm:ts-morph@*" | ||
] | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,11 +190,11 @@ | |
{ | ||
"version": "4", | ||
"specifiers": { | ||
"jsr:@scope/package_a@^0.0": "0.0.1", | ||
"jsr:@scope/package_b": "0.0.1", | ||
"jsr:@scope/package_c": "0.0.1", | ||
"jsr:@scope/package_orphan": "0.0.1", | ||
"npm:ts-morph": "21.0.1" | ||
"jsr:@scope/[email protected]": "0.0.1", | ||
"jsr:@scope/package_b@*": "0.0.1", | ||
"jsr:@scope/package_c@*": "0.0.1", | ||
"jsr:@scope/package_orphan@*": "0.0.1", | ||
"npm:ts-morph@*": "21.0.1" | ||
}, | ||
"jsr": { | ||
"@scope/[email protected]": { | ||
|
@@ -360,11 +360,11 @@ | |
}, | ||
"workspace": { | ||
"dependencies": [ | ||
"jsr:@scope/package_a" | ||
"jsr:@scope/package_a@*" | ||
], | ||
"packageJson": { | ||
"dependencies": [ | ||
"npm:ts-morph" | ||
"npm:ts-morph@*" | ||
] | ||
} | ||
} | ||
|
Oops, something went wrong.