@contextjs/context v25.0.0-beta.3
@contextjs/context
Official CLI for building and managing ContextJS projects.
Features
- Unified command-line interface for managing ContextJS-based projects
- Support for creating new projects from templates
- Project-wide or selective build and watch support
- Supports all TypeScript compiler flags via
ctx buildandctx watch - Supports custom and external transformers via
--transformersorcontext.ctxp - Works seamlessly with all ContextJS packages
Installation
Install globally via npm:
npm install -g @contextjs/contextThis exposes the ctx command globally in your terminal.
Usage
Displaying available options
ctxVersion
ctx versionNew project
These commands are equivalent:
ctx new api myApi
ctx new api -n myApi
ctx new api --name myApiIf no argument is passed for the API name, the current folder name will be used:
ctx new apiIf no arguments are passed at all, the help message will be shown:
ctx newBuild
Build all detected projects:
ctx buildBuild specific projects:
ctx build myApi1 myApi2 ...You can pass TypeScript compiler options directly:
ctx build --noEmitOnError --target ES2022Use a custom transformer:
ctx build --transformers=./src/my-transformer.tsOr define transformers in context.ctxp:
{
"compilerOptions": {
"transformers": ["./src/my-transformer.ts"]
}
}Watch
Watch and rebuild all projects on file changes:
ctx watchWatch specific projects:
ctx watch myApi1 myApi2 ...You can also include TypeScript flags with watch:
ctx watch --moduleResolution NodeNext --strict trueExternal transformers are also supported in watch mode:
ctx watch --transformers=./src/my-transformer.tsProject Structure
When you create a new project using ctx new api myApi, the following layout is generated:
myApi/
├── context.ctxp
├── tsconfig.json
├── package.json
└── src/
└── main.tsEach file is preconfigured to follow ContextJS conventions and integrates cleanly with the rest of the ecosystem.
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago