Skip to content

Commit 04d6ab9

Browse files
committed
Fix not detecting * as a valid constraint
1 parent 7f9665b commit 04d6ab9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ jobs:
118118
- run: pkgx -qq git --version
119119
- run: pkgx -s git --version
120120
- run: pkgx -j +git
121+
- run: pkgx git\* --version # test star constraints are valid
121122
- run: pkgx /usr/bin/awk --version
122123
- run: pkgx +yarnpkg.com yarn --version
123124
- run: pkgx +yarnpkg.com -- yarn --version

crates/lib/src/types.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::fmt;
88

99
//TODO regex is probs not most efficient (but do perf tests if you change it)
1010
lazy_static! {
11-
static ref PACKAGE_REGEX: Regex = Regex::new(r"^(.+?)([\^=~<>@].+)?$").unwrap();
11+
static ref PACKAGE_REGEX: Regex = Regex::new(r"^(.+?)(([\^=~<>@].+)|\*)?$").unwrap();
1212
}
1313

1414
#[derive(Debug, Clone, serde::Serialize)]
@@ -40,7 +40,12 @@ impl PackageReq {
4040

4141
let project = captures.get(1).unwrap().as_str().to_string();
4242
let str = if let Some(cap) = captures.get(2) {
43-
cap.as_str()
43+
let cap = cap.as_str();
44+
if cap.trim() == "" {
45+
"*"
46+
} else {
47+
cap
48+
}
4449
} else {
4550
"*"
4651
};

0 commit comments

Comments
 (0)