feat(project): add preset

This commit is contained in:
2026-10-14 15:53:44 +03:00
parent 78804036ab
commit dba24a2c68
27 changed files with 934 additions and 530 deletions
+32
View File
@@ -0,0 +1,32 @@
import gulp from "gulp";
import type { Config } from "../../../core/config";
import { Platform } from "../../../core/type";
import { Android } from "../../../impl/android";
import { Runner } from "../../core/runner";
export class AndroidRunner extends Runner {
protected android: Android;
constructor(config: Config, debug: boolean) {
super(config, Platform.ANDROID, debug);
this.android = new Android();
}
prepare() {
return this.android.prepare();
}
call() {
const target = this.targetPath;
return this.log(
gulp
.src(`${target}/${this.config.meta.filename}_${this.config.meta.version}.apk`)
.pipe(this.android.apk())
.pipe(this.android.install())
.pipe(this.android.start())
.pipe(this.android.logcat()),
);
}
}
Runner.register(Platform.ANDROID, AndroidRunner);
+27
View File
@@ -0,0 +1,27 @@
import path from "path";
import { Config } from "../../../core/config";
import { Platform } from "../../../core/type";
import { FlashPlayer } from "../../../impl/flashplayer";
import { Runner } from "../../core/runner";
export class FlashRunner extends Runner {
public player: FlashPlayer;
constructor(config: Config, debug: boolean, player: typeof FlashPlayer = FlashPlayer) {
super(config, Platform.FLASH, debug);
this.player = new player(debug);
}
prepare() {
return this.player.prepare();
}
call() {
const target = this.targetPath;
const filename = path.resolve(target, this.config.meta.filename + ".swf");
const result = this.player.run(filename, { cwd: target, verbosity: 0 });
return this.log(result);
}
}
Runner.register(Platform.FLASH, FlashRunner);
+25
View File
@@ -0,0 +1,25 @@
import gulp from "gulp";
import webserver from "gulp-webserver";
import { Config } from "../../../core/config";
import { Platform } from "../../../core/type";
import { Runner } from "../../core/runner";
export class Html5Runner extends Runner {
constructor(config: Config, debug: boolean) {
super(config, Platform.HTML5, debug);
}
call() {
return gulp.src(this.targetPath).pipe(
webserver({
// TODO: config?
host: "0.0.0.0",
port: 3000,
open: true,
fallback: "index.html",
}),
);
}
}
Runner.register(Platform.HTML5, Html5Runner);
+30
View File
@@ -0,0 +1,30 @@
import gulp from "gulp";
import path from "path";
import { Config } from "../../../core/config";
import { Platform } from "../../../core/type";
import run from "../../../run";
import { Runner } from "../../core/runner";
export class LinuxRunner extends Runner {
constructor(config: Config, debug: boolean) {
super(config, Platform.LINUX, debug);
}
call() {
const target = this.targetPath;
const filename = path.resolve(target, this.config.meta.filename!);
const result = gulp.src(filename).pipe(run("./<%=file.basename%>", { cwd: target, verbosity: 0 }));
return this.log(result);
}
}
Runner.register(Platform.LINUX, LinuxRunner);
export class CPPRunner extends LinuxRunner {
constructor(config: Config, debug: boolean) {
super(config, debug);
this.platform = Platform.CPP;
}
}
Runner.register(Platform.CPP, CPPRunner);
+27
View File
@@ -0,0 +1,27 @@
import path from "path";
import { Config } from "../../../core/config";
import { Platform } from "../../../core/type";
import { Neko } from "../../../impl/neko";
import { Runner } from "../../core/runner";
export class NekoRunner extends Runner {
public neko: Neko;
constructor(config: Config, debug: boolean) {
super(config, Platform.NEKO, debug);
this.neko = new Neko();
}
prepare() {
return this.neko.prepare();
}
call() {
const target = this.targetPath;
const filename = path.resolve(target, this.config.meta.filename + ".n");
const result = this.neko.run(filename, { cwd: target, verbosity: 0 });
return this.log(result);
}
}
Runner.register(Platform.NEKO, NekoRunner);
+9
View File
@@ -0,0 +1,9 @@
import type { Config } from "../../../core/config";
import { RufflePlayer } from "../../../impl/ruffle";
import { FlashRunner } from "./flash";
export class RuffleRunner extends FlashRunner {
constructor(config: Config, debug: boolean) {
super(config, debug, RufflePlayer);
}
}
+21
View File
@@ -0,0 +1,21 @@
import gulp from "gulp";
import path from "path";
import { Config } from "../../../core/config";
import { Platform } from "../../../core/type";
import run from "../../../run";
import { Runner } from "../../core/runner";
export class WindowsRunner extends Runner {
constructor(config: Config, debug: boolean) {
super(config, Platform.WINDOWS, debug);
}
call() {
const target = this.targetPath;
const filename = path.resolve(target, this.config.meta.filename + ".exe");
const result = gulp.src(filename).pipe(run("<%=file.basename%>", { cwd: target, verbosity: 0 }));
return this.log(result);
}
}
Runner.register(Platform.WINDOWS, WindowsRunner);