Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6b373d1
Rename to @javaabu/forms; ESM + CJS build, prepare, coverage, example…
n4ff4h Nov 4, 2026
4565fde
UI-framework-agnostic core with an adapter registry; Onu adapter
n4ff4h Nov 4, 2026
d134eb5
Adapter contract, HTML base adapter and conformance test kit
n4ff4h Nov 4, 2026
a848bef
Use @javaabu/i18n for every string
n4ff4h Nov 4, 2026
c0bac9c
Verify model binding and old input against javaabu/forms
n4ff4h Nov 4, 2026
450f778
Automatic error display
n4ff4h Nov 4, 2026
837d5a5
Lint: match only Tailwind physical utilities, not words like "right"
n4ff4h Nov 4, 2026
7a71aa2
Fix the type of FormsProvider errors (flat errors and bags together);…
n4ff4h Nov 4, 2026
19cd33f
Native Laravel Wayfinder support in Form action
n4ff4h Nov 4, 2026
50f7d8c
Native Laravel Inertia support
n4ff4h Nov 4, 2026
acd7d02
Base shadcn/ui adapter
n4ff4h Nov 4, 2026
e8802cb
Parity with javaabu/forms v2: docs/parity.md and agreed defaults
n4ff4h Nov 4, 2026
c2a5fc1
Dhivehi localization and RTL
n4ff4h Nov 4, 2026
2f8f494
Docs for people and agents; Laravel Boost guideline and skill
n4ff4h Nov 4, 2026
6a24455
Foundations: Inertia and fetch examples, browser-verified submits, co…
n4ff4h Nov 4, 2026
41eb14a
Docs: pnpm 10.34 Git build approval; table_array_separator agreed wit…
n4ff4h Nov 4, 2026
70cbc11
Portable declarations when built from Git inside a pnpm store
n4ff4h Nov 4, 2026
9ba003a
CI: install this commit from GitHub with the pnpm store under node_mo…
n4ff4h Nov 4, 2026
204e616
Custom field hooks, useTableSelection, Blade icon names
n4ff4h Nov 5, 2026
f2b6c08
Add a <script> tag build: dist/forms.iife.js
n4ff4h Nov 15, 2026
450574c
CI: turn off setup-node's package manager cache in the Git install job
n4ff4h Nov 15, 2026
67f5c6d
Write File, Image, Hidden and MapInput values to useForm() data (#24 …
Nov 22, 2026
5b90ef8
Keep a cascade child's saved value until its parent changes (#24 item 2)
Nov 22, 2026
6c0f44c
Format the useForm store test
Nov 22, 2026
45937b6
Leave useForm's transform alone unless _method is needed (#24 item 3)
Nov 22, 2026
85f1598
Don't shift zone-aware date values into the browser's zone (#24 item 4)
Nov 22, 2026
4699087
Keep useForm data over a checkbox's or radio's default (#24 item 5)
Nov 22, 2026
f1f11b8
Submit the format of FilterSubmit's export list (#24 item 6)
Nov 22, 2026
fe02fa8
Report Url's added https:// through onChange (#24 item 7)
Nov 22, 2026
c2e61b5
Submit the value rounded to decimals (#24 item 8)
Nov 22, 2026
1e6ad16
shadcn: don't check a radio whose value is empty (#24 item 9)
Nov 22, 2026
d1aec40
shadcn: hide closed accordion panels (#24 item 10)
Nov 22, 2026
189aa63
Drop rows that leave a Table from its selection (#24 item 11)
Nov 22, 2026
1223666
Create arrays for numeric segments in useForm data (#24 item 12)
Nov 22, 2026
cc0dcce
Stop Submit's spinner when a native submit doesn't leave the page (#2…
Nov 22, 2026
6dc7640
Keep fields a resetOnSuccess list leaves out (#24 item 14)
Nov 22, 2026
83f43de
MapInput follows changes after mount and resets (#24 item 15)
Nov 22, 2026
6e29196
shadcn: keep the label of a picked remote option (#24 item 16)
Nov 22, 2026
7f36bec
shadcn: let a clearable simple select be cleared (#24 item 17)
Nov 22, 2026
80cd9cc
shadcn: render a Modal's trigger without DialogTrigger (#24 item 18)
Nov 22, 2026
4e570f4
Onu: run the core's onSelect from error summary links (#24 item 19)
Nov 22, 2026
d52321d
Onu: keep closed accordion items mounted (#24 item 20)
Nov 22, 2026
efea03d
Onu maps: keep every polygon of a MULTIPOLYGON editable (#24 item 21)
Nov 22, 2026
2d18681
Don't resolve icon names from Object.prototype (#24 item 22)
Nov 22, 2026
769399a
Read the listing URL through an SSR-safe hook (#24 item 23)
Nov 22, 2026
91597c9
Add a Changesets release workflow
Nov 22, 2026
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
5 changes: 5 additions & 0 deletions .changeset/adapter-test-kit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

New `@javaabu/forms/testing`: `testAdapter(myAdapter)` runs conformance tests that render every component through an adapter and check labels, values, native submission, errors and ARIA. The adapter contract is typed (`defineAdapter`, `FormsComponents` and a `…SlotProps` type per slot) and documented in `docs/advanced-usage/adapters.md`. `@testing-library/react` is an optional peer dependency.
5 changes: 5 additions & 0 deletions .changeset/automatic-errors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

Validation errors are now handled by the core, for every adapter. Errors come from Inertia page props, `useForm()`, a JSON 422 response, the `errors` prop or `FormsProvider errors`. Fields match them in dot or bracket notation, and array fields (`tags[]`) also collect their items' errors (`tags.0`). Error bags work with `errorBag`. New: `ErrorSummary`, `ValidationError`, `errorsFor`, `selectErrorBag` and `useFormState()`. Invalid fields get `aria-invalid` and `aria-describedby`, and the first one is focused when errors arrive.
5 changes: 5 additions & 0 deletions .changeset/binding-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

Fields are controlled by the core and still submit natively. Model binding, old input (including `null` old values), nested and array names, checkbox groups, radio groups, relations and date formats follow javaabu/forms. Radios in a group now update together when one is picked.
5 changes: 5 additions & 0 deletions .changeset/blade-icons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

Icons match javaabu/forms (Blade): `startIcon`, `endIcon` and the new `Icon` component take Blade's 30 bundled Lucide names (`pencil`, `trash-2`, `eye`, `check`, …) or icon font classes. The Onu adapter maps them to Onu's icon names. `close` and `error` stay as aliases of `x` and `circle-alert`. Adds `BUNDLED_ICONS`, `ICON_ALIASES` and `resolveIconName()` for adapters.
5 changes: 5 additions & 0 deletions .changeset/cascade-keeps-value.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

A cascade child linked with `parent=` no longer loses its saved value on mount: it waits for the parent's value, and clears only when that value changes.
5 changes: 5 additions & 0 deletions .changeset/custom-field-hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

Custom fields: `useFieldState`, `splitFieldProps` and `usePublishField` (with `FieldStateOptions`, `UseFieldOptions`, `FieldEntry` and `FieldKind`) are exported from the package root, so fields from other packages get Inertia `useForm()` data, reset, `ConditionalWrapper` and errors like the built-in ones. New docs page: Custom fields.
5 changes: 5 additions & 0 deletions .changeset/date-time-zones.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

Date fields no longer move zone-aware values (Laravel's JSON for date casts, `2024-05-01T00:00:00.000000Z`) into the browser's time zone. `Date` keeps the date as written, and the new `app_timezone` setting (`FormsProvider settings`) shows every date field in the app's time zone.
5 changes: 5 additions & 0 deletions .changeset/docs-and-hidden-panels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

Tab panels stay mounted in every adapter (and accordion items in the HTML and shadcn adapters), so fields in other tabs keep their values and submit, as in Blade. The tab or item with an invalid field opens when errors arrive. New for adapters: `TabPanel` and `useReveal`. `Textarea wysiwyg` passes `className` and `onChange` on. The docs are rewritten for the adapter-based API, with `llms.txt`, an API reference, an upgrade guide from `@javaabu/react-forms`, and a Laravel Boost guideline and skill (`javaabu-react-forms`).
5 changes: 5 additions & 0 deletions .changeset/filter-submit-export-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

`FilterSubmit export={["csv", "xlsx"]}` submits the format (`download=csv`) instead of the list index.
5 changes: 5 additions & 0 deletions .changeset/i18n-strings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

Strings now come from `@javaabu/i18n` under the Blade package's keys (`forms::strings.nothing_selected`), so apps change them in `lang/vendor/forms/{locale}/strings.php` as they do for the Blade components. Generated labels go through `__()` by default. The locale follows `@javaabu/i18n` (`<html lang>`, `setLocale()`) instead of Onu's. `FormsProvider messages` is gone, and the string keys are now snake_case like Blade's (`t("nothing_selected")`).
5 changes: 5 additions & 0 deletions .changeset/icon-prototype-names.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

`Icon` (and `startIcon` / `endIcon`) no longer crashes on names like `constructor` or `toString`: they render as icon font classes.
5 changes: 5 additions & 0 deletions .changeset/inertia.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

New `@javaabu/forms/inertia`. `<FormsProvider router={inertia}>` submits every form as an Inertia visit, with files, method spoofing, error bags, progress, `preserveScroll` / `preserveState` (default `"errors"`) and `resetOnSuccess`. Errors and old input come from the page props. `<Form form={useForm(…)}>` binds the fields to `useForm` data, nested names and checkbox groups included. `inertiaLinks` puts Inertia's `Link` in the `Link` slot. Without Inertia, `fetchRouter` submits JSON requests and shows 422 errors. `@inertiajs/react` (v2 or v3) is an optional peer dependency.
5 changes: 0 additions & 5 deletions .changeset/initial-release.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/listing-ssr-url.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

Listing components (sortable headings, `Filter`, `PerPage`, `SearchForm`, `BulkActions`, `Pagination`) no longer read `window.location` while rendering, so Inertia SSR pages hydrate without a mismatch. They read the URL from the router's new `useUrl()` hook (the Inertia router returns `usePage().url`) or the new `FormsProvider url`, else the browser's URL after hydration. `usePageUrl()` and `usePageQuery()` expose it.
5 changes: 5 additions & 0 deletions .changeset/loading-buttons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

Submit buttons of the HTML and shadcn adapters submit again with `animate`. While loading, they use `aria-disabled` and ignore clicks instead of `disabled`, because a button disabled during its own click doesn't submit the form. The shadcn adapter now styles `Form`, `DescriptionList`, `DescriptionItem` and `EmptyState`, and lays out `inline` fields side by side. New example pages for Inertia and fetch, with a mock Laravel endpoint.
5 changes: 5 additions & 0 deletions .changeset/map-input-sync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

`MapInput` follows a model that loads later and changed `lat`, `lng`, `radius` and `polygon` props, and returns to its starting values when the form resets.
5 changes: 5 additions & 0 deletions .changeset/number-decimals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

`Number`, `Latitude` and `Longitude` with `decimals` now submit the rounded value they report: the HTML and shadcn adapters show it once the input loses focus, and the Onu adapter rounds what it reports. The conformance kit checks it.
5 changes: 5 additions & 0 deletions .changeset/onu-accordion-mounted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

Onu adapter: closed accordion items stay mounted (hidden), so their fields submit, and an item opens when a field inside has an error. The conformance kit's accordion case now runs for Onu.
5 changes: 5 additions & 0 deletions .changeset/onu-map-multipolygon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

Onu maps: every polygon of a bound `MULTIPOLYGON` boundary can be edited, not just the first. A single boundary still draws one polygon, as in Blade.
5 changes: 5 additions & 0 deletions .changeset/onu-summary-select.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

Onu adapter: error summary links focus nested fields (`items.0.name`) and open the tab or accordion item that holds the field, like the other adapters.
5 changes: 5 additions & 0 deletions .changeset/parity-v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

Parity with javaabu/forms v2. `Form summary` now defaults to `false`, as in Blade; a general message (a failed submit) still shows at the top. `Errors` and `ErrorSummary` take `bag`. `Textarea wysiwyg` renders the rich text editor. New strings: `per_page` (the `PerPage` default label), `export_title` and `export_options`. The parity matrix is in `docs/parity.md`.
5 changes: 5 additions & 0 deletions .changeset/portable-declarations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

Installing from Git no longer fails in CI when pnpm's store is inside `node_modules` (TS2883 during the `prepare` build). `Wysiwyg`, and the Onu editor and maps slots, have explicit return types.
5 changes: 5 additions & 0 deletions .changeset/rename-to-javaabu-forms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

Renamed from `@javaabu/react-forms` to `@javaabu/forms`. The package now ships CommonJS next to ESM, and builds itself when installed from Git (`github:Javaabu/react-forms#next-gen`).
5 changes: 5 additions & 0 deletions .changeset/reset-on-success-names.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

A field that a `resetOnSuccess` list leaves out keeps its value, even after an earlier reset of every field.
5 changes: 5 additions & 0 deletions .changeset/rtl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

The HTML adapter flips side-pointing arrows in right-to-left pages. Thaana typing (`thaana`) is documented and tested for every adapter. Dhivehi lines that need a native speaker's review are listed in `docs/advanced-usage/dhivehi-and-rtl.md`.
5 changes: 5 additions & 0 deletions .changeset/script-tag-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

A `<script>` tag build, `dist/forms.iife.js` (also the package's `unpkg`/`jsdelivr` file and `@javaabu/forms/browser`). It puts every component and the plain HTML adapter on `window.JavaabuForms`, with React, ReactDOM and `@javaabu/i18n` bundled in, plus `h` (`React.createElement`) and `mount(target, node, providerProps)`, so pages without a bundler can use the forms. `examples/script-tag.html` shows it in Dhivehi.
5 changes: 5 additions & 0 deletions .changeset/set-in-arrays.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

Fields named like `items[0][name]` create arrays in `useForm()` data (`{ items: [{ name }] }`) instead of objects keyed `"0"`.
5 changes: 5 additions & 0 deletions .changeset/shadcn-accordion-hidden.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

shadcn adapter: closed accordion panels are hidden again. They stay mounted, so their fields still submit.
5 changes: 5 additions & 0 deletions .changeset/shadcn-clear-select.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

shadcn adapter: a clearable simple `Select` (an optional one with a placeholder, or `clearable`) shows a Clear button beside the trigger.
5 changes: 5 additions & 0 deletions .changeset/shadcn-empty-radio.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

shadcn adapter: a `Radio` with `value=""` is no longer always checked.
5 changes: 5 additions & 0 deletions .changeset/shadcn-modal-trigger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

shadcn adapter: a `Modal`'s `trigger` opens it when `DialogTrigger` isn't passed to `createShadcnAdapter`, instead of not rendering.
5 changes: 5 additions & 0 deletions .changeset/shadcn-remote-label.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

shadcn adapter: a remote (`isAjax`) select keeps the picked option's label after the search changes, instead of showing its id.
5 changes: 5 additions & 0 deletions .changeset/shadcn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

New `@javaabu/forms/shadcn`: `createShadcnAdapter({ Button, Input, Label, … })` makes an adapter from the app's own shadcn/ui components. Slots whose components are missing fall back to plain HTML. Searchable, multiple, tag and server-searched selects use the shadcn combobox (`Popover` + `Command`). Radios in a group now update together with any adapter, Radix's button radios included.
5 changes: 5 additions & 0 deletions .changeset/submit-spinner-reset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

`Submit`'s spinner no longer sticks when a native submit doesn't leave the page: it stops on `pageshow` (back-forward cache) and when a handler prevented the submit.
5 changes: 5 additions & 0 deletions .changeset/table-selection-rows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

`useTableSelection().selected` no longer keeps the ids of rows that left the table (pagination with the table still mounted).
5 changes: 5 additions & 0 deletions .changeset/table-selection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

`useTableSelection()` gives content inside a `Table` (its `bulkForm`, rows, …) the selected and page row ids and `setSelected()`. `bulkForm` content is now inside the table's context.
5 changes: 5 additions & 0 deletions .changeset/ui-agnostic-core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

The core no longer depends on Onu. Components render through an adapter: `<FormsProvider ui={onu}>` with `onu` from `@javaabu/forms/onu`, and `components={{ Select: MySelect }}` replaces single components for the whole app or one form. Without an adapter, components render plain HTML (`@javaabu/forms/html`). `Wysiwyg` and `MapInput` are now in the main entry. Onu's editor and maps come from `@javaabu/forms/onu/editor` and `/onu/maps`, combined with `mergeAdapters(onu, onuEditor, onuMaps)`. The `./editor` and `./maps` entries are gone. Onu is now an optional peer dependency (`^0.2.1`).
5 changes: 5 additions & 0 deletions .changeset/url-controlled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

A controlled `Url` now reports the `https://` it adds on blur through `onChange`.
5 changes: 5 additions & 0 deletions .changeset/use-form-choices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

A radio's or checkbox's `default` (or bound model value) no longer overrides data that `useForm()` already holds. The store wins, as it does for value fields.
5 changes: 5 additions & 0 deletions .changeset/use-form-files-hidden.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

`File`, `Image`, `Hidden` and `MapInput` now write to `useForm()` data, so `<Form form={useForm(…)}>` uploads picked files and submits hidden fields (a multi-select's `sync_<name>`, `MapInput`'s coordinates and boundary). Controlled fields write their `value` too, and a reset clears a picked file.
5 changes: 5 additions & 0 deletions .changeset/use-form-transform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": patch
---

`<Form form={useForm(…)}>` no longer replaces your `form.transform()` on every submit. It sets a transform only to add `_method` to a multipart `PUT` / `PATCH` / `DELETE`.
5 changes: 5 additions & 0 deletions .changeset/wayfinder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@javaabu/forms": minor
---

`Form action` accepts Laravel Wayfinder routes: route objects (`store()`), form variants (`update.form(user)`) and route functions (`update`, called with the form's `model`). The route's method is used unless `method` is set, with `_method` spoofing for `PUT`, `PATCH` and `DELETE`. Nothing extra is needed to install.
67 changes: 63 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,81 @@ name: CI

on:
push:
branches: [main]
branches: [main, next-gen]
pull_request:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
check:
name: Lint, typecheck, test, build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm format:check
- run: pnpm typecheck
- run: pnpm test
- name: Unit tests with coverage
run: pnpm test:coverage
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
files: coverage/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- run: pnpm build
- name: Script tag build
run: pnpm test:browser-build
- name: Examples
run: pnpm examples:build

git-install:
name: Install from Git (store under node_modules)
# Apps install `github:Javaabu/react-forms#next-gen`, so pnpm builds the package (`prepare`) in a temp
# folder inside its store. On GitHub Actions that store is under `node_modules`, which once broke
# declaration emit (TS2883, #20). Install this commit the same way, into a fresh app.
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v5
with:
node-version: 22
# This job installs into its own store, so there's nothing to cache. With the cache on, setup-node
# fails its post step when no earlier cache was restored, because the default store doesn't exist.
package-manager-cache: false
- name: Install @javaabu/forms from Git into a new app
env:
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
app="$RUNNER_TEMP/app"
mkdir -p "$app" && cd "$app"
cat > package.json <<JSON
{
"name": "git-install-check",
"private": true,
"type": "module",
"dependencies": {
"@javaabu/forms": "github:${{ github.repository }}#$SHA",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"pnpm": { "onlyBuiltDependencies": ["@javaabu/forms", "@javaabu/i18n"] }
}
JSON
pnpm install --store-dir "$RUNNER_TEMP/store/node_modules/.pnpm-store"
test -f node_modules/@javaabu/forms/dist/index.d.ts
node -e 'const f = require("@javaabu/forms"); if (typeof f.Form !== "function") process.exit(1)'
node --input-type=module -e 'import { Form } from "@javaabu/forms"; import { html } from "@javaabu/forms/html"; if (typeof Form !== "function" || html.name !== "html") process.exit(1)'
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

# On every push to main, changesets/action either opens (or updates) a "Version Packages" PR that
# applies the pending .changeset/*.md files (version bump + CHANGELOG.md), or, once that PR is
# merged and no changesets are left, builds and publishes to npm and tags the release.

on:
push:
branches: [main]

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

permissions:
contents: write # push the version branch and the release tag
pull-requests: write # open the "Version Packages" PR
id-token: write # npm provenance

jobs:
release:
name: Version or publish
runs-on: ubuntu-latest
if: github.repository == 'Javaabu/react-forms'
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
registry-url: https://registry.npmjs.org
- run: pnpm install --frozen-lockfile
# The same checks as CI: nothing is published from a broken main.
- run: pnpm check
- name: Version PR or publish
uses: changesets/action@v1
with:
version: pnpm changeset version
publish: pnpm release
commit: Version Packages
title: Version Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ coverage
pnpm-lock.yaml
CHANGELOG.md
docs
examples/dist
test/shadcn/ui
Loading
Loading