Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

chore(version): the engine's version is the root package.json

esengine9d2446cd7d50
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index a6004007d..ca32a3e38 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -43,7 +43,7 @@ jobs:
- name: Build Doxygen API Docs
working-directory: docs
run: |
- export ESTELLA_VERSION=$(node -p "require('../desktop/package.json').version")
+ export ESTELLA_VERSION=$(node -p "require('../package.json').version")
doxygen Doxyfile
- name: Install Astro Dependencies
diff --git a/build-tools/release.js b/build-tools/release.js
index c2cc84859..abb47314d 100644
--- a/build-tools/release.js
+++ b/build-tools/release.js
@@ -2,13 +2,15 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-import { readFileSync, writeFileSync } from 'fs';
+import { existsSync, readFileSync, writeFileSync } from 'fs';
import { execSync } from 'child_process';
import chalk from 'chalk';
-// desktop/package.json is the single source of the desktop app version:
-// electron-builder reads it, and the git tag mirrors it.
-const PKG = 'desktop/package.json';
+// The root package.json is the engine's version; the git tag mirrors it. The
+// editor keeps its own copy because electron-builder reads that one, and it is a
+// submodule that may not be checked out — so it is mirrored, never required.
+const PKG = 'package.json';
+const EDITOR_PKG = 'desktop/package.json';
function run(cmd) {
console.log(chalk.gray(` $ ${cmd}`));
@@ -62,7 +64,14 @@ if (oldVersion === version) {
} else {
pkg.version = version;
writeFileSync(PKG, JSON.stringify(pkg, null, 2) + '\n');
- run(`git add ${PKG}`);
+ let staged = PKG;
+ if (existsSync(EDITOR_PKG)) {
+ const editor = JSON.parse(readFileSync(EDITOR_PKG, 'utf8'));
+ editor.version = version;
+ writeFileSync(EDITOR_PKG, JSON.stringify(editor, null, 2) + '\n');
+ staged += ` ${EDITOR_PKG}`;
+ }
+ run(`git add ${staged}`);
run(`git commit -m "chore: release v${version}"`);
}
diff --git a/build-tools/tasks/nativeTemplateEmit.js b/build-tools/tasks/nativeTemplateEmit.js
index ed285a57c..ffe26f363 100644
--- a/build-tools/tasks/nativeTemplateEmit.js
+++ b/build-tools/tasks/nativeTemplateEmit.js
@@ -34,12 +34,12 @@ const ABI_TRIPLE = {
};
/**
- * The version a template is stamped with — `desktop/package.json`, which is also
+ * The version a template is stamped with — the root `package.json`, which is also
* what `app.getVersion()` reports in the editor. The two must be the same number:
* matching them is how the editor refuses a template built for another release.
*/
export function readEngineVersion(root = config.paths.root) {
- return JSON.parse(readFileSync(path.join(root, 'desktop', 'package.json'), 'utf8')).version;
+ return JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8')).version;
}
/**
diff --git a/build-tools/tasks/sync.js b/build-tools/tasks/sync.js
index f12e24cec..e241e7591 100644
--- a/build-tools/tasks/sync.js
+++ b/build-tools/tasks/sync.js
@@ -10,9 +10,18 @@ import * as logger from '../utils/logger.js';
export async function syncToDesktop(options = {}) {
const { wasm = true, sdk = true } = options;
+ const rootDir = config.paths.root;
+
+ // The editor is an optional submodule. Creating desktop/public under an
+ // uninitialised one would leave build output where a checkout is supposed to
+ // go, so an absent editor is a skip, not a directory.
+ if (!existsSync(path.join(rootDir, 'desktop'))) {
+ logger.info('Sync: no editor checkout — skipping (engine output stays in build/)');
+ return { synced: 0, skipped: true };
+ }
+
logger.step('Syncing to desktop/public...');
- const rootDir = config.paths.root;
let synced = 0;
if (wasm) {
diff --git a/package.json b/package.json
index 2d9f02001..56b099a17 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,6 @@
{
"name": "esengine",
+ "version": "0.55.0",
"private": true,
"type": "module",
"description": "Estella - A fast 2D game engine powered by WebAssembly and ECS",
diff --git a/pipeline/bin/estella.mjs b/pipeline/bin/estella.mjs
index bf41365d9..1abf82e2a 100644
--- a/pipeline/bin/estella.mjs
+++ b/pipeline/bin/estella.mjs
@@ -334,7 +334,7 @@ const outDir = path.resolve(opts.out ?? path.join(opts.projectDir, `dist-${platf
// The editor's package.json is the version of the whole product, and the runtime
// templates are stored per version.
-const engineVersion = JSON.parse(readFileSync(path.join(REPO, 'desktop', 'package.json'), 'utf8')).version;
+const engineVersion = JSON.parse(readFileSync(path.join(REPO, 'package.json'), 'utf8')).version;
const nativePlatform = platform === 'android' || platform === 'ios';
const templateDir = nativePlatform
? (opts.template ? path.resolve(opts.template) : firstExisting([installedTemplateDir(engineVersion, platform)]) ?? null)
diff --git a/tools/check-release-metadata.mjs b/tools/check-release-metadata.mjs
index 7152b7fa5..a200a4ed9 100644
--- a/tools/check-release-metadata.mjs
+++ b/tools/check-release-metadata.mjs
@@ -4,7 +4,7 @@
* @file check-release-metadata.mjs — the files that name the shipped version
* have to name the one being shipped.
*
- * `desktop/package.json` is the version (release.js writes it and nothing else).
+ * The root `package.json` is the version (release.js writes it and nothing else).
* Two other files repeat it, and repeating is how they fall behind: SECURITY.md
* claimed 0.6.x/0.7.x were the supported series while 0.45.0 was shipping — a
* table nobody had reason to open for thirty-eight releases, telling anyone who
@@ -22,7 +22,7 @@ import { fileURLToPath } from 'node:url';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const read = (rel) => readFileSync(path.join(ROOT, rel), 'utf8');
-const version = JSON.parse(read('desktop/package.json')).version;
+const version = JSON.parse(read('package.json')).version;
const [major, minor] = version.split('.');
const series = `${major}.${minor}.x`;