25.0.0-beta.3 • Published 6 months ago

@contextjs/context v25.0.0-beta.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@contextjs/context

Tests npm License

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 build and ctx watch
  • Supports custom and external transformers via --transformers or context.ctxp
  • Works seamlessly with all ContextJS packages

Installation

Install globally via npm:

npm install -g @contextjs/context

This exposes the ctx command globally in your terminal.

Usage

Displaying available options

ctx

Version

ctx version

New project

These commands are equivalent:

ctx new api myApi
ctx new api -n myApi
ctx new api --name myApi

If no argument is passed for the API name, the current folder name will be used:

ctx new api

If no arguments are passed at all, the help message will be shown:

ctx new

Build

Build all detected projects:

ctx build

Build specific projects:

ctx build myApi1 myApi2 ...

You can pass TypeScript compiler options directly:

ctx build --noEmitOnError --target ES2022

Use a custom transformer:

ctx build --transformers=./src/my-transformer.ts

Or define transformers in context.ctxp:

{
  "compilerOptions": {
    "transformers": ["./src/my-transformer.ts"]
  }
}

Watch

Watch and rebuild all projects on file changes:

ctx watch

Watch specific projects:

ctx watch myApi1 myApi2 ...

You can also include TypeScript flags with watch:

ctx watch --moduleResolution NodeNext --strict true

External transformers are also supported in watch mode:

ctx watch --transformers=./src/my-transformer.ts

Project 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.ts

Each file is preconfigured to follow ContextJS conventions and integrates cleanly with the rest of the ecosystem.

25.0.0-beta.3

6 months ago

25.0.0-beta.2

6 months ago

25.0.0-beta.1

6 months ago

0.5.3-alpha.1

6 months ago

0.5.2-alpha.1

6 months ago

0.5.1-alpha.1

7 months ago

0.5.0-alpha.1

7 months ago

0.4.8

7 months ago

0.4.7

8 months ago

0.4.6

8 months ago

0.4.5

8 months ago

0.4.4

8 months ago

0.4.3

8 months ago

0.4.2

8 months ago

0.4.1

8 months ago

0.4.0

8 months ago

0.3.0

8 months ago

0.2.3

8 months ago

0.2.2

8 months ago

0.1.2

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago

0.0.6

8 months ago