@velo/editor (0.4.0)

Published 2026-10-15 22:36:32 +02:00 by r59q

Installation

@velo:registry=
npm install @velo/editor@0.4.0
"@velo/editor": "0.4.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. 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.

The package owns no UI, file I/O or renderer. See the game's controlled authoring view for composition. Repository TypeScript/Vite aliases resolve the public base import to local source, while the standalone package uses its declared registry dependency.

Focused checks from the repository root:

npx tsx --test tests/editor-package.test.ts games/crownfall/tests/map-authoring.test.ts

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.

Dependencies

Dependencies

ID Version
@velo/crown-base >=0.5.0 <0.7.0

Development dependencies

ID Version
typescript ^5.9.3
Details
npm
2026-10-15 22:36:32 +02:00
914
UNLICENSED
3.9 KiB
Assets (1)
Versions (8) View all
0.8.0 2026-10-18
0.7.0 2026-10-18
0.6.0 2026-10-18
0.5.0 2026-10-15
0.4.0 2026-10-15