@contextjs/commands
TypeScript icon, indicating that this package has built-in type declarations

25.1.0 • Public • Published

@contextjs/commands

Tests npm License

Core command implementations for building, restoring, running, and watching ContextJS projects.

Features

  • Build, restore, run, and watch ContextJS projects via CLI commands
  • Full support for TypeScript compiler flags and project selection
  • Custom transformers and extensions support
  • Consistent project discovery and error handling
  • Seamless integration with all ContextJS tools

Installation

Usually installed as a dependency and used internally.
For advanced or direct usage:

npm install --save-dev @contextjs/commands

Commands

build

Compiles the project TypeScript sources and prepares templates for deployment.

ctx build
  • Description: Compiles the ContextJS project(s) using the project file and tsconfig.json.
  • Options: Accepts any TypeScript compiler flag, project selectors, and custom extensions.

restore

Restores all NPM dependencies for each detected ContextJS project.

ctx restore
  • Description: Installs or updates dependencies based on each project’s package.json.
  • Behavior: Fails if either context.ctxp or tsconfig.json are missing.

run

Executes the main entry point of a built ContextJS project.

ctx run
  • Description: Finds and runs the compiled output specified in the project manifest.
  • Options: Can be chained with build (default) or use --no-build to skip rebuilding.

watch

Starts a file watcher for each ContextJS project and automatically recompiles on changes.

ctx watch
  • Description: Watches sources and rebuilds on changes, using TypeScript's watch API.
  • Options: All TypeScript CLI flags, transformer support, and project filtering.

Usage Examples

ctx build                 # Build all projects
ctx restore               # Restore dependencies
ctx run                   # Build and run (default), or use --no-build
ctx watch                 # Watch files and auto-build

With project selection:

ctx build myApi myWeb     # Only build specific projects

With TypeScript options:

ctx build --noEmitOnError --target ES2022
ctx watch --strict true

With custom extensions:

ctx build --extensions=./src/my-extension.js
ctx watch --extensions=./src/my-extension.js

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
25.1.0
2latest
25.1.0-next.4
0next

Version History

VersionDownloads (Last 7 Days)Published
25.1.0
2
25.1.0-next.4
0
25.1.0-next.3
0
25.1.0-next.2
0

Package Sidebar

Install

npm i @contextjs/commands

Weekly Downloads

2

Version

25.1.0

License

MIT

Unpacked Size

22.9 kB

Total Files

10

Last publish

Collaborators

  • ~contextjs