Registry / devops / just-task

just-task

JSON →
library1.13.0jsnpmunverified

just-task is a robust, lightweight library for defining and orchestrating build tasks in JavaScript and TypeScript projects. It functions as the foundational task definition layer within the broader `Just` ecosystem developed by Microsoft, which also includes `just-scripts` for higher-level, opinionated build presets. Currently at version 1.13.0, just-task provides core primitives such as `task`, `series`, and `parallel` for structuring complex build flows. Its release cadence is generally stable, with updates focusing on refinements and bug fixes rather than frequent breaking changes within the 1.x major version. A key differentiator is its unopinionated nature regarding specific tools (e.g., Webpack, Jest, TypeScript compiler), allowing developers to integrate their preferred tools seamlessly. It targets Node.js environments version 14 and above, offering both CommonJS and ES Module compatibility for task definitions. This library emphasizes clear, programmatic task definition, providing a flexible alternative to more configuration-heavy or tightly coupled build systems.

npm install just-task
INSTALL
IMPORT
SIG · JUST-TASK
J
just-task
devopsjavascriptv1.13.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

task, series, parallel
import { task, series, parallel } from 'just-task';
const { task, series, parallel } = require('just-task');
ESM imports are preferred for modern Node.js environments (v14+). CommonJS `require` is also supported, typically in `just.config.js`.
TaskFunction
import type { TaskFunction } from 'just-task';
import { TaskFunction } from 'just-task';
Import `TaskFunction` as a type only for type annotations in TypeScript projects to avoid runtime issues.
cli
import { cli } from 'just-task/lib/cli';
import { cli } from 'just-task';
For programmatic invocation of the `just` CLI functionality (e.g., from a custom script), the entry point is under `lib/cli`. Most users interact with the `just` CLI package directly.

Demonstrates how to define a series of asynchronous tasks and combine them into complex build flows using `just-task`.

// just.config.ts (or just.config.js) import { task, series, parallel } from 'just-task'; task('clean', () => { console.log('Cleaning build artifacts...'); // Simulate an async operation return new Promise(resolve => setTimeout(resolve, 200)); }); task('lint', () => { console.log('Linting source files...'); return new Promise(resolve => setTimeout(resolve, 300)); }); task('build', () => { console.log('Compiling code...'); return new Promise(resolve => setTimeout(resolve, 500)); }); task('test', () => { console.log('Running unit tests...'); return new Promise(resolve => setTimeout(resolve, 400)); }); // Define a default task for running from CLI without arguments task('default', series('clean', 'lint', 'build', 'test')); // Define a complex task orchestrating others task('ci', series('clean', parallel('lint', 'build'), 'test')); // To run these tasks, install the `just` CLI globally (`npm install -g just`) // or locally (`npm install just` and then use `npx just <task_name>`). // Example: `npx just default` or `npx just ci`
just --version
Debug
Known issues
gotchaWhen defining asynchronous tasks, always ensure the task function explicitly returns a Promise or is an `async` function. If a Promise is not returned, `just-task` will treat the task as synchronous and may proceed before async operations genuinely complete.
fix
Modify your task function to return a Promise (e.g., `return new Promise(...)`) or declare it as `async function() { /* await ... */ }`.
affects: >=1.0.0
gotcha`just-task` provides low-level task definition APIs. For common build scenarios involving tools like TypeScript, Webpack, or Jest, consider using `just-scripts`, which offers pre-configured and opinionated build flows built on top of `just-task`.
fix
Evaluate if `just-scripts` better suits your project's needs for standard build configurations, or continue with `just-task` for full customization.
affects: >=1.0.0
breakingWhile the 1.x major version aims for stability, minor API adjustments or behavioral changes can occur in patch or minor releases. Always consult the official documentation or release notes when upgrading to prevent unexpected behavior.
fix
Review the `just-task` release notes on GitHub or the official documentation (microsoft.github.io/just/) before upgrading, particularly for any non-trivial version changes.
affects: >=1.0.0
gotchaThe `just` CLI expects your task definitions in `just.config.ts` (or `.js`) in the project root. Incorrect file naming or placement is a common cause for tasks not being discovered.
fix
Ensure your configuration file is named `just.config.ts` or `just.config.js` and is located in the root directory of your project, or explicitly specify its path using the `--config` flag with the `just` CLI.
affects: >=1.0.0
Errors
Common errors & fixes
Task 'myTask' not found
The task name specified in the CLI command does not match any defined task in `just.config.ts/js`, or the configuration file was not loaded by the `just` CLI.
fix
Double-check the task name for typos. Verify that your `just.config.ts` (or `.js`) file is correctly named and located in the project root, or specify its path with `npx just --config ./path/to/my.config.ts myTask`.
Error: A task must return a Promise or be synchronous
An asynchronous task function was defined without returning a Promise, or it was not declared as an `async` function, leading `just-task` to misinterpret its completion.
fix
Ensure your asynchronous task function explicitly returns a Promise (e.g., `return new Promise(resolve => { /* ... */ resolve(); });`) or use the `async` keyword: `task('myAsync', async () => { await someAsyncOperation(); });`
TypeError: Cannot read properties of undefined (reading 'task')
This usually indicates an incorrect import statement, such as attempting to use CommonJS `require` syntax in an ES Module context, or incorrect destructuring of named exports.
fix
Verify that you are using the correct import syntax for your file's module type (ESM `import { task } from 'just-task';` or CommonJS `const { task } = require('just-task');`) and that the exports are correctly destructured.
Upgrade
Version history
1.13.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources