UNPKG

@bscotch/stitch-launcher

Version:

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

42 lines 1.74 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() { // 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(); const installedRuntimes = await listInstalledRuntimes(); 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