Repository navigation
Contributing and Releasing
Mcdavid Obioha edited this page Dec 2, 2026
·
1 revision
Use Node.js 22.
git clone https://github.com/mcdavidobioha/whatsapp-chat-widget-react-typescript.git
cd whatsapp-chat-widget-react-typescript
npm ci| Command | What it does |
|---|---|
npm run dev |
Vite demo app (demo/) with live reload. |
npm run lint |
Strict TypeScript check (no emit). |
npm test |
Builds, runs the Node tests for the message helpers, then the Vitest component, hours, page-context and axe accessibility tests. |
npm run size |
Builds and checks the gzipped bundle against the limit in package.json. |
npm run build |
Generates the inlined CSS and props.schema.json, then compiles to dist/. |
CI runs build, lint, tests and the size check on every push and pull request.
| Path | Responsibility |
|---|---|
src/WhatsAppChat.tsx |
The component and its props (with TSDoc). |
src/hours.ts |
Business-hours logic (isOpenNow). |
src/pageContext.ts |
Page and UTM footer (buildPageContext). |
src/message.ts |
Phone validation and the wa.me URL. |
src/hooks.ts, src/labels.ts
|
Clock, visibility and path hooks; default text. |
src/styles.css |
The only place CSS is written. |
props.schema.json |
Generated from the props interface; commit it. |
llms.txt, AGENTS.md
|
Guides for AI coding assistants. |
test/ |
Node tests and Vitest tests. |
examples/stackblitz/ |
The StackBlitz demo, which installs the published package. |
Generated files you should not edit by hand: src/styles.generated.ts (from styles.css, not committed) and props.schema.json.
- Branch from
main. - Add or change code, plus a test that fails without the change.
- If you add or change a prop: update its TSDoc (
@default,@example), the README,llms.txt,CHANGELOG.mdand this wiki's Props Reference (it is generated fromprops.schema.json). - Keep CSS scoped under
.wcr-widget, class names prefixedwcr-, and prefer logical properties (margin-inline,inset-inline-end) so right-to-left keeps working. - Run
npm run lint && npm test && npm run size. - Open a pull request describing what changed and why.
Guidelines: no new runtime dependencies, keep existing props working (deprecate rather than remove), and keep the form accessible.
Publishing uses npm trusted publishing from GitHub Actions, so no token is stored.
- Update
versioninpackage.jsonand add an entry toCHANGELOG.md. - Push to
mainand wait for CI to pass. - Create the release:
gh release create vX.Y.Z --target main --title vX.Y.Z --generate-notes
- The
Publish to npmworkflow runs tests and publishes with provenance. It may take a few minutes for npm to show the new version. - Update
examples/stackblitz/package.jsonto the new version and refresh its lockfile so the live demo uses it.
Published versions cannot be replaced; if something is wrong, publish a new patch version.