Skip to content

Commit 378fe60

Browse files
use semver to compare compat
1 parent 7aeeeb0 commit 378fe60

4 files changed

Lines changed: 14 additions & 48 deletions

File tree

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"howler": "^2.2.3",
3838
"html-to-text": "^9.0.5",
3939
"imgToAscii": "github:obfuscatedgenerated/imgToAscii",
40+
"semver": "^7.7.3",
4041
"sixel": "^0.16.0",
4142
"sweetalert2": "^11.4.8",
4243
"xterm-link-provider": "^1.3.1"

src/kernel.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import type {LineParseResultCommand} from "./programs/core/ash/parser";
1212

1313
import {NEWLINE, type WrappedTerminal} from "./term_ctl";
1414

15+
import semver_compare from "semver/functions/compare"
16+
17+
const CURRENT_API_COMPAT = "2.0.0";
18+
1519
export interface SpawnResult {
1620
process: ProcessContext;
1721
completion: Promise<number>;
@@ -85,7 +89,7 @@ export class Kernel {
8589
compat = program.compat;
8690
}
8791

88-
if (compat !== "2.0.0") {
92+
if (semver_compare(compat, CURRENT_API_COMPAT) > 0) {
8993
throw new Error(`Program ${program.name} is not compatible with OllieOS 2. (Add compat: "2.0.0" to the program object to mark it as ported.)`);
9094
}
9195

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3+
"allowSyntheticDefaultImports": true,
34
"noImplicitAny": false,
45
"noEmitOnError": true,
56
"removeComments": false,

0 commit comments

Comments
 (0)