Conversation
- web/: static site with live results for every style, click to copy, shareable ?t= URLs, dark mode, no build step (imports index.js directly) - netlify/functions/api.js: single Functions 2.0 handler for /api/* (styles, :style/:text, all, chain, batch) with CORS, caching, limits - netlify.toml: publish web/, copy index.js at build, security headers - Tests for the API handler via Request objects and a browser-safety guard - Docs: README Try it online + HTTP API sections, CLAUDE.md, AGENTS.md
- Trigger CI for pull requests against any branch so stacked PRs get checks - npm audit fix: clears 22 Dependabot alerts in dev-only transitive deps
… in range npm audit fix had bumped vitest to 4.1 / vite 8, which requires Node 20.19+ and broke the Node 18 CI job. Revert that and update only the transitive packages that have fixes within vitest 4.0.18's ranges (18 of 22 alerts). The remaining 4 are in vite 7 / @vitest/mocker and are dev-only; they clear when Node 18 support is dropped.
… polish - Require Node 22.12+; CI matrix 22/24; vitest 5, eslint 10; zero audit findings - API: GET /api/badge/:style/:text (SVG), /api/lorem/:count?style=, /api/spell/:text?style= (nspell + dictionary-en as devDependencies, bundled into the function; the npm package stays zero-dependency) - Site: chain builder (+ on each row, ?chain= in the URL), Open Graph and Twitter meta tags, 404 page, version in footer from /api - 141 tests, 100% coverage on index.js, cli.js, api.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #8. Adds the fun face (website) and the serious face (HTTP API) of capstring, in this repo, with zero build step. Also raises the Node floor to 22.12 so the test toolchain can move to vitest 5 / eslint 10 and clear every Dependabot alert.
Website (
web/)+on any row to compose up to 10 styles; result, copy button, and/api/chaincurl update live. Shareable as?chain=upper+reverse.?t=URLs, dark mode, mobile layout, Open Graph + Twitter meta, 404 page, version in footer from/api../capstring.js, which the Netlify build copies fromindex.js.API (
netlify/functions/api.js, one Functions 2.0 handler owning/api/*)GET /api/styles,GET /api/:style/:text,GET /api/all/:text,GET /api/chain/:styles/:text,POST /api/batchGET /api/badge/:style/:text(shields-style SVG,?label=),GET /api/lorem/:count?style=,GET /api/spell/:text?style=(nspell + dictionary-en, lazy-loaded so other routes don't pay for it)Cache-Controlpublic except forrandomand POST,?format=txt,?pretty=1,?text=override{ error: { code, message } }responses.Dependencies:
nspellanddictionary-enare devDependencies on purpose. esbuild bundles them into the function; the npm package stays zero-dependency.dictionary-enis marked external +included_filesinnetlify.tomlbecause it reads its.aff/.dicfiles by path.Node: engines
>=22.12.0, CI matrix 22 and 24. Node 18 and 20 are end-of-life. Documented under Behavior changes in CHANGELOG.Test plan
npm run lintclean (eslint 10)npm run test:coverage141 tests, 100% statements / branches / functions / lines on index.js, cli.js, api.jsnpm audit0 vulnerabilitiesnpm pack --dry-runstill excludes web/ and netlify/npm run dev: curled transform, slug, batch, spell (helo speling→Hello Spelling), badge (SVG), lorem (?style=kebab), 404 page,/capstring.js?t=, click-to-copy toast fired, curl line switched to the selected style, no console errorsAfter merging:
netlify initin the Brian Funk team as sitecapstring, production branchmaster, branch deploys fordev.