Skip to content

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 18 Nov 18:04
· 40 commits to main since this release
v0.2.0
2d948cb

Tasks on staged files: Ward now replaces lint-staged as well as husky, with one config for both.

Warning

Ward is in early development (0.x). Until 1.0, any minor release may change the config and behavior.

Install

npm install -D @hexlabelposition/ward
npm pkg set scripts.prepare=ward
npm run prepare

Published with npm provenance. Requires Node.js 24 or later. Two runtime dependencies (yaml, picomatch), ESM-only.

What's in v0.2

Tasks on files

  • Named tasks: { tasks: { name: { run } } }, run in the order they are listed.
  • {staged_files}, {push_files} and {all_files} placeholders. Long file lists are split into several runs, so they fit the command line limit on Windows.
  • glob and exclude per task pick the files a task runs on. A task with no matching files is skipped.
  • Files fixed by a task are staged again; stageFixed: false leaves them unstaged.
  • Symlinks are left out of file lists; symlinks: true passes them to the task.
  • Function tasks in ward.config.ts: a function that gets the file list.
  • parallel: true runs the tasks of a hook at the same time, with each line of output prefixed by the task name.

Safety

  • A backup with git stash create before every run; backup: false or --no-backup skips it.
  • Partial staging: unstaged changes of partially staged files are hidden while tasks run and put back afterwards.
  • When a task fails, the index and working tree are reverted to the backup; revert: false or --no-revert keeps the changes of the tasks.
  • Deletions, binary files, renames, symlinks and merge conflicts are handled in the backup and partial staging.
  • A pre-commit whose tasks undid every staged change fails instead of making an empty commit.

Install

  • ward --bin <path> sets the binary the hooks call instead of node_modules/.bin/ward.

Moving from lint-staged

Move each glob and its commands into a named task with glob and {staged_files}, then remove lint-staged. See Moving from lint-staged.

Tested on

Ubuntu, macOS and Windows, on Node.js 24 and the current release.

What's next

  • v0.3: Bun and Deno.
  • v0.4: the same config in CI (--from-ref, --all-files, --ci) and shared configs with extends.

See BACKLOG.md.

Full Changelog: v0.1.0...v0.2.0