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
ion init my-app --template reaction 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
ion dev --port 8080 --openion 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
ion build --sourcemap --target esmion 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
ion test src/**/*.test.js --watchConfiguration
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
ion config set devPort 8080ion env
Print environment variables that Ion passes to child processes.
Syntax
ion env [key]Options
- --shell
- Output as shell export statements
Example
ion env --shellDev 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
ion serve dist --spa --port 4173ion 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
ion proxy /api --target http://localhost:4000 --change-originion 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
ion watch src/styles.css -- ion buildUtilities
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
ion lint src --fix --format jsonion 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
ion format src/**/*.js --checkion 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
ion upgrade --version 1.4.2