diff --git a/.github/actions/setup-pnpm/action.yml b/.github/actions/setup-pnpm/action.yml new file mode 100644 index 0000000..b5ea6cb --- /dev/null +++ b/.github/actions/setup-pnpm/action.yml @@ -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 + + - name: Set up Node.js with pnpm cache + uses: actions/setup-node@v4 + with: + node-version-file: package.json + cache: pnpm diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 01a868b..4f35590 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5fb1561..b2f5bb7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1045ccb..9bf398c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 }} @@ -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 diff --git a/README.md b/README.md index 684eb79..bb44ffc 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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://.github.io//`), rebuild with a matching base, e.g. -`pnpm build --base "//"`, before deploying `dist/`. +relative asset URLs, so that output serves correctly from a domain root, a +GitHub Pages project site subpath (`https://.github.io//`), 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 "//"`, 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 diff --git a/oxlint.config.ts b/oxlint.config.ts index 1f94cd6..28edee6 100644 --- a/oxlint.config.ts +++ b/oxlint.config.ts @@ -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", @@ -24,5 +23,5 @@ export default defineConfig({ typeAware: true, typeCheck: true, }, - extends: [frontendConfig, reactConfig, scriptsConfig], + extends: [frontendConfig, reactConfig], }); diff --git a/package.json b/package.json index 3c19808..4cf10b7 100644 --- a/package.json +++ b/package.json @@ -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", "test": "vitest run" }, "engines": { @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c9b1b72..f9876d8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,8 +19,8 @@ importers: version: 7.18.2(react-dom@19.2.8(react@19.2.8))(react@19.2.8) devDependencies: '@concertypin/config': - specifier: ^0.1.2 - version: 0.1.2(oxlint@1.76.0(oxlint-tsgolint@0.24.0)) + specifier: ^0.2.0 + version: 0.2.0(oxlint@1.76.0(oxlint-tsgolint@0.24.0)) '@tailwindcss/postcss': specifier: ^4.3.2 version: 4.3.3 @@ -132,8 +132,8 @@ packages: resolution: {integrity: sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==} hasBin: true - '@concertypin/config@0.1.2': - resolution: {integrity: sha512-gNFRio/XcnbuBay96knzkmozbZF7T3VauNiYgMYTs1X+CwAgp4Huq8Jufmv5DdRTgJ9AgcZxvr+SxQttwILw7Q==} + '@concertypin/config@0.2.0': + resolution: {integrity: sha512-ezicM+Ia7NJ/d7FdSEvpWsvm6VPhrjGcP4JNQfFmdTBhqMgyry7aDaczKVlk70fpTq1E3FJ5tsL1pdVA9layxg==} engines: {node: '>=24'} peerDependencies: oxlint: '>=1.47.0 <2' @@ -1441,7 +1441,7 @@ snapshots: dependencies: css-tree: 3.2.1 - '@concertypin/config@0.1.2(oxlint@1.76.0(oxlint-tsgolint@0.24.0))': + '@concertypin/config@0.2.0(oxlint@1.76.0(oxlint-tsgolint@0.24.0))': dependencies: oxlint: 1.76.0(oxlint-tsgolint@0.24.0) diff --git a/vite.config.ts b/vite.config.ts index e34f53b..2a81265 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -50,7 +50,7 @@ const testConfig: Config["test"] = { }; export default defineConfig({ - base: "/", + base: "./", build: { outDir: "dist", rolldownOptions: {