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
14 changes: 14 additions & 0 deletions .github/actions/setup-pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Set up pnpm and Node.js
description: Install pnpm and set up Node.js with a pnpm dependency cache from package.json.

runs:
using: composite
steps:
- name: Set up pnpm
uses: pnpm/action-setup@v6
Comment thread
concertypin marked this conversation as resolved.
Resolved

- name: Set up Node.js with pnpm cache
uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: pnpm
8 changes: 2 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- uses: pnpm/action-setup@v4
with:
version: 10.17.1
- name: Set up pnpm and Node.js
uses: ./.github/actions/setup-pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- id: pages
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm Environment
uses: concertypin/action/pnpm-install@master
- name: Set up pnpm and Node.js
uses: ./.github/actions/setup-pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Buildable test
run: pnpm build
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup pnpm Environment
uses: concertypin/action/pnpm-install@master
- name: Set up pnpm and Node.js
uses: ./.github/actions/setup-pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm run test --reporter=blob --coverage.enabled --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
Expand All @@ -44,8 +47,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup pnpm Environment
uses: concertypin/action/pnpm-install@master
- name: Set up pnpm and Node.js
uses: ./.github/actions/setup-pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Then install the dependencies:
pnpm install
```

`postinstall` registers the git hooks (via `simple-git-hooks`), so run `pnpm install` before your first commit. The pre-commit hook runs the non-mutating `check` script (formatting, lint, and tests); when it fails, apply fixes with `pnpm format` and `pnpm lint`.
`postinstall` registers the git hooks (via `simple-git-hooks`), so run `pnpm install` before your first commit. The pre-commit hook runs `pnpm check`, which formats the project, applies lint fixes, and then runs the tests.

## Conventions and Rules

Expand All @@ -40,11 +40,12 @@ This project follows specific conventions and rules for code style, data validat
Deploy the `dist/` output over HTTP(S). The included deploy workflow
(`.github/workflows/deploy.yml`) builds with the GitHub Pages base path and
publishes the result as a GitHub Pages site. A plain `pnpm build` emits
root-absolute asset URLs (`base: "/"`), so that output serves correctly from a
domain root — a GitHub Pages user site or a custom domain — or via
`pnpm preview`. For a GitHub Pages project site under a subpath
(`https://<user>.github.io/<repo>/`), rebuild with a matching base, e.g.
`pnpm build --base "/<repo>/"`, before deploying `dist/`.
relative asset URLs, so that output serves correctly from a domain root, a
GitHub Pages project site subpath (`https://<user>.github.io/<repo>/`), or via
`pnpm preview`. For History API routing below the domain root, rebuild with the
site's absolute base path, e.g. `pnpm build --base "/<repo>/"`, before
deploying `dist/`, so the router links and the `404.html` fallback shell
resolve against the real mount path.

This template uses clean `BrowserRouter` URLs. GitHub Pages serves the
SPA-bearing `404.html` for a refresh or direct visit to a client route, so React
Expand Down
3 changes: 1 addition & 2 deletions oxlint.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { defineConfig } from "oxlint";
import frontendConfig from "@concertypin/config/oxlint/frontend";
import reactConfig from "./scripts/linter/oxlint-react.ts";
import scriptsConfig from "@concertypin/config/oxlint/scripts";

export default defineConfig({
$schema: "./node_modules/oxlint/configuration_schema.json",
Expand All @@ -24,5 +23,5 @@ export default defineConfig({
typeAware: true,
typeCheck: true,
},
extends: [frontendConfig, reactConfig, scriptsConfig],
extends: [frontendConfig, reactConfig],
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"lint:check": "oxlint .",
"postinstall": "pnpm exec simple-git-hooks",
"preview": "vite preview",
"check": "pnpm run format:check && pnpm run lint:check && pnpm run test",
"check": "pnpm run format && pnpm run lint && pnpm run test",
Comment thread
concertypin marked this conversation as resolved.
Resolved
"test": "vitest run"
},
"engines": {
Expand All @@ -29,7 +29,7 @@
"react-router-dom": "^7.18.1"
},
"devDependencies": {
"@concertypin/config": "^0.1.2",
"@concertypin/config": "^0.2.0",
"@tailwindcss/postcss": "^4.3.2",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const testConfig: Config["test"] = {
};

export default defineConfig({
base: "/",
base: "./",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the router basename absolute in default builds

For a plain pnpm build, Vite substitutes "./" for import.meta.env.BASE_URL, which src/index.tsx passes directly to BrowserRouter as its basename. Because browser pathnames start with / and do not match that relative basename, the built app renders no route at / or /about; the deploy workflow avoids this only because it overrides --base, while the newly documented default build and pnpm preview remain broken. Keep an absolute router basename or decouple it from the relative asset base.

AGENTS.md reference: AGENTS.md:L5-L8

Useful? React with 👍 / 👎.

build: {
outDir: "dist",
rolldownOptions: {
Expand Down
Loading