UNPKG

@bscotch/stitch-launcher

Version:

Manage GameMaker IDE and runtime installations for fast switching between versions.

46 lines 1.84 kB
import { GameMakerComponent } from './GameMakerComponent.js'; import { executeGameMakerBuildCommand, executeGameMakerRuntimeInstallCommand, } from './GameMakerRuntime.command.js'; import { listInstalledRuntimes, sortByDateField, } from './utility.js'; export * from './GameMakerRuntime.command.js'; export class GameMakerRuntime extends GameMakerComponent { constructor(info) { super(info); } async runProject(options) { return await executeGameMakerBuildCommand(this, options); } async buildProject(options) { return await executeGameMakerBuildCommand(this, { ...options, compile: true, }); } async installRuntime(newVersion) { return await executeGameMakerRuntimeInstallCommand(this, newVersion); } static async listInstalled(options) { // Get the runtime versions that SHOULD be installable // for cross-checking and for identifying which channel // a runtime is from. const releases = await GameMakerComponent.listReleases({ logger: options?.logger, }); const installedRuntimes = await listInstalledRuntimes({ logger: options?.logger, }); const runtimes = []; for (const runtime of installedRuntimes) { const version = releases.find((v) => v.runtime.version === runtime.version); runtimes.push(new GameMakerRuntime({ ...runtime, channel: version?.channel, publishedAt: version?.runtime.publishedAt ? new Date(version.publishedAt) : undefined, feedUrl: version?.runtime.feedUrl, })); } return sortByDateField(runtimes, 'publishedAt'); } } //# sourceMappingURL=GameMakerRuntime.js.map