mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-14 04:39:28 +00:00
Initial support for updating/downgrading cores.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Installable } from './installable';
|
||||
|
||||
export interface ArduinoComponent {
|
||||
readonly name: string;
|
||||
@@ -6,8 +7,8 @@ export interface ArduinoComponent {
|
||||
readonly description: string;
|
||||
readonly moreInfoLink?: string;
|
||||
|
||||
readonly availableVersions: string[];
|
||||
readonly availableVersions: Installable.Version[];
|
||||
readonly installable: boolean;
|
||||
|
||||
readonly installedVersion?: string;
|
||||
readonly installedVersion?: Installable.Version;
|
||||
}
|
||||
|
||||
@@ -170,6 +170,12 @@ 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,11 @@
|
||||
export interface Installable<T> {
|
||||
install(item: T): Promise<void>;
|
||||
}
|
||||
import { ArduinoComponent } from './arduino-component';
|
||||
|
||||
export interface Installable<T extends ArduinoComponent> {
|
||||
/**
|
||||
* If `options.version` is specified, that will be installed. Otherwise, `item.availableVersions[0]`.
|
||||
*/
|
||||
install(options: { item: T, version?: Installable.Version }): Promise<void>;
|
||||
}
|
||||
export namespace Installable {
|
||||
export type Version = string;
|
||||
}
|
||||
|
||||
@@ -5,14 +5,9 @@ import { ArduinoComponent } from './arduino-component';
|
||||
export const LibraryServicePath = '/services/library-service';
|
||||
export const LibraryService = Symbol('LibraryService');
|
||||
export interface LibraryService extends Installable<Library>, Searchable<Library> {
|
||||
install(library: Library): Promise<void>;
|
||||
install(options: { item: Library, version?: Installable.Version }): Promise<void>;
|
||||
}
|
||||
|
||||
export interface Library extends ArduinoComponent {
|
||||
readonly builtIn?: boolean;
|
||||
}
|
||||
|
||||
export namespace Library {
|
||||
// TODO: figure out whether we need a dedicated `version` type.
|
||||
export type Version = string;
|
||||
}
|
||||
Reference in New Issue
Block a user