From 9fcad5438b79b3b2c82e04c8cd85c79b443b8da8 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Mon, 20 Oct 2025 14:03:35 -0400 Subject: [PATCH] Add GitHub Actions workflow for publishing to NPM on release --- .github/workflows/publish.yml | 22 ++++++++++++++++++++ AGENTS.md | 39 ----------------------------------- 2 files changed, 22 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 AGENTS.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..da51578 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,22 @@ +name: Publish to NPM + +on: + release: + types: [published] + +permissions: + id-token: write + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-node@v6 + with: + node-version: "20" + registry-url: "https://registry.npmjs.org" + - run: npm ci + - run: npm run build --if-present + - run: npm publish diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index 3336928..0000000 --- a/AGENTS.md +++ /dev/null @@ -1,39 +0,0 @@ -# Repository Guidelines - -## Project Structure & Module Organization -- Source: `src/` (entry: `src/index.ts`). -- Protocol modules: `src/rdap/` and `src/whois/` (clients, normalize, helpers). -- Utilities: `src/lib/`, shared types: `src/types.ts`. -- Tests live beside code in `__tests__/` and use `*.test.ts`. -- Built output: `dist/` (ESM + types). Quick CLI: `cli.mjs` for manual checks. - -## Build, Test, and Development Commands -- `npm run build` — clean and compile TypeScript to `dist/`. -- `npm test` — type-check, build, and run Node’s test runner on `dist/**/*.test.js`. -- `npm run lint` — format and lint with Biome (auto-fixes). -- Manual smoke: `node cli.mjs example.com` (after `npm run build`). -- Network smoke tests (opt‑in): `SMOKE=1 npm test`. - -## Coding Style & Naming Conventions -- TypeScript strict, ESM (`module`/`moduleResolution: NodeNext`). -- Formatting via Biome: spaces, 2‑space indent, double quotes. -- Naming: functions/vars `camelCase`, types/interfaces `PascalCase`, constants `UPPER_SNAKE_CASE`. -- Files: lowercase; tests in `__tests__/` with `*.test.ts`. -- Prefer named exports; avoid default exports unless ergonomic. - -## Testing Guidelines -- Framework: Node `node:test` + `assert/strict`. -- Unit tests must be deterministic and offline. Gate network tests behind `SMOKE=1`. -- Place tests near the code (e.g., `src/whois/__tests__/normalize.test.ts`). -- Run locally: `npm test`; for smoke: `SMOKE=1 npm test`. - -## Commit & Pull Request Guidelines -- Commits: concise imperative subject (e.g., “Add WHOIS referral fallback”), with a brief “what/why” body. -- Scope changes narrowly; keep diffs readable. -- PRs: clear description, linked issues, test plan (commands + expected output), and any CLI screenshots/logs when relevant. -- Required checks before PR: `npm run lint && npm test`. - -## Security & Configuration Tips -- Node `>= 18.17`. No external HTTP client; uses global `fetch` and TCP 43 for WHOIS. -- Avoid hardcoding endpoints. Respect options: `timeoutMs`, `followWhoisReferral`, `rdapOnly`, `whoisOnly`. -- Do not run network tests in CI by default; use `SMOKE=1` only when appropriate.