diff --git a/watch/README.md b/watch/README.md index 75163f33..5d0dd9e9 100644 --- a/watch/README.md +++ b/watch/README.md @@ -5,7 +5,13 @@ source files change in a directory, shutdown the current invocation _gracefully_ and restart it. ``` -deno -A jsr:@effectionx/watch npm start +npx @effectionx/watch npm start +``` + +or, under Deno: + +``` +deno run -A npm:@effectionx/watch npm start ``` ## Graceful Shutdown @@ -24,13 +30,13 @@ source control (not ignored). ## Use it as an Effection library -Most of the time, you will use this an executable. However, if you want to -create your own watch from within a library, you can But if you want to write -your own +Most of the time, you will use this as an executable. If you want to build your +own watch from within a library, the `/lib` export is the same machinery the +command is built on. ```ts import { each, main } from "effection"; -import { watch } from "@effectionx/watch"; +import { watch } from "@effectionx/watch/lib"; await main(function* () { const changes = watch({ diff --git a/watch/main.ts b/watch/main.ts index eadefd6a..674c310a 100644 --- a/watch/main.ts +++ b/watch/main.ts @@ -1,3 +1,4 @@ +#!/usr/bin/env node import process from "node:process"; import { each, exit, main, scoped, spawn } from "effection"; import { z } from "zod"; diff --git a/watch/package.json b/watch/package.json index d570c046..f5af06e3 100644 --- a/watch/package.json +++ b/watch/package.json @@ -1,11 +1,14 @@ { "name": "@effectionx/watch", "description": "Run commands and restart them gracefully when source files change", - "version": "0.4.7", + "version": "0.4.8", "keywords": ["process"], "type": "module", "main": "./dist/main.js", "types": "./dist/main.d.ts", + "bin": { + "watch": "./dist/main.js" + }, "exports": { ".": { "types": "./dist/main.d.ts",