refactor(ProjectBuilder): clean up output file collection code (#1099)

* refactor(ProjectBuilder): less repetitive fileSorter

This reverts the fileSorter to the state from before #937, but using our
own simple re-implementation of `compare-func`.

* fix(ProjectBuilder): apply sort RegExp to basename only

* refactor(ProjectBuilder): use fast-glob instead of hand-rolled equivalent

* refactor(ProjectBuilder): factor out common isPathArchSpecific

* refactor(ProjectBuilder): use includes instead of indexOf

* refactor(ProjectBuilder): move sorting into findOutputFilesHelper

* refactor(ProjectBuilder): simplify findOutputFiles signature
This commit is contained in:
Raphael von der Grün
2020-11-21 10:44:56 +01:00
committed by GitHub
parent bb7d733cde
commit b245337501
3 changed files with 43 additions and 64 deletions
+2 -2
View File
@@ -289,7 +289,7 @@ describe('ProjectBuilder', () => {
});
});
describe('fileSorter', () => {
describe('outputFileComparator', () => {
it('should sort APKs from most recent to oldest, deprioritising unsigned arch-specific builds', () => {
const APKs = {
'app-debug.apk': new Date('2018-04-20'),
@@ -309,7 +309,7 @@ describe('ProjectBuilder', () => {
});
const apkArray = Object.keys(APKs);
const sortedApks = apkArray.sort(ProjectBuilder.__get__('fileSorter'));
const sortedApks = apkArray.sort(ProjectBuilder.__get__('outputFileComparator'));
expect(sortedApks).toEqual(expectedResult);
});