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
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- run: pnpm run build

- run: pnpm ci-lint
- run: pnpm run ci-lint

- name: Check for uncommitted changes
run: ./scripts/assert-clean-working-directory.sh
Expand All @@ -55,7 +55,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [24.x]
node-version: [26.x]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand Down Expand Up @@ -143,9 +143,9 @@ jobs:

- run: pnpm ci

- run: pnpm integration:clean
- run: pnpm integration:generate --schema-builder ${{ matrix.schema-builder }}
- run: pnpm integration:validate
- run: pnpm run integration:clean
- run: pnpm run integration:generate --schema-builder ${{ matrix.schema-builder }}
- run: pnpm run integration:validate

- name: Check for uncommitted changes
if: ${{ matrix.schema-builder == 'zod-v4' }}
Expand Down Expand Up @@ -177,11 +177,11 @@ jobs:

- run: pnpm ci

- run: SCHEMA_BUILDER=zod-v3 pnpm e2e:generate
- run: pnpm e2e:validate
- run: SCHEMA_BUILDER=zod-v3 pnpm run e2e:generate
- run: pnpm run e2e:validate

- run: SCHEMA_BUILDER=zod-v4 pnpm e2e:generate
- run: pnpm e2e:validate
- run: SCHEMA_BUILDER=zod-v4 pnpm run e2e:generate
- run: pnpm run e2e:validate

- name: Check for uncommitted changes
run: ./scripts/assert-clean-working-directory.sh
18 changes: 9 additions & 9 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ This is a monorepo managed with `pnpm`. It produces a CLI tool for generating hi

### Common Commands
- **Install**: `pnpm install`
- **Build**: `pnpm build` (generates validators, bundles packages, and runs `tsc -b`).
- **Lint/Format**: `pnpm lint` (uses Biome). For CI-style checks, use `pnpm ci-lint`.
- **Unit Tests**: `pnpm test` (uses Vitest). For coverage, use `pnpm ci-test`.
- **Build**: `pnpm run build` (generates validators, bundles packages, and runs `tsc -b`).
- **Lint/Format**: `pnpm run lint` (uses Biome). For CI-style checks, use `pnpm run ci-lint`.
- **Unit Tests**: `pnpm run test` (uses Vitest). For coverage, use `pnpm run ci-test`.
- **Integration Tests**:
- Generate: `pnpm integration:generate`
- Validate/Build: `pnpm integration:validate`
- Generate: `pnpm run integration:generate`
- Validate/Build: `pnpm run integration:validate`
- **E2E Tests**:
- Generate: `pnpm e2e:generate`
- Validate: `pnpm e2e:validate`
- **Full Pipeline**: `pnpm ci-pipeline` (runs all checks locally).
- Generate: `pnpm run e2e:generate`
- Validate: `pnpm run e2e:validate`
- **Full Pipeline**: `pnpm run ci-pipeline` (runs all checks locally).

## Testing Standards

Expand All @@ -44,7 +44,7 @@ This is a monorepo managed with `pnpm`. It produces a CLI tool for generating hi
```typescript
import {describe, expect, it} from "vitest"
```
- **Regression**: Always ensure `pnpm integration:validate` passes after changes to generation logic.
- **Regression**: Always ensure `pnpm run integration:validate` passes after changes to generation logic.

## Project Structure

Expand Down
6 changes: 3 additions & 3 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ graph TD
4. **Add Unit Tests**: Add a `.spec.ts` next to the modified file.
5. **Add Integration Spec**: If the feature is a new OpenAPI concept, add a minimal reproduction spec to `integration-tests-definitions`.
6. **Run Pipeline**:
- `pnpm build`
- `pnpm integration:generate`
- `pnpm integration:validate`
- `pnpm run build`
- `pnpm run integration:generate`
- `pnpm run integration:validate`
7. **Documentation**: Update the external documentation in `packages/documentation` if user-facing.

## Common Gotchas
Expand Down
8 changes: 4 additions & 4 deletions e2e/scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ set -e

SCHEMA_BUILDER="${SCHEMA_BUILDER:-zod-v4}"

pnpm openapi-code-generator \
pnpm exec openapi-code-generator \
--input ./openapi.yaml \
--output ./src/generated/server/koa \
--template typescript-koa \
--schema-builder "$SCHEMA_BUILDER" \
--extract-inline-schemas \
--grouping-strategy first-tag

