Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

# Prerenders every page, so it catches MDX syntax errors and broken
# pages, which `check` doesn't build.
- name: Build the docs site
# Builds the package, which the hovers and type tables read, then
# prerenders every page. That catches MDX syntax errors, broken pages
# and type errors in examples, which `check` doesn't build.
- name: Build the package and the docs site
run: pnpm run build:site
15 changes: 13 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,20 @@ to static files. It's a package in the pnpm workspace and isn't published.
to them, so when a feature changes, update its page, and the README only
if its quick start or links change. Link between pages with root-relative
paths (`/docs/errors/status-errors`).
- Every `ts` block on a page gets Twoslash type hovers, read from the
built package in `dist`, and a type error in one fails the site's build.
`no-twoslash` in a block's meta turns its hovers off, but the docs check
still compiles it, so use it only for an example whose hovers mislead.
- The API reference pages (`reference/fetch.mdx`, `plugins.mdx` and
`fetch-test.mdx`) are generated from the JSDoc by
`scripts/reference-docs.mjs`. Don't edit them: after changing a public
export or its docs, run `pnpm run docs:reference`. A new export needs a
group in that script, and the docs check fails until it has one and the
pages match.
- `pnpm run check` doesn't build the site. After changing `site/`, run
`pnpm run build:site`, which prerenders the site into `site/dist/client`.
`pnpm --dir site run dev` serves it while you write.
`pnpm run build:site`, which builds the package, then prerenders the site
into `site/dist/client`. `pnpm --dir site run dev` serves it while you
write, once `pnpm run build` has built `dist`.

## Before declaring any work done

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ All notable changes to `@monarcode/effetch`, newest first.
- Documentation site at [effetch.pages.dev/docs](https://effetch.pages.dev/docs),
with a page for each guide that was in the README, and search. The
package's `homepage` points to it.
- The site's examples show each name's type and docs on hover, and its
[API reference](https://effetch.pages.dev/docs/reference) lists every
export of `Fetch`, the plugins and `FetchTest`, with tables of the option
types. A [Compatibility](https://effetch.pages.dev/docs/reference/compatibility)
page lists the supported Effect versions, runtimes and TypeScript
settings.

### Changed

Expand Down
35 changes: 20 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const getTodo = (id: number) =>

## Documentation

The guides are at
The guides and the API reference are at
**[effetch.pages.dev/docs](https://effetch.pages.dev/docs)**.

## Install
Expand Down Expand Up @@ -151,7 +151,9 @@ Calling an API from a web page on another origin? Read
- [Platform notes](https://effetch.pages.dev/docs/platforms): browsers and React Native.
- [Coming from axios or ky](https://effetch.pages.dev/docs/coming-from-axios-or-ky).
- [Upgrade from 0.1.0-rc.3](https://effetch.pages.dev/docs/upgrading).
- [Reference](https://effetch.pages.dev/docs/reference): the entry points, and
- [Reference](https://effetch.pages.dev/docs/reference): every export of
`Fetch`, the plugins and `FetchTest`, with
[Compatibility](https://effetch.pages.dev/docs/reference/compatibility) and
[Limitations](https://effetch.pages.dev/docs/reference/limitations).

## Examples
Expand Down Expand Up @@ -190,19 +192,22 @@ pnpm install
pnpm run check
```

| Script | What it does |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `pnpm run build` | Builds `dist/` (ESM and `.d.ts`) with tsdown. |
| `pnpm test` | Runs the tests and type tests with Vitest. |
| `pnpm run typecheck` | Typechecks `src`, `test` and `examples`. |
| `pnpm run lint` | Lints with oxlint (`lint:effect` runs the Effect language service). |
| `pnpm run format` | Formats with oxfmt (`format:check` only checks). |
| `pnpm run check:docs` | Checks every public export has a description, `@example` and `@since`, and compiles every example in the JSDoc, this README and the docs site's pages. |
| `pnpm run smoke` | Packs the package, installs it in a fresh project, typechecks and runs a consumer, and checks go-to-definition, hovers and completions. |
| `pnpm run check` | All of the above, plus publint and attw. CI runs it on every push to `main` and every pull request. |
| `pnpm run build:site` | Prerenders the docs site in `site/` to `site/dist/client`. `check` doesn't build the site; CI does. |

To work on the docs site, run `pnpm --dir site run dev`.
| Script | What it does |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pnpm run build` | Builds `dist/` (ESM and `.d.ts`) with tsdown. |
| `pnpm test` | Runs the tests and type tests with Vitest. |
| `pnpm run typecheck` | Typechecks `src`, `test` and `examples`. |
| `pnpm run lint` | Lints with oxlint (`lint:effect` runs the Effect language service). |
| `pnpm run format` | Formats with oxfmt (`format:check` only checks). |
| `pnpm run check:docs` | Checks every public export has a description, `@example` and `@since`, compiles every example in the JSDoc, this README and the docs site's pages, and checks the site's API reference matches the JSDoc. |
| `pnpm run smoke` | Packs the package, installs it in a fresh project, typechecks and runs a consumer, and checks go-to-definition, hovers and completions. |
| `pnpm run check` | All of the above, plus publint and attw. CI runs it on every push to `main` and every pull request. |
| `pnpm run build:site` | Builds the package, then prerenders the docs site in `site/` to `site/dist/client`, failing on a type error in an example. `check` doesn't build the site; CI does. |
| `pnpm run docs:reference` | Writes the site's API reference pages from the JSDoc. Run it after changing a public export or its docs. |

To work on the docs site, run `pnpm run build`, then `pnpm --dir site run dev`.
The site's type hovers and tables read the built package, so build again
after changing `src/`.

The pre-commit hook runs `lint` and `format:check`.

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@
"format": "oxfmt --write .",
"format:check": "oxfmt --check .",
"build": "tsdown",
"build:site": "pnpm --dir site run build",
"build:site": "pnpm run build && pnpm --dir site run build",
"dev": "tsdown --watch",
"typecheck": "tsc --noEmit",
"check:docs": "node scripts/check-docs.mjs",
"docs:reference": "node scripts/reference-docs.mjs",
"test": "vitest run",
"test:watch": "vitest",
"check:package": "publint --strict && attw --pack . --profile esm-only",
Expand Down
Loading
Loading