From 5f4572f5b896061bf9bd40d8534291c3821b47e0 Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Thu, 27 Mar 2025 13:43:10 +1100 Subject: [PATCH] build(prometheus): lint published package (#1056) --- .github/workflows/ci-prometheus.yml | 1 + packages/prometheus/package.json | 32 ++++++++++++++++++----------- packages/prometheus/tsconfig.json | 9 +++----- yarn.lock | 4 +++- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci-prometheus.yml b/.github/workflows/ci-prometheus.yml index 11224351..7c046732 100644 --- a/.github/workflows/ci-prometheus.yml +++ b/.github/workflows/ci-prometheus.yml @@ -19,6 +19,7 @@ jobs: node-version: 18.x - run: yarn workspaces focus hono-middleware @hono/prometheus - run: yarn workspace @hono/prometheus build + - run: yarn workspace @hono/prometheus publint - run: yarn test --coverage --project @hono/prometheus - uses: codecov/codecov-action@v5 with: diff --git a/packages/prometheus/package.json b/packages/prometheus/package.json index 36e07c38..abfa031f 100644 --- a/packages/prometheus/package.json +++ b/packages/prometheus/package.json @@ -2,23 +2,28 @@ "name": "@hono/prometheus", "version": "1.0.1", "description": "Prometheus metrics middleware for Hono", - "main": "dist/index.js", - "module": "dist/index.mjs", + "type": "module", + "module": "dist/index.js", "types": "dist/index.d.ts", "files": [ "dist" ], "scripts": { - "test": "vitest --run", - "build": "tsup ./src/index.ts --format esm,cjs --dts", - "publint": "publint", - "release": "yarn build && yarn test && yarn publint && yarn publish" + "build": "tsup ./src/index.ts", + "prepack": "yarn build", + "publint": "attw --pack && publint", + "test": "vitest" }, "exports": { ".": { - "types": "./dist/index.d.mts", - "import": "./dist/index.mjs", - "require": "./dist/index.js" + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } } }, "license": "MIT", @@ -28,7 +33,8 @@ }, "repository": { "type": "git", - "url": "https://github.com/honojs/middleware.git" + "url": "git+https://github.com/honojs/middleware.git", + "directory": "packages/prometheus" }, "homepage": "https://github.com/honojs/middleware", "peerDependencies": { @@ -36,9 +42,11 @@ "prom-client": "^15.0.0" }, "devDependencies": { + "@arethetypeswrong/cli": "^0.17.4", "hono": "^4.2.7", "prom-client": "^15.0.0", - "tsup": "^8.0.1", + "publint": "^0.3.9", + "tsup": "^8.4.0", "vitest": "^3.0.8" } -} +} \ No newline at end of file diff --git a/packages/prometheus/tsconfig.json b/packages/prometheus/tsconfig.json index acfcd843..103e4e38 100644 --- a/packages/prometheus/tsconfig.json +++ b/packages/prometheus/tsconfig.json @@ -1,10 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", "outDir": "./dist", - }, - "include": [ - "src/**/*.ts" - ], -} \ No newline at end of file + "types": ["vitest/globals"] + } +} diff --git a/yarn.lock b/yarn.lock index 72473857..241f9600 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2761,9 +2761,11 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/prometheus@workspace:packages/prometheus" dependencies: + "@arethetypeswrong/cli": "npm:^0.17.4" hono: "npm:^4.2.7" prom-client: "npm:^15.0.0" - tsup: "npm:^8.0.1" + publint: "npm:^0.3.9" + tsup: "npm:^8.4.0" vitest: "npm:^3.0.8" peerDependencies: hono: ">=3.*"