Skip to main content
Execute JavaScript or TypeScript files directly with Ant’s runtime.

Usage

ant <file> [options] [-- script-args]

Parameters

file
string
required
Path to the JavaScript or TypeScript file to execute. Can be a local file path or URL.
script-args
string[]
Arguments to pass to the script. Must be preceded by --.

Options

-w, --watch
boolean
Watch mode - restart the process when the entry file changes.
--no-clear-screen
boolean
Keep output when restarting in watch mode (requires --watch).
--localstorage-file
string
File path for localStorage persistence.
--verbose
boolean
Enable verbose output.
--no-color
boolean
Disable colored output.
--stack-size
number
Set stack size in KB (e.g., --stack-size=1024).

Examples

Run a JavaScript file

ant index.js

Run a TypeScript file

ant app.ts

Run with arguments

ant script.js -- --port 3000 --host localhost

Run in watch mode

ant --watch server.js

Run from URL

ant https://example.com/script.js

Terminal Output

$ ant server.js
Server listening on port 3000

Features

  • Native TypeScript Support: Run .ts files without compilation
  • URL Support: Execute scripts from remote URLs
  • Watch Mode: Auto-restart on file changes
  • Module Resolution: Supports ES modules and CommonJS
  • Script Arguments: Pass arguments to your scripts via --
  • REPL - Interactive JavaScript shell
  • exec - Run commands from node_modules/.bin

Build docs developers (and LLMs) love