From 5234436db89fd6de1623902869d9362c5b4fbc71 Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Thu, 27 Mar 2025 14:56:33 +1100 Subject: [PATCH] build(oidc-auth): lint published package (#1054) * build(oidc-auth): lint published package * build(oidc-auth): include require condition in subpath exports --- .github/workflows/ci-oidc-auth.yml | 1 + packages/oidc-auth/package.json | 22 ++++++++++++++-------- packages/oidc-auth/tsconfig.json | 4 +--- yarn.lock | 5 +++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-oidc-auth.yml b/.github/workflows/ci-oidc-auth.yml index 40ef352f..d9636eb7 100644 --- a/.github/workflows/ci-oidc-auth.yml +++ b/.github/workflows/ci-oidc-auth.yml @@ -19,6 +19,7 @@ jobs: node-version: 20.x - run: yarn workspaces focus hono-middleware @hono/oidc-auth - run: yarn workspace @hono/oidc-auth build + - run: yarn workspace @hono/oidc-auth publint - run: yarn test --coverage --project @hono/oidc-auth - uses: codecov/codecov-action@v5 with: diff --git a/packages/oidc-auth/package.json b/packages/oidc-auth/package.json index b929955d..5ee98b06 100644 --- a/packages/oidc-auth/package.json +++ b/packages/oidc-auth/package.json @@ -3,22 +3,26 @@ "version": "1.6.0", "description": "OpenID Connect Authentication middleware for Hono", "type": "module", - "main": "dist/index.js", + "module": "dist/index.js", "types": "dist/index.d.ts", "files": [ "dist" ], "scripts": { - "test": "vitest", - "build": "tsup ./src/index.ts --format esm --dts", - "prerelease": "yarn build && yarn test", - "release": "yarn prerelease && yarn npm publish" + "build": "tsup ./src/index.ts", + "prepack": "yarn build", + "publint": "attw --pack && publint", + "test": "vitest" }, "exports": { ".": { "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" } } }, @@ -29,18 +33,20 @@ }, "repository": { "type": "git", - "url": "https://github.com/honojs/middleware.git" + "url": "git+https://github.com/honojs/middleware.git", + "directory": "packages/oidc-auth" }, "homepage": "https://github.com/honojs/middleware", "peerDependencies": { "hono": ">=3.*" }, "devDependencies": { + "@arethetypeswrong/cli": "^0.17.4", "@types/jsonwebtoken": "^9.0.5", "hono": "^4.0.1", "jsonwebtoken": "^9.0.2", - "tsup": "^8.0.1", - "typescript": "^5.3.3", + "publint": "^0.3.9", + "tsup": "^8.4.0", "vitest": "^3.0.8" }, "dependencies": { diff --git a/packages/oidc-auth/tsconfig.json b/packages/oidc-auth/tsconfig.json index f375b769..26687d28 100644 --- a/packages/oidc-auth/tsconfig.json +++ b/packages/oidc-auth/tsconfig.json @@ -2,9 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "module": "ESNext", - "rootDir": "./src", "outDir": "./dist", "types": ["vitest/globals"] - }, - "include": ["src/**/*.ts"] + } } diff --git a/yarn.lock b/yarn.lock index ef815312..d218b4d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2727,12 +2727,13 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/oidc-auth@workspace:packages/oidc-auth" dependencies: + "@arethetypeswrong/cli": "npm:^0.17.4" "@types/jsonwebtoken": "npm:^9.0.5" hono: "npm:^4.0.1" jsonwebtoken: "npm:^9.0.2" oauth4webapi: "npm:^2.6.0" - tsup: "npm:^8.0.1" - typescript: "npm:^5.3.3" + publint: "npm:^0.3.9" + tsup: "npm:^8.4.0" vitest: "npm:^3.0.8" peerDependencies: hono: ">=3.*"