Skip to content

Commit f36f87f

Browse files
unity-cli@v1.8.0 (#61)
- fix bug with calculating unity 6.0 and 6.3 lts fallback versions - added additional unit tests
1 parent 02687a3 commit f36f87f

File tree

5 files changed

+105
-45
lines changed

5 files changed

+105
-45
lines changed

.github/workflows/build-options.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"5.6.7f1 (e80cc3114ac1)",
1010
"2017.4.40f1",
1111
"2018",
12-
"2018.4",
1312
"2019.x",
1413
"2020.*",
1514
"2021.3.x",

package-lock.json

Lines changed: 39 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rage-against-the-pixel/unity-cli",
3-
"version": "1.7.2",
3+
"version": "1.8.0",
44
"description": "A command line utility for the Unity Game Engine.",
55
"author": "RageAgainstThePixel",
66
"license": "MIT",
@@ -56,16 +56,16 @@
5656
"source-map-support": "^0.5.21",
5757
"tar": "^7.5.2",
5858
"update-notifier": "^7.3.1",
59-
"yaml": "^2.8.1"
59+
"yaml": "^2.8.2"
6060
},
6161
"devDependencies": {
6262
"@types/jest": "^30.0.0",
6363
"@types/node": "^24.10.1",
6464
"@types/semver": "^7.7.1",
6565
"@types/update-notifier": "^6.0.8",
6666
"jest": "^30.2.0",
67-
"ts-jest": "^29.4.5",
67+
"ts-jest": "^29.4.6",
6868
"ts-node": "^10.9.2",
6969
"typescript": "^5.9.3"
7070
}
71-
}
71+
}

src/unity-version.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,6 @@ export class UnityVersion {
271271

272272
let candidates = UnityVersion.filterFinalReleases(releases, normalizedMajor, requestedMinor, channels);
273273

274-
if (!candidates.length && minorToken === '0') {
275-
candidates = UnityVersion.filterFinalReleases(releases, normalizedMajor, undefined, channels);
276-
}
277-
278274
Logger.instance.debug(`Found ${candidates.length} candidate(s) for version pattern ${version}`);
279275
candidates.forEach(release => {
280276
Logger.instance.debug(` - ${release.version}`);

tests/unity-version.test.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,68 @@ describe('UnityVersion', () => {
6262
expect(UnityVersion.compare(match, older)).toBeGreaterThan(0);
6363
});
6464

65+
it('finds latest final release when only major is provided', () => {
66+
const available = [
67+
'2021.3.5f2',
68+
'2021.3.0f1',
69+
'2020.3.7f1',
70+
'2021.2.9f1'
71+
];
72+
73+
const version = new UnityVersion('2021');
74+
const match = version.findMatch(available);
75+
76+
expect(match.version).toBe('2021.3.5f2');
77+
});
78+
79+
it('finds latest minor when using wildcard', () => {
80+
const available = [
81+
'2021.2.9f1',
82+
'2021.3.5f2',
83+
'2021.3.4f1'
84+
];
85+
86+
const version = new UnityVersion('2021.*');
87+
const match = version.findMatch(available);
88+
89+
expect(match.version).toBe('2021.3.5f2');
90+
});
91+
92+
it('prefers newer patch channels when allowed', () => {
93+
const available = [
94+
'2021.3.4f1',
95+
'2021.3.5p2'
96+
];
97+
98+
const version = new UnityVersion('2021.3');
99+
const match = version.findMatch(available, ['f', 'p']);
100+
101+
expect(match.version).toBe('2021.3.5p2');
102+
});
103+
104+
it('returns original when no channel candidates exist', () => {
105+
const available = [
106+
'2021.3.5f2'
107+
];
108+
109+
const version = new UnityVersion('2021.3.x');
110+
const match = version.findMatch(available, ['a']);
111+
112+
expect(match.version).toBe('2021.3.x');
113+
});
114+
115+
it('keeps explicit minor requests when no matching releases are available', () => {
116+
const available = [
117+
'6000.3.0f1'
118+
];
119+
120+
const version = new UnityVersion('6000.0.x');
121+
const match = version.findMatch(available);
122+
123+
// When only other minors exist (e.g., 6000.3.*), do not fall back to them.
124+
expect(match.version).toBe('6000.0.x');
125+
});
126+
65127
it('evaluates caret compatibility with satisfies', () => {
66128
const baseline = new UnityVersion('2021.3.5f1');
67129
const compatible = new UnityVersion('2021.4.0f1');

0 commit comments

Comments
 (0)