prepare
Generate the workspace, the module registry and the types without ever failing an install, or strictly before a CI type check.
ajs dms prepare generates the workspace, the frontend-module registry and the module types, without starting a server. Editors and type checks read those types, so a frontend module typically runs it from its postinstall hook.
$ ajs dms prepare --help
Usage: ajs dms prepare [options]
Generate the workspace, the frontend-module registry and the module types.
Without --strict, prepare never fails: when it cannot prepare the workspace it
warns and exits 0, so a postinstall hook never breaks an install.
Options:
-b, --backend-url <url> Backend URL; without one, prepare is skipped with
a warning (env: DMS_API_BASE_URL)
-f, --force Reinstall the workspace dependencies
--offline Reuse the last cached manifest instead of
fetching it (env: DMS_OFFLINE)
--strict Exit 1 when the workspace cannot be prepared, and
2 when the backend URL is missing or invalid,
instead of warning and exiting 0 (env:
DMS_PREPARE_STRICT)
--bootstrap-secret <secret> Credential for the backend's layer endpoints;
prefer the variable, a command line is visible to
other processes. Discovered from
.antelope/dms-dev.json for the enclosing
project's backend (env: DMS_BOOTSTRAP_SECRET)
-h, --help Show help for a command
prepare reads the modules the backend's manifest lists, from the backend's own directories, so it needs a backend running on the same machine. Unlike dev, it takes the backend URL from -b or DMS_API_BASE_URL only, and keys the workspace on that URL.
Success
$ ajs dms prepare -b http://localhost:5050
ajs dms prepare http://localhost:5050
✔ Workspace generated 1.6s
✔ Installed 453 packages 15.7s
✔ Prepared the workspace · 12 modules · types and registry written · 17.3s
~/.antelopejs/dms-frontend/8532f40f…
Skipped or failed, exit 0
Without --strict, prepare warns on stderr and exits 0 whenever it cannot prepare the workspace. The warning says which of two cases it hit.
Skipped means no backend is in reach. The URL is missing, the backend does not answer, or --offline finds no cached manifest. That is the normal case in CI, and a later run from a development machine generates the types.
$ ajs dms prepare
▲ Skipped prepare: no backend URL
→ Pass -b <url> or set DMS_API_BASE_URL to generate the types
prepare never fails an install; add --strict to make this an error.
$ ajs dms prepare -b http://localhost:5999
ajs dms prepare http://localhost:5999
▲ Skipped prepare: Cannot reach the DMS backend at http://localhost:5999
Connection refused (ECONNREFUSED).
→ Start the backend (`ajs project dev` for a local one), or pass its URL with -b <url>
The types and the module registry were not generated.
prepare never fails an install; add --strict to make this an error.
Failed means something a later run will not fix on its own, such as a refused credential, an incompatible manifest, a module whose supported range excludes this release, or an invalid URL.
Strict mode
A step that needs the types, such as a CI type check, passes --strict or sets DMS_PREPARE_STRICT=1. prepare then exits 1 when it cannot prepare the workspace, and 2 when the backend URL is missing or invalid.
ajs dms prepare -b http://localhost:5010 --strict
DMS_PREPARE_STRICT and DMS_OFFLINE count as set unless their value is empty, 0, false, no or off.