@velo/editor (0.6.0)
Installation
@velo:registry=npm install @velo/editor@0.6.0"@velo/editor": "0.6.0"About this package
@velo/editor
Crownfall's domain-level map authoring operations. The shared document contract and validator
come from the runtime dependency
@velo/crown-base.
paintTerrain(document, { x, z, width, depth, material }) paints a cell-aligned rectangle in
the existing material layer. Coordinates and dimensions are whole metres; material indexes
TERRAIN_MATERIALS, excluding the legacy Riverbed entry. It returns the shared MapDocumentResult:
a validated, independently owned document or a MapArtifactError with field paths. It never mutates
the input, clips an out-of-bounds rectangle or wraps an invalid byte. Successful operations increment
field.version once, including repainting an existing material. The shared validator checks
catalogue values, reserved flags,
document content and revision overflow. All other terrain, site, instruction and asset-reference
data is preserved; artifact, schematic and generator versions remain unchanged.
Legacy water/span layers, river instructions and neutral bridge sites remain readable and are preserved by ground painting. There are no water, river or bridge authoring operations; removing those fields from the shared artifact format is separate work.
The package owns no UI, file I/O or renderer. See the game's controlled authoring view for composition. The standalone package and game consume the built public base dependency.
Build
From this directory, install the package's development dependency and compile the TypeScript:
npm install
npm run build
The compiler writes JavaScript, source maps, and type declarations to dist/. The package tarball
contains that output and this README.
Forgejo npm registry
The package is published to the Forgejo npm registry owned by velo:
https://git.amhk.dk/api/packages/velo/npm/
The package is public, so installing it does not require a Forgejo access token. Configure npm to
use the Forgejo registry for the @velo scope, either in your project .npmrc:
@velo:registry=https://git.amhk.dk/api/packages/velo/npm/
Then install the library in that project:
npm install @velo/editor
Publishing requires a Forgejo access token with package write permission. To publish manually, first build and then publish against the Forgejo registry:
npm run build
npm publish --registry=https://git.amhk.dk/api/packages/velo/npm/
The Publish editor workflow publishes on pushes to main that change this directory, and can be
run manually. It picks the next 0.x.0 version above those already in the registry, so Forgejo
never sees a duplicate. The PACKAGE_REGISTRY_TOKEN Actions secret must belong to an account with
package write access.
Crownfall public-package handoff (#774)
Crownfall imports paintTerrain and TerrainPaint from @velo/editor. Its crown-base range
>=0.5.0 <0.7.0 covers the existing artifact contract and the expected 0.6.0 additive schema
release. It deliberately excludes later minor releases until reviewed. Publish crown-base first,
then editor using the existing workflows; adopt that editor release and the same crown-base
release in the game's manifest/lockfile. If an intervening publication changes the selected minor,
review and adjust this range before publishing. Painting and artifact semantics are unchanged.
After installing package-local dependencies, npm run test:consumer packs editor into a clean
project and type-checks/runs painting and artifact round trips using declared dependencies only.
For an unpublished crown-base candidate, pass its absolute tarball path:
npm run test:consumer -- /tmp/crown-base-0.6.0.tgz. The candidate's manifest version must satisfy
the declared range; the check runs npm ls to reject an incompatible or duplicate dependency.
Package-owned checks
Run from this package directory, using Node 24:
npm ci
node node_modules/tsx/dist/cli.mjs --test test/index.test.ts test/paint-terrain.test.ts
The test script discovers test/*.test.ts locally with its declared tsx dev dependency.
test:consumer remains the separate packed public-consumer check. Neither needs a root install
or a game. Root bridge tests remain for #763 to remove when CI selects package commands;
package-owned artifact/paint coverage must stay selected during that transition.
Dependencies
Dependencies
| ID | Version |
|---|---|
| @velo/crown-base | >=0.5.0 <0.7.0 |
Development dependencies
| ID | Version |
|---|---|
| tsx | ^4.23.15 |
| typescript | ^5.9.3 |