pnpm openapi-code-generator \
pnpm exec openapi-code-generator \
--input ./openapi.yaml \
--output ./src/generated/server/express \
--template typescript-express \
--schema-builder "$SCHEMA_BUILDER" \
--extract-inline-schemas \
--grouping-strategy first-tag

pnpm openapi-code-generator \
pnpm exec openapi-code-generator \
--input ./openapi.yaml \
--output ./src/generated/client/fetch \
--template typescript-fetch \
Expand All @@ -29,7 +29,7 @@ pnpm openapi-code-generator \
--enable-runtime-response-validation \
--override-specification-title "E2E Test Client"

pnpm openapi-code-generator \
pnpm exec openapi-code-generator \
--input ./openapi.yaml \
--output ./src/generated/client/axios \
--template typescript-axios \
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/vitest.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {CustomMatcherResult} from "expect"

declare module "vitest" {
interface Assertion<T = any> {
interface Assertion<T = unknown> {
toEqualBlob(expected: Blob): Promise<CustomMatcherResult>
}
interface AsymmetricMatchersContaining {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ${notes.join("\n")}

fs.writeFileSync(
path.resolve(
__dirname,
import.meta.dirname,
"../../../packages/documentation/src/app/reference/release-notes/page.mdx",
),
result.replace(/\r\n/g, "\n"),
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
"url": "https://github.com/mnahkies/openapi-code-generator/issues"
},
"scripts": {
"clean": "pnpm -r clean",
"clean": "pnpm run -r clean",
"docs:generate": "node ./scripts/generate-toc.mjs",
"refresh": "./scripts/refresh-data.sh",
"lint": "biome check --fix .",
"build": "node ./scripts/generate-ajv-validator.js && pnpm -r --workspace-concurrency=4 run bundle && tsc -b tsconfig.json",
"build": "node ./scripts/generate-ajv-validator.js && pnpm run -r --workspace-concurrency=4 bundle && tsc -b tsconfig.json",
"build:docs": "pnpm --filter @nahkies/openapi-code-generator-documentation run build",
"build:watch": "tsc -b tsconfig.json -w",
"test": "vitest run",
"integration:clean": "pnpm --filter @integration/* run clean",
"integration:generate": "node ./scripts/generate.mjs",
"integration:validate": "pnpm -r --filter @integration/* --workspace-concurrency=2 run validate",
"integration:validate": "pnpm run -r --filter @integration/* --workspace-concurrency=2 validate",
"e2e:generate": "pnpm --filter e2e run clean && pnpm --filter e2e run generate",
"e2e:validate": "pnpm --filter e2e run build && pnpm --filter e2e run test",
"ci-test": "vitest run --coverage",
Expand Down Expand Up @@ -70,11 +70,11 @@
],
"lint-staged": {
"*.{ts,js,tsx,jsx,mts,mjs,cts,cjs}": [
"pnpm biome lint --write --no-errors-on-unmatched",
"pnpm biome check --write --no-errors-on-unmatched"
"pnpm exec biome lint --write --no-errors-on-unmatched",
"pnpm exec biome check --write --no-errors-on-unmatched"
],
"*.md": [
"sh -c 'pnpm docs:generate'"
"sh -c 'pnpm run docs:generate'"
]
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ It's hosted at https://openapi-code-generator.nahkies.co.nz/ using GitHub pages.
Run the development server with the `dev` script:

```shell
pnpm dev
pnpm run dev
```

Open <http://localhost:3000> with your browser to see the result.
Expand Down
10 changes: 5 additions & 5 deletions packages/documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
},
"scripts": {
"clean": "rm -rf ./.next ./dist",
"dev": "pnpm copy-sample-data && next dev",
"build": "pnpm copy-sample-data && next build",
"lint": "pnpm -w lint",
"copy-sample-data": "tsx ./scripts/copy-sample-data.ts",
"publish:gh-pages": "pnpm gh-pages -d ./dist -b gh-pages --cname openapi-code-generator.nahkies.co.nz --nojekyll"
"dev": "pnpm run copy-sample-data && next dev",
"build": "pnpm run copy-sample-data && next build",
"lint": "pnpm run -w lint",
"copy-sample-data": "pnpm exec tsx ./scripts/copy-sample-data.ts",
"publish:gh-pages": "pnpm exec gh-pages -d ./dist -b gh-pages --cname openapi-code-generator.nahkies.co.nz --nojekyll"
},
"dependencies": {
"@hookform/resolvers": "^5.4.0",
Expand Down
Loading