25.0.0-beta.3 • Published 10 months ago

@contextjs/context v25.0.0-beta.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 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

10 months ago

25.0.0-beta.2

10 months ago

25.0.0-beta.1

10 months ago

0.5.3-alpha.1

10 months ago

0.5.2-alpha.1

10 months ago

0.5.1-alpha.1

11 months ago

0.5.0-alpha.1

11 months ago

0.4.8

11 months ago

0.4.7

11 months ago

0.4.6

12 months ago

0.4.5

12 months ago

0.4.4

12 months ago

0.4.3

12 months ago

0.4.2

12 months ago

0.4.1

12 months ago

0.4.0

12 months ago

0.3.0

12 months ago

0.2.3

12 months ago

0.2.2

12 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.1.0

1 year ago

0.0.6

1 year ago