Command reference

Complete list of Ion CLI commands with syntax, options, and examples.

Core commands

ion init

Scaffold a new Ion project into a directory.

Syntax

ion init [directory]

Options

--template <name>
Choose a template: vanilla, react, vue, svelte
--no-install
Skip installing dependencies after scaffolding
--force
Overwrite the target directory if it exists

Example

terminal
ion init my-app --template react

ion dev

Start the development server with hot reload.

Syntax

ion dev [options]

Options

--port <number>
Set the server port (default: 3000)
--host <address>
Bind to a specific host (default: localhost)
--open
Open the default browser when the server starts

Example

terminal
ion dev --port 8080 --open

ion build

Compile the project for production into the dist directory.

Syntax

ion build [options]

Options

--minify
Minify JavaScript and CSS (enabled by default)
--sourcemap
Generate source maps for debugging
--target <string>
Set the output format: esm, cjs, iife

Example

terminal
ion build --sourcemap --target esm

ion test

Run the test suite using the built-in test runner.

Syntax

ion test [pattern]

Options

--watch
Watch files and rerun tests on changes
--coverage
Report test coverage with text output
--bail
Stop after the first failing test

Example

terminal
ion test src/**/*.test.js --watch

Configuration

ion config

Read and write values in ion.config.js without opening the file.

Syntax

ion config <get|set|list> [key] [value]

Options

--json
Output as JSON for scripting
--global
Apply to the user global config instead of project

Example

terminal
ion config set devPort 8080

ion env

Print environment variables that Ion passes to child processes.

Syntax

ion env [key]

Options

--shell
Output as shell export statements

Example

terminal
ion env --shell

Dev server

ion serve

Serve a static directory without any build step.

Syntax

ion serve [directory] [options]

Options

--port <number>
Set the server port (default: 3000)
--spa
Enable single-page application fallback to index.html
--headers <json>
Add custom response headers

Example

terminal
ion serve dist --spa --port 4173

ion proxy

Proxy requests from the dev server to a backend.

Syntax

ion proxy <path> --target <url>

Options

--target <url>
Backend URL to forward matching requests to
--change-origin
Rewrite the Host header to the target

Example

terminal
ion proxy /api --target http://localhost:4000 --change-origin

ion watch

Watch a file or directory and run a command on change.

Syntax

ion watch <path> -- <command>

Options

--debounce <ms>
Delay before triggering the command (default: 100)

Example

terminal
ion watch src/styles.css -- ion build

Utilities

ion lint

Run static analysis on JavaScript and TypeScript files.

Syntax

ion lint [pattern] [options]

Options

--fix
Automatically fix safe linting errors
--format <name>
Output format: stylish, json, compact

Example

terminal
ion lint src --fix --format json

ion format

Format source files with the built-in formatter.

Syntax

ion format [pattern] [options]

Options

--check
Report files that would be changed without writing
--write
Overwrite files with formatted output (default)

Example

terminal
ion format src/**/*.js --check

ion upgrade

Upgrade Ion CLI to the latest stable version.

Syntax

ion upgrade [options]

Options

--pre
Install the latest prerelease version
--version <number>
Pin a specific version

Example

terminal
ion upgrade --version 1.4.2
Built with vibld