---
name: release
description: >
  Cut a new adom-3d-viewer-babylon9 version: build the standalone ESM bundle,
  stage a wiki-clean manifest, publish the package, push source, and attach the
  built bundle tarball as a pinnable release asset. Use when bumping the viewer
  version, shipping viewer fixes, or syncing the GitHub mirror to the wiki.
---
# Cut a release

Versions must agree in `VERSION` and `package.json`. The wiki page
adom/adom-3d-viewer is the canonical home; GitHub
adom-inc/adom-3d-viewer-babylon9 is the working mirror.

The checkout's package.json carries npm dev/peer deps (svelte, vite, ...),
which the wiki's owner-qualified dependency validation rejects. Publish
therefore goes through a STAGING DIR with a wiki-clean manifest; never run
`pkg publish` from the checkout root.

```bash
# 0. bump the version in BOTH package.json and VERSION
# 1. build the standalone browser bundle
npm install && npx vite build --config vite.standalone.config.ts
echo "$(cat VERSION)" > dist-standalone/VERSION
V=$(cat VERSION)

# 2. stage the wiki publish (wiki-clean manifest + lifecycle scripts)
STAGE=$(mktemp -d)
cp README.md SKILL.md VERSION "$STAGE/"
cp wiki/install.sh wiki/uninstall.sh "$STAGE/"
python3 - "$STAGE" << 'PY'
import json, sys
d = json.load(open("package.json"))
for k in ["devDependencies","peerDependencies","scripts","main","module","exports","files","types"]:
    d.pop(k, None)
d["scripts"] = {"install": "./install.sh", "uninstall": "./uninstall.sh"}
json.dump(d, open(sys.argv[1] + "/package.json", "w"), indent=2)
PY

# 3. publish from the stage
(cd "$STAGE" && adom-wiki pkg publish --org adom)

# 4. push source to the page repo (explicit files; never node_modules/dist)
adom-wiki repo push adom/adom-3d-viewer \
  --files src static docs README.md README-FORK.md SKILL.md publish-skills \
          package.json package-lock.json VERSION standalone.ts \
          svelte.config.js tsconfig.json vite.config.ts vite.standalone.config.ts .gitignore \
  -- -m "v$V"

# 5. attach the built bundle as the pinnable artifact
tar -czf "/tmp/adom-3d-viewer-babylon9-$V.tar.gz" -C dist-standalone .
adom-wiki release upload adom/adom-3d-viewer "$V" "/tmp/adom-3d-viewer-babylon9-$V.tar.gz" --platform any
rm "/tmp/adom-3d-viewer-babylon9-$V.tar.gz"

# 6. if the wiki's native viewer should ship this build: vendor dist-standalone/
#    into git-wiki/static/vendor/adom-3d-viewer-babylon9 and bump
#    VIEWER_BUNDLE_VER in git-wiki/lib/viewers/viewer-3d.js
```

Verify: the page shows the new version, `adom-wiki pkg install
adom/adom-3d-viewer` fetches and extracts the bundle, and the
extracted VERSION matches. Also push the same commit to the GitHub mirror.
