mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-11 21:36:33 +00:00
Fixed the version ordering for libs.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
6448b447b3
commit
f359843635
@ -130,7 +130,7 @@ export namespace Port {
|
||||
}
|
||||
if (isOSX) {
|
||||
// Example: `/dev/cu.usbmodem14401`
|
||||
if (/(tty|cu)\..*/.test(address.substring('/dev/'.length))) {
|
||||
if (/(tty|cu)\..*/.test(address.substring('/dev/'.length))) {
|
||||
return [
|
||||
'/dev/cu.MALS',
|
||||
'/dev/cu.SOC',
|
||||
@ -170,12 +170,6 @@ export interface BoardPackage extends ArduinoComponent {
|
||||
id: string;
|
||||
boards: Board[];
|
||||
}
|
||||
export namespace BoardPackage {
|
||||
/**
|
||||
* Most recent version comes first, then the previous versions. (`1.8.1`, `1.6.3`, `1.6.2`, `1.6.1` and so on.)
|
||||
*/
|
||||
export const VERSION_COMPARATOR = (left: string, right: string) => naturalCompare(right, left);
|
||||
}
|
||||
|
||||
export interface Board {
|
||||
name: string
|
||||
|
@ -1,3 +1,4 @@
|
||||
const naturalCompare: (left: string, right: string) => number = require('string-natural-compare').caseInsensitive;
|
||||
import { ArduinoComponent } from './arduino-component';
|
||||
|
||||
export interface Installable<T extends ArduinoComponent> {
|
||||
@ -8,4 +9,10 @@ export interface Installable<T extends ArduinoComponent> {
|
||||
}
|
||||
export namespace Installable {
|
||||
export type Version = string;
|
||||
export namespace Version {
|
||||
/**
|
||||
* Most recent version comes first, then the previous versions. (`1.8.1`, `1.6.3`, `1.6.2`, `1.6.1` and so on.)
|
||||
*/
|
||||
export const COMPARATOR = (left: Version, right: Version) => naturalCompare(right, left);
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ export class BoardsServiceImpl implements BoardsService {
|
||||
const pkg = packages.get(id);
|
||||
if (pkg) {
|
||||
pkg.availableVersions.push(platform.getLatest());
|
||||
pkg.availableVersions.sort(BoardPackage.VERSION_COMPARATOR);
|
||||
pkg.availableVersions.sort(Installable.Version.COMPARATOR);
|
||||
} else {
|
||||
packages.set(id, toPackage(platform));
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ export class LibraryServiceImpl implements LibraryService {
|
||||
.slice(0, 50)
|
||||
.map(item => {
|
||||
// TODO: This seems to contain only the latest item instead of all of the items.
|
||||
const availableVersions = item.getReleasesMap().getEntryList().map(([key, _]) => key);
|
||||
const availableVersions = item.getReleasesMap().getEntryList().map(([key, _]) => key).sort(Installable.Version.COMPARATOR);
|
||||
let installedVersion: string | undefined;
|
||||
const installed = installedLibsIdx.get(item.getName());
|
||||
if (installed) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user