Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"5.6.7f1 (e80cc3114ac1)",
"2017.4.40f1",
"2018",
"2018.4",
"2019.x",
"2020.*",
"2021.3.x",
Expand Down
75 changes: 39 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rage-against-the-pixel/unity-cli",
"version": "1.7.2",
"version": "1.8.0",
"description": "A command line utility for the Unity Game Engine.",
"author": "RageAgainstThePixel",
"license": "MIT",
Expand Down Expand Up @@ -56,16 +56,16 @@
"source-map-support": "^0.5.21",
"tar": "^7.5.2",
"update-notifier": "^7.3.1",
"yaml": "^2.8.1"
"yaml": "^2.8.2"
},
"devDependencies": {
"@types/jest": "^30.0.0",
"@types/node": "^24.10.1",
"@types/semver": "^7.7.1",
"@types/update-notifier": "^6.0.8",
"jest": "^30.2.0",
"ts-jest": "^29.4.5",
"ts-jest": "^29.4.6",
"ts-node": "^10.9.2",
"typescript": "^5.9.3"
}
}
}
4 changes: 0 additions & 4 deletions src/unity-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,6 @@ export class UnityVersion {

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

if (!candidates.length && minorToken === '0') {
candidates = UnityVersion.filterFinalReleases(releases, normalizedMajor, undefined, channels);
}

Logger.instance.debug(`Found ${candidates.length} candidate(s) for version pattern ${version}`);
candidates.forEach(release => {
Logger.instance.debug(` - ${release.version}`);
Expand Down
62 changes: 62 additions & 0 deletions tests/unity-version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,68 @@ describe('UnityVersion', () => {
expect(UnityVersion.compare(match, older)).toBeGreaterThan(0);
});

it('finds latest final release when only major is provided', () => {
const available = [
'2021.3.5f2',
'2021.3.0f1',
'2020.3.7f1',
'2021.2.9f1'
];

const version = new UnityVersion('2021');
const match = version.findMatch(available);

expect(match.version).toBe('2021.3.5f2');
});

it('finds latest minor when using wildcard', () => {
const available = [
'2021.2.9f1',
'2021.3.5f2',
'2021.3.4f1'
];

const version = new UnityVersion('2021.*');
const match = version.findMatch(available);

expect(match.version).toBe('2021.3.5f2');
});

it('prefers newer patch channels when allowed', () => {
const available = [
'2021.3.4f1',
'2021.3.5p2'
];

const version = new UnityVersion('2021.3');
const match = version.findMatch(available, ['f', 'p']);

expect(match.version).toBe('2021.3.5p2');
});

it('returns original when no channel candidates exist', () => {
const available = [
'2021.3.5f2'
];

const version = new UnityVersion('2021.3.x');
const match = version.findMatch(available, ['a']);

expect(match.version).toBe('2021.3.x');
});

it('keeps explicit minor requests when no matching releases are available', () => {
const available = [
'6000.3.0f1'
];

const version = new UnityVersion('6000.0.x');
const match = version.findMatch(available);

// When only other minors exist (e.g., 6000.3.*), do not fall back to them.
expect(match.version).toBe('6000.0.x');
});

it('evaluates caret compatibility with satisfies', () => {
const baseline = new UnityVersion('2021.3.5f1');
const compatible = new UnityVersion('2021.4.0f1');
Expand Down
Loading