From a11134e75c3a75737b8ae45ce56f2725d2e83705 Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Fri, 2 Oct 2026 23:17:29 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20Publish=20a=20`bin`=20for=20?= =?UTF-8?q?the=20watch=20CLI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `main.ts` is a command line program: it parses argv, prints usage and runs a child process. The package exports it as `.`, but declares no `bin`, so there is no way to invoke it as a command. $ deno run -A @effectionx/watch deno run -A main.tsx error: Failed resolving binary export. '.../@effectionx/watch/package.json' did not have a bin property with a string or non-empty object value Consumers were left importing the package for its side effects to get at a CLI. Declare the bin, and give `main.ts` a shebang so the emitted file can be executed directly; tsc carries it through to `dist`. --- watch/main.ts | 1 + watch/package.json | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) 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", From 870976a1d95a073712ed06993e2bb7fb823fe43f Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Sat, 3 Oct 2026 06:47:37 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9D=20Correct=20the=20watch=20invo?= =?UTF-8?q?cations=20in=20the=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both were wrong. The command line example reached for `jsr:`, where the package stopped at 0.3.1 and is pinned to effection ^3; it is published to npm. The library example imported `@effectionx/watch`, which is the command itself — importing it parses argv and spawns a process. The library lives behind `/lib`. --- watch/README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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({