Skip to content

CLI Reference

The superjs binary drives compilation, type-checking, and project setup. All build behavior is configured through superjs.config.json — the CLI keeps its flag surface small and reads the rest from config.

superjs <command> [files...] [flags]

Global flags

FlagEffect
-h, --helpPrint usage and exit 0
-v, --versionPrint the compiler version and exit 0

Commands

build

Compile .sjs source files to JavaScript.

superjs build src/            # compile every .sjs under src/ → dist/
superjs build app.sjs --watch # recompile on change

Directories are walked recursively for .sjs files. Output .js (and, when enabled, .js.map) is written to the output directory.

FlagValuesDefaultEffect
--out-dir <dir>pathdistOutput directory
--source-map <mode>none | inline | externalexternalSourcemap emission
--no-cachecache onForce a cold build (ignore the .superjs/ cache)
--watchoffRecompile when files change

check

Type-check without emitting any output. Ideal for CI and editors.

superjs check src/                 # human-readable diagnostics
superjs check src/ --format json   # one JSON diagnostic per line
FlagValuesDefaultEffect
--format <mode>pretty | jsonprettyDiagnostic output format

The json format emits one object per line:

{
  "code": "SJS-E001",
  "severity": "error",
  "message": "Null or undefined assigned to non-nullable type `string`",
  "file": "/abs/path/src/app.sjs",
  "line": 42,
  "column": 14,
  "endLine": 42,
  "endColumn": 21
}

explain

Print the full reference for a diagnostic code.

superjs explain E001        # short form
superjs explain SJS-E001    # full code, case-insensitive

See the complete list on the error code reference page.

init

Write a default superjs.config.json into the current directory. Idempotent — running it when a config already exists does nothing.

superjs init

doctor

Report environment health: Node.js version (must be ≥ 18), compiler version, and whether a superjs.config.json is present.

superjs doctor

Exit codes

CodeMeaning
0Success — no errors
1Compilation errors, or a named file was missing
2Usage error (e.g. no files passed to build/check)
70Internal compiler error (reported to stderr)

These codes are stable; scripts and CI can rely on them.

Configuration

Build options live in superjs.config.json rather than on the command line, so one config drives build, check, and your editor identically.

{
  "language": "1.0",
  "compilerOptions": {
    "strict": false,
    "noEmitOnError": false,
    "target": "ES2022",
    "outDir": "dist",
    "sourceMap": "none"
  },
  "jsx": {
    "runtime": "automatic",
    "importSource": "react"
  },
  "paths": {},
  "output": {
    "eol": "lf"
  }
}
KeyTypeDefaultNotes
compilerOptions.strictbooleanfalsePromotes warnings to errors; warns on implicit dynamic
compilerOptions.noEmitOnErrorbooleanfalseSkip emit when any error is present
compilerOptions.targetES2020ESNextES2022ECMAScript output level
compilerOptions.outDirpathDefault output directory
compilerOptions.sourceMapnone | inline | externalnoneSourcemap mode
jsx.runtimeautomatic | classicautomaticJSX transform
jsx.importSourcestringreactJSX import source
pathsrecord{}tsconfig-style path mapping
output.eollf | crlf | autolfLine ending of emitted files

--strict is not a command-line flag — set compilerOptions.strict in config so every tool (CLI, CI, editor) agrees on one source of truth.