verify-source
Build and type-check unpublished frontend modules against this loader release and the DMS core layer, without a backend.
ajs dms verify-source checks that unpublished frontend modules build and type-check against this release of the loader, on top of the DMS core layer. It needs no backend. It generates a temporary workspace, removes it when the run ends, and publishes nothing. A module runs it in CI and before a release.
$ ajs dms verify-source --help
Usage: ajs dms verify-source [options]
Build and type-check unpublished DMS frontend modules against this loader
version, on top of the DMS core layer of the @antelopejs/dms installed in the
project. Runs in a temporary workspace removed when the run ends, and starts no
backend.
Options:
-l, --layer <path> Root of an unpublished DMS core layer to verify
instead of the installed one
-m, --module <path> Root of a frontend module to verify (repeatable);
without -l or -m, the current directory or
./frontend-vue
--local-package <name=path> Bind a local package into the generated workspace
(repeatable)
--include <glob> Files of this project to add to the type check, a
TypeScript include glob relative to the current
directory (repeatable)
--include-tsconfig <path> A tsconfig of this project whose compiler options
the included files are checked with, and whose
files are included without --include
-h, --help Show help for a command
A run
Run it from the project. The core layer is the frontend-vue directory of the @antelopejs/dms the project installs, found the way Node resolves it from the current directory. A project that does not install it is told the command that adds it as a development dependency.
$ ajs dms verify-source
ajs dms verify-source 2 modules
ℹ Verifying against @antelopejs/dms 0.9.0 (installed in this project)
✔ Materialized 2 modules 1.0s
✔ Installed 429 packages 11.4s
✔ Generated the type declarations 3.4s
✔ Built the server modules 4.9s
✔ Built the e-mail bundle 9.0s
✔ Type check passed 1m 56s
✔ Built the client bundle 1m 58s
✔ Built the SSR bundle 2m 31s
▲ 1 Vite warning
→ Run with --verbose to list them
✔ Client bundle checked
✔ E-mail contracts hold · 8 templates · 132 KB JS (limit 256 KB) · 217 KB locale data
✔ 1 server module, 21 KB JS
Verified 2 modules · 2m 56s
The two modules are the DMS core layer and the project's own frontend-vue. The run builds the client, SSR, e-mail and server bundles while vue-tsc runs alongside. Then it checks what the client bundle loads and renders eight DMS e-mail templates. It also checks that the e-mail bundle holds no browser-only module and stays under 256 KB of JavaScript, and that the server modules bundle loads in Node.js and holds no application code, such as a .vue file or dms.frontend.ts that a dms.server.ts imports. The run does not compress the client assets, because only a served build needs that.
A failure stops the run with exit code 1 and points at the file in the module you passed, not at its copy in the workspace, for example ./frontend-vue/app/components/Callout.vue:17:7. --verbose streams the pnpm, Vite and vue-tsc output.
The pnpm, Vite and vue-tsc processes of the run keep only the heap size options of the caller's NODE_OPTIONS (--max-old-space-size, --max-old-space-size-percentage and --max-heap-size) and none of its other options, such as a --require preload. NODE_OPTIONS=--max-old-space-size=8192 ajs dms verify-source gives each of them an 8 GB heap.
One verification of a layer runs at a time. A second run on the same --layer, or in the same project without -l, stops at once and names the pid of the run in progress. The lock of a run that died is taken over. A verification also refuses to start inside another one, such as from a script its build runs.
Choosing the modules
Without -m, the verifier takes the current directory when it holds a dms.frontend.ts, and its frontend-vue directory otherwise. -m names other modules and is repeatable:
ajs dms verify-source -m ./admin-vue -m ./shop-vue
--local-package <name>=<path>, also repeatable, binds a local build of a package into the generated workspace instead of the published one. Every module you pass is copied into the workspace and bound with workspace:*.
The workspace also installs with the overrides each module was installed with, as the overrides of the pnpm-lock.yaml that covers the module record them: the module's own lockfile, or that of the pnpm workspace it belongs to. A module that pins a dependency to a tarball (file:) or a local directory (link:) is therefore verified against that pin, and a relative path resolves from the lockfile's directory. The modules and --local-package take precedence over an override for the same package.
A module whose engines["@antelopejs/dms-frontend"] range excludes this release is refused before anything is installed. See Supported releases.
Type-checking the project's tests
--include <glob>, repeatable, adds files of the project to the type check, such as tests that import the module's code. The glob is a TypeScript include pattern, relative to the current directory. The files stay where they are, so their relative imports resolve from the project. They are read with the generated types, path aliases and auto-imports the modules get, and by default with the workspace's compiler options, checking JavaScript as well as TypeScript, with the Node.js types, so CommonJS tests that require Node.js modules type-check:
ajs dms verify-source --include 'tests/**/*.cjs'
Quote the glob so the shell passes it as written. TypeScript skips node_modules for a ** pattern. A pattern that matches no file adds nothing, and the run fails when the included files come to none.
--include-tsconfig <path> checks them with the compiler options of a tsconfig of the project instead, such as its types, checkJs and strict. Without --include, the files it includes, through files or include, are the ones checked. The options that only matter to emitted output, rootDir, composite and incremental, are reset:
ajs dms verify-source --include-tsconfig tests/tsconfig.json
The included files are type-checked apart from the modules, as Type checking the included files, so a test that stubs an auto-import, such as globalThis.useI18n = () => …, changes nothing in the modules' own type check. Only the errors in the included files fail it, and the syntax and option errors that keep TypeScript from reporting any, at their path from the current directory, for example ./tests/wrong.test.cjs:2:7. The files they import are checked by their own type check: the modules' here, the project's for the rest.
Verifying the DMS core layer
-l is for the development of the DMS itself. It verifies an unpublished core layer instead of the installed one. The example below adds a local build of @antelopejs/dms.
ajs dms verify-source \
--layer /path/to/dms/frontend-vue \
--local-package @antelopejs/dms=/path/to/dms
A --layer that holds no core layer, such as a project's own frontend-vue, is refused with exit code 2 and the command that verifies the same directory with --module instead.
Repository development runs the same verifier through pnpm test:real-source, with DMS_LAYER_SOURCE set to a core layer root and DMS_MODULE_SOURCES to a JSON array of module roots.