3D engine that AI agents drive
Keep the version in src/version.js so core does not bundle package.json
Nguyen Xuan An3ccd9e7f1829
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex e739fa75..16f50ebc 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -73,7 +73,7 @@ Keep site assets out of the npm package: the `files` list in `package.json` deciMaintainers make releases. `package.json` holds the version, and the publish workflow runs when it changes on `main`.-1. Update the version in `package.json`, then run `npm run changes:fold`. It writes the files in `changes/` into `CHANGELOG.md` as that version's section and deletes them. Read `npm run changes` first to see what it will fold.+1. Update the version in `package.json` and in `src/version.js`, then run `npm run changes:fold`. It writes the files in `changes/` into `CHANGELOG.md` as that version's section and deletes them. Read `npm run changes` first to see what it will fold.2. Run `npm test`, `npm run build` and `npm run smoke:package`.3. Commit and push to `main`.4. Wait for the `Publish 67js` workflow. It tests the package and publishes the new version through the npm trusted publisher.diff --git a/changes/core-version.md b/changes/core-version.mdnew file mode 100644index 00000000..4b854663--- /dev/null+++ b/changes/core-version.md@@ -0,0 +1 @@+- Keep the package version in `src/version.js` instead of importing `package.json`, so the core bundle no longer carries the whole manifest. `entry:core` drops from 87,557 to 85,749 bytes gzip.diff --git a/src/index.js b/src/index.jsindex e8509045..09c6805b 100644--- a/src/index.js+++ b/src/index.js@@ -1,6 +1,4 @@-import packageMetadata from '../package.json' with { type: 'json' };--export const VERSION = packageMetadata.version;+export { VERSION } from './version.js';export { Renderer67 } from './renderer.js';export { box, cylinder, sphere, torus } from './geometry.js';export { exportGlb } from './export.js';diff --git a/src/version.js b/src/version.jsnew file mode 100644index 00000000..7641324e--- /dev/null+++ b/src/version.js@@ -0,0 +1,2 @@+// Kept as a literal so bundles do not carry all of package.json. tests/version.test.js keeps it in step.+export const VERSION = '0.15.0';diff --git a/tests/version.test.js b/tests/version.test.jsnew file mode 100644index 00000000..627526e9--- /dev/null+++ b/tests/version.test.js@@ -0,0 +1,8 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import packageMetadata from '../package.json' with { type: 'json' };+import { VERSION } from '../src/index.js';++test('VERSION matches the version in package.json', () => {+ assert.equal(VERSION, packageMetadata.version, 'Set src/version.js to the version in package.json.');+});