From d56cf67b85473d611edde14ff8e1b46d12aa7c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D7=A0=CF=85=CE=B1=CE=B7=20=D7=A0=CF=85=CE=B1=CE=B7=D1=95?= =?UTF-8?q?=CF=83=CE=B7?= Date: Fri, 27 Mar 2026 22:10:20 -0700 Subject: [PATCH] feat: add react.just shared recipes for React/TypeScript projects Add react.just and react.mod.just with recipes for Bun-based React projects: deps, dev, build, lint, fmt, fmt-check, generate, and test. Mirrors the go.just pattern with JUST_FMT_PATTERN env var for customizing the Prettier glob. Co-Authored-By: Claude Opus 4.6 (1M context) --- README.md | 17 +++++++++++ react.just | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++ react.mod.just | 3 ++ 3 files changed, 99 insertions(+) create mode 100644 react.just create mode 100644 react.mod.just diff --git a/README.md b/README.md index 989a156..3be6ea0 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,23 @@ using `curl`: COPY --from=registry.gitlab.com/osapi-io/osapi-justfiles:latest /*.just .just/remote/ ``` +### react.just + +| Recipe | Description | +|---|---| +| `deps` | Install all dependencies | +| `dev` | Start development server | +| `build` | Production build | +| `lint` | Run ESLint | +| `test` | Run all checks (fmt, lint, build) | +| `fmt` | Auto-format with Prettier | +| `fmt-check` | Check formatting | +| `generate` | Generate TypeScript SDK with orval | + +**Environment variables:** + +- `JUST_FMT_PATTERN` - Prettier glob pattern (default: `src/**/*.{ts,tsx,css}`) + ### just.just | Recipe | Description | diff --git a/react.just b/react.just new file mode 100644 index 0000000..4b7e167 --- /dev/null +++ b/react.just @@ -0,0 +1,79 @@ +# Copyright (c) 2026 John Dewey +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# React recipes for osapi-io projects. +# +# These recipes use Bun as the package manager and script runner. Prettier +# handles formatting and ESLint handles linting, both configured by the +# consuming project. +# +# Projects can extend these by defining their own recipes that depend on +# the `react::` namespace. + +fmt_pattern := env("JUST_FMT_PATTERN", "src/**/*.{ts,tsx,css}") + +# --- Setup --- + +# Install all dependencies +[group('setup')] +deps: + bun install + +# --- Dev --- + +# Start development server +[group('dev')] +dev: + bun run dev + +# --- Build --- + +# Production build +[group('build')] +build: + bun run build + +# --- Lint --- + +# Report likely mistakes in source +[group('lint')] +lint: + bun run lint + +# --- Test --- + +# Test all (fmt check, lint, build) +[group('test')] +test: fmt-check lint build + +# --- Fmt --- + +# Reformat source with Prettier +[group('fmt')] +fmt: + bunx prettier --write "{{ fmt_pattern }}" + +# Check source formatting +[group('fmt')] +fmt-check: + bunx prettier --check "{{ fmt_pattern }}" + +# --- Codegen --- + +# Generate TypeScript SDK from OpenAPI spec +[group('codegen')] +generate: + npx orval diff --git a/react.mod.just b/react.mod.just new file mode 100644 index 0000000..f521eda --- /dev/null +++ b/react.mod.just @@ -0,0 +1,3 @@ +set working-directory := '../..' + +import? 'react.just'