Skip to content

Commit

Permalink
feat: Bump swagger, switch to vitest (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper authored Nov 18, 2024
1 parent 103bff4 commit 5b2b7d5
Show file tree
Hide file tree
Showing 8 changed files with 3,535 additions and 8,361 deletions.
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"root": true,
"env": {
"node": true,
"jest": true
"node": true
},
"extends": ["@ctrl/eslint-config"]
}
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- run: npm ci

- uses: wyvox/action-setup-pnpm@v3
with: { node-version: 22, pnpm-version: 9 }

- name: lint
run: npm run lint
run: pnpm run lint

- name: test
run: npm run test:ci
run: pnpm run test:ci

- name: coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -38,11 +39,10 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- run: npm ci

- uses: wyvox/action-setup-pnpm@v3
with: { node-version: 22, pnpm-version: 9 }

- name: release
run: npx semantic-release
env:
Expand Down
6 changes: 2 additions & 4 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { HelperDelegate, HelperOptions } from 'handlebars';
import * as Handlebars from 'handlebars';
import type { Context, Middleware, Next } from 'koa';
import { defaultsDeep } from 'lodash';
import { sync as readPkgUpSync } from 'read-pkg-up';
import { sync as readPackageUpSync } from 'read-pkg-up';

export interface SwaggerOptions {
[key: string]:
Expand Down Expand Up @@ -34,7 +34,6 @@ export interface SwaggerOptions {

export interface KoaSwaggerUiOptions {
title: string;
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
oauthOptions: boolean | any;
swaggerOptions: SwaggerOptions;
swaggerVersion: string;
Expand Down Expand Up @@ -69,7 +68,7 @@ export function koaSwagger(
config: Partial<KoaSwaggerUiOptions> = {},
): Middleware {
if (config.swaggerVersion === undefined) {
const pkg = readPkgUpSync({ cwd: __dirname });
const pkg = readPackageUpSync({ cwd: __dirname });
if (pkg === undefined) {
throw new Error('Package not found');
}
Expand All @@ -86,7 +85,6 @@ export function koaSwagger(
const options: KoaSwaggerUiOptions = defaultsDeep(config, defaultOptions);

const specPrefixRegex = new RegExp(`${options.specPrefix}[/]*$`, 'i');
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
const routePrefixRegex = new RegExp(`${options.routePrefix}[/]*$`, 'i');

Handlebars.registerHelper('json', (context) => JSON.stringify(context));
Expand Down
Loading

0 comments on commit 5b2b7d5

Please sign in to comment.