package.json
Every Node.js package (the root of the repository, each package under
packages/*, and each SDK under sdk/node/*) is described by a
package.json manifest. This page documents the conventions Eternaltwin
follows, on top of the standard fields described in the reference above.
Common fields
name: scoped as@eternaltwin/<name>(e.g.@eternaltwin/core,@eternaltwin/client-node).version: kept in sync across the whole workspace (Rust crates included) and bumped in one step bycargo xtask release <version>. Do not bump it by hand in a single package.type:"module". All packages are ESM-only: sources are.mtsfiles, compiled to.mjs.licenses: an array of{ "type": "AGPL-3.0-or-later", "url": "..." }(this predates the standard SPDXlicensestring field, but is what the workspace consistently uses — keep the existing style when adding a package rather than switching tolicense).publishConfig:{ "access": "public", "registry": "https://registry.npmjs.org/" }on every published package.engines.node: declares the minimum supported Node.js version for that package. The root manifest currently requires>=20.11.0; some older packages underpackages/*andsdk/node/*still declare lower floors (>=14.13.1or>=18.13.0) inherited from when they were last touched — when editing a package, prefer aligning it with the root requirement.exports: maps the package's public entry points to compiled output, e.g.{ ".": "./lib/index.mjs", "./*": "./lib/*.mjs" }for a library, or{ ".": "./bin/etwin.mjs" }for a CLI package.files: whitelists what gets published, typically the compiled output (./lib/**/*.(mjs|map|mts)) and sometimes the sources needed to rebuild type declarations (./src/lib/).
Standard scripts
Most packages implement the same task names, so they can be run uniformly
with yarn run <task> from any workspace, or yarn workspaces foreach
from the root:
build: compile the package, usuallytsc --build src/lib/tsconfig.json.lint:eslint "./src/**/*.mts".format:eslint --fix "./src/**/*.mts".test:build+test:run(aggregated astest): compile then run tests withnode --test.prepack: runs before publishing (usuallyyarn run build), so the published tarball always contains fresh compiled output.
The root package.json additionally exposes workspace-wide tasks such as
lint, format, start, clean, test, db:check, db:reset,
db:sync, start:dev:back, and start:dev:front — see the root
README.md for the full list.