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.

build: the supported-versions table said 0.7.x while 0.45.0 shipped

esengine7c1e0443b0d8
diff --git a/SECURITY.md b/SECURITY.md
index 5e244db8d..6ebe9eba3 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -2,11 +2,16 @@
## Supported Versions
+Before 1.0, fixes land on the current minor series only. There are no backports:
+upgrading to the latest release is the supported path to a fix.
+
| Version | Supported |
|---------|-----------|
-| 0.7.x | Yes |
-| 0.6.x | Yes |
-| < 0.6 | No |
+| 0.45.x | Yes |
+| < 0.45 | No |
+
+`tools/check-release-metadata.mjs` fails the build if this table stops matching
+the version being shipped, so it cannot quietly fall behind again.
## Reporting a Vulnerability
diff --git a/build-tools/release.js b/build-tools/release.js
index 7dea3353f..c2cc84859 100644
--- a/build-tools/release.js
+++ b/build-tools/release.js
@@ -42,10 +42,16 @@ if (status) {
console.log(chalk.bold.white(`\n═══ Release v${version} ═══\n`));
-// Soft reminder: the release should already be documented before we tag it.
+// The notes and the supported-versions table have to name this release. Checked
+// again after the bump below by check-release-metadata (which `verify` runs), so
+// this is the early, specific failure rather than the one at push time.
const changelog = readFileSync('CHANGELOG.md', 'utf8');
if (!changelog.includes(`## [${version}]`)) {
- console.log(chalk.yellow('⚠'), `CHANGELOG.md has no "## [${version}]" entry — add release notes before publishing.`);
+ die(`CHANGELOG.md has no "## [${version}]" entry — rename [Unreleased] before releasing.`);
+}
+if (!new RegExp(`^\\|\\s*${version.split('.').slice(0, 2).join('\\.')}\\.x\\s*\\|\\s*Yes\\s*\\|`, 'im')
+ .test(readFileSync('SECURITY.md', 'utf8'))) {
+ die(`SECURITY.md does not list ${version.split('.').slice(0, 2).join('.')}.x as supported.`);
}
console.log(chalk.cyan('▸'), `Updating ${PKG} to ${version}`);
diff --git a/package.json b/package.json
index 5e385d407..aeb7748f8 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
"emsdk:setup": "node build-tools/toolchain/setup-emsdk.js",
"asset-meta": "node tools/asset-meta.js",
"migrate-asset-refs": "node tools/migrate-asset-refs.js",
- "verify": "pnpm --filter ./sdk exec tsc --noEmit && node tools/api-surface.mjs --check && node tools/check-cycles.mjs && node tools/check-layers.mjs && node tools/check-project-settings.mjs && node tools/check-workflows.mjs && node tools/check-tool-calls.mjs && node tools/check-inspector-door.mjs && node tools/check-dirty-source.mjs && node tools/check-path-sandbox.mjs && node tools/check-comment-style.mjs && node tools/component-reference.mjs --check",
+ "verify": "pnpm --filter ./sdk exec tsc --noEmit && node tools/api-surface.mjs --check && node tools/check-cycles.mjs && node tools/check-layers.mjs && node tools/check-project-settings.mjs && node tools/check-workflows.mjs && node tools/check-tool-calls.mjs && node tools/check-inspector-door.mjs && node tools/check-dirty-source.mjs && node tools/check-path-sandbox.mjs && node tools/check-comment-style.mjs && node tools/check-release-metadata.mjs && node tools/component-reference.mjs --check",
"perf": "node tools/perf-guard.mjs --check",
"prepare": "git config core.hooksPath .githooks || true"
},
diff --git a/tools/check-release-metadata.mjs b/tools/check-release-metadata.mjs
new file mode 100644
index 000000000..6d8855046
--- /dev/null
+++ b/tools/check-release-metadata.mjs
@@ -0,0 +1,69 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @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).
+ * 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
+ * did that their version was unsupported.
+ *
+ * Both are checked here rather than at release time, so the commit that bumps the
+ * version is the commit that fails, not a step someone runs later and reads past.
+ *
+ * node tools/check-release-metadata.mjs
+ */
+import { readFileSync } from 'node:fs';
+import path from 'node:path';
+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 [major, minor] = version.split('.');
+const series = `${major}.${minor}.x`;
+
+const problems = [];
+
+// SECURITY.md: the supported table must mark the shipping series as supported.
+// Matched on the row rather than the bare string so a mention in prose (or a
+// row that says No) cannot satisfy it.
+const security = read('SECURITY.md');
+const row = new RegExp(`^\\|\\s*${series.replaceAll('.', '\\.')}\\s*\\|\\s*Yes\\s*\\|`, 'im');
+if (!row.test(security)) {
+ problems.push(
+ `SECURITY.md has no supported row for ${series} — shipping ${version}.\n` +
+ ` Expected a line like: | ${series} | Yes |`,
+ );
+}
+
+// A row saying an already-shipped series is unsupported has to move with it too.
+const unsupported = /^\|\s*<\s*(\d+\.\d+)\s*\|\s*No\s*\|/im.exec(security);
+if (unsupported && unsupported[1] !== `${major}.${minor}`) {
+ problems.push(
+ `SECURITY.md draws the unsupported line at < ${unsupported[1]}, but ${version} is shipping.\n` +
+ ` Expected: | < ${major}.${minor} | No |`,
+ );
+}
+
+// CHANGELOG.md: the version being shipped needs its own section. release.js only
+// warned about this, and a warning in a release script is read once, if at all.
+const changelog = read('CHANGELOG.md');
+if (!changelog.includes(`## [${version}]`)) {
+ problems.push(
+ `CHANGELOG.md has no "## [${version}]" section — write the release notes ` +
+ `before bumping the version (rename the [Unreleased] heading).`,
+ );
+}
+
+if (problems.length > 0) {
+ console.error(`\ncheck-release-metadata: ${problems.length} problem(s) against version ${version}\n`);
+ for (const p of problems) console.error(` - ${p}`);
+ console.error('');
+ process.exit(1);
+}
+
+console.log(`check-release-metadata: SECURITY.md and CHANGELOG.md both name ${version}.`);