From a2c278515f571eeeffaa461a939c3656cb423e4c Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Thu, 27 Mar 2025 17:06:50 +1100 Subject: [PATCH] build(typebox-validator): lint published package (#1066) --- .github/workflows/ci-typebox-validator.yml | 1 + packages/typebox-validator/package.json | 36 +++++++++++++------- packages/typebox-validator/tsconfig.cjs.json | 8 ----- packages/typebox-validator/tsconfig.esm.json | 8 ----- packages/typebox-validator/tsconfig.json | 4 +-- yarn.lock | 4 ++- 6 files changed, 28 insertions(+), 33 deletions(-) delete mode 100644 packages/typebox-validator/tsconfig.cjs.json delete mode 100644 packages/typebox-validator/tsconfig.esm.json diff --git a/.github/workflows/ci-typebox-validator.yml b/.github/workflows/ci-typebox-validator.yml index f46078cb..c5e22d27 100644 --- a/.github/workflows/ci-typebox-validator.yml +++ b/.github/workflows/ci-typebox-validator.yml @@ -19,6 +19,7 @@ jobs: node-version: 18.x - run: yarn workspaces focus hono-middleware @hono/typebox-validator - run: yarn workspace @hono/typebox-validator build + - run: yarn workspace @hono/typebox-validator publint - run: yarn test --coverage --project @hono/typebox-validator - uses: codecov/codecov-action@v5 with: diff --git a/packages/typebox-validator/package.json b/packages/typebox-validator/package.json index 31bd6562..8f9d6ec6 100644 --- a/packages/typebox-validator/package.json +++ b/packages/typebox-validator/package.json @@ -2,22 +2,29 @@ "name": "@hono/typebox-validator", "version": "0.3.2", "description": "Validator middleware using TypeBox", - "types": "dist/esm/index.d.ts", + "type": "module", + "module": "dist/index.js", + "types": "dist/index.d.ts", "exports": { - "import": "./dist/esm/index.js", - "require": "./dist/cjs/index.js", - "types": "./dist/esm/index.d.ts" + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } + } }, "files": [ "dist" ], "scripts": { - "test": "vitest", - "build:cjs": "tsc -p tsconfig.cjs.json", - "build:esm": "tsc -p tsconfig.esm.json && echo '{\"type\": \"module\"}' > dist/esm/package.json", - "build": "rimraf dist && yarn build:cjs && yarn build:esm", - "prerelease": "yarn build && yarn test", - "release": "yarn publish" + "build": "tsup ./src/index.ts", + "prepack": "yarn build", + "publint": "attw --pack && publint", + "test": "vitest" }, "license": "MIT", "publishConfig": { @@ -26,7 +33,8 @@ }, "repository": { "type": "git", - "url": "https://github.com/honojs/middleware.git" + "url": "git+https://github.com/honojs/middleware.git", + "directory": "packages/typebox-validator" }, "homepage": "https://github.com/honojs/middleware", "peerDependencies": { @@ -34,9 +42,11 @@ "hono": ">=3.9.0" }, "devDependencies": { + "@arethetypeswrong/cli": "^0.17.4", "@sinclair/typebox": "^0.31.15", "hono": "^3.11.7", - "rimraf": "^5.0.5", + "publint": "^0.3.9", + "tsup": "^8.4.0", "vitest": "^3.0.8" } -} +} \ No newline at end of file diff --git a/packages/typebox-validator/tsconfig.cjs.json b/packages/typebox-validator/tsconfig.cjs.json deleted file mode 100644 index b8bf50ee..00000000 --- a/packages/typebox-validator/tsconfig.cjs.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "CommonJS", - "declaration": false, - "outDir": "./dist/cjs" - } -} \ No newline at end of file diff --git a/packages/typebox-validator/tsconfig.esm.json b/packages/typebox-validator/tsconfig.esm.json deleted file mode 100644 index 8130f1a5..00000000 --- a/packages/typebox-validator/tsconfig.esm.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "ESNext", - "declaration": true, - "outDir": "./dist/esm" - } -} \ No newline at end of file diff --git a/packages/typebox-validator/tsconfig.json b/packages/typebox-validator/tsconfig.json index efd0b896..dcc1e9e9 100644 --- a/packages/typebox-validator/tsconfig.json +++ b/packages/typebox-validator/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", "types": ["vitest/globals"] - }, - "include": ["src/**/*.ts"] + } } diff --git a/yarn.lock b/yarn.lock index fa2aad02..1c2044d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2932,9 +2932,11 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/typebox-validator@workspace:packages/typebox-validator" dependencies: + "@arethetypeswrong/cli": "npm:^0.17.4" "@sinclair/typebox": "npm:^0.31.15" hono: "npm:^3.11.7" - rimraf: "npm:^5.0.5" + publint: "npm:^0.3.9" + tsup: "npm:^8.4.0" vitest: "npm:^3.0.8" peerDependencies: "@sinclair/typebox": ">=0.31.15 <1"