LinuxCommandLibrary

just-js

Run JavaScript without Node.js

TLDR

Start a REPL (interactive shell)

$ just
copy


Run a JavaScript file
$ just [path/to/file.js]
copy


Evaluate JavaScript code by passing it as an argument
$ just eval "[code]"
copy


Initialize a new project in a directory of the same name
$ just init [project_name]
copy


Build a JavaScript application into an executable
$ just build [path/to/file.js] --static
copy

SYNOPSIS

just-js [options...] [recipe] [arguments...]

Examples:
just-js build
just-js test --watch
just-js lint src/ --fix

PARAMETERS

-f, --justfile FILE
    Specify path to justfile.js

-d, --dir DIR
    Change to directory before running

--list
    List available recipes

--list-running
    List currently running recipes

--dry-run
    Print commands without executing

-h, --help
    Show help

--version
    Print version

--watch
    Watch for changes and re-run

--parallel
    Run independent tasks in parallel

-e, --env KEY=VALUE
    Set environment variable

DESCRIPTION

just-js is a Node.js-based command runner inspired by the Rust 'just' tool, designed for JavaScript/TypeScript projects. It uses a justfile.js (or justfile.mjs) written in JavaScript to define tasks/recipes, offering a modern alternative to Makefiles or npm scripts for complex workflows.

Key features include dynamic task generation, async/await support, dependency graphs, environment variables, and shell integration. Invoke tasks with just-js task arg1 arg2. It auto-discovers justfile.js in the current or parent directories, similar to just's behavior.

Ideal for monorepos, CI/CD pipelines, and build scripts in JS ecosystems. Supports watchers, parallelism, and exports for IDE integration. Unlike npm run, it provides better tab-completion, dry-run modes, and cross-platform consistency without shell quirks.

Installation via npm: npm i -g just-js. Recipes leverage JS power for logic-heavy tasks, like conditional builds or API-dependent setups.

CAVEATS

Third-party tool, not in core Linux repos; requires Node.js ≥14.
Performance overhead vs native shell scripts for simple tasks.
justfile.js must export an object with recipe functions.

INSTALLATION

npm install -g just-js
yarn global add just-js

EXAMPLE JUSTFILE.JS

export default { build: async () => 'tsc', test: ['jest'], dev: { cmd: 'nodemon', deps: ['build'] } };

SHEBANG SUPPORT

Use #!/usr/bin/env just-js in scripts for direct execution.

HISTORY

Developed around 2022 as a JS port/alternative to Casey Primozic's Rust 'just'. Aims to bring justfile power to Node ecosystems. Active on npm, with community contributions for TS/ESM support.

SEE ALSO

make(1), npm(1), just(1), task(1)

Copied to clipboard