From 7c0f04486dbd08264a390f2905d66fd19407d3b0 Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Thu, 27 Mar 2025 14:32:05 +1100 Subject: [PATCH] build(qwik-city): lint published package (#1057) * build(qwik-city): lint published package * ci(qwik-city): add workflow to run build and publint --- .github/workflows/ci-qwik-city.yml | 30 +++++++++++++++++++++++++ packages/qwik-city/package.json | 33 +++++++++++++++++++--------- packages/qwik-city/tsconfig.cjs.json | 8 ------- packages/qwik-city/tsconfig.esm.json | 8 ------- packages/qwik-city/tsconfig.json | 9 +++----- yarn.lock | 4 +++- 6 files changed, 59 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/ci-qwik-city.yml delete mode 100644 packages/qwik-city/tsconfig.cjs.json delete mode 100644 packages/qwik-city/tsconfig.esm.json diff --git a/.github/workflows/ci-qwik-city.yml b/.github/workflows/ci-qwik-city.yml new file mode 100644 index 00000000..72cf0247 --- /dev/null +++ b/.github/workflows/ci-qwik-city.yml @@ -0,0 +1,30 @@ +name: ci-qwik-city +on: + push: + branches: [main] + paths: + - 'packages/qwik-city/**' + pull_request: + branches: ['*'] + paths: + - 'packages/qwik-city/**' + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20.x + - run: yarn workspaces focus hono-middleware @hono/qwik-city + - run: yarn workspace @hono/qwik-city build + - run: yarn workspace @hono/qwik-city publint + # - run: yarn test --coverage --project @hono/qwik-city + # - uses: codecov/codecov-action@v5 + # with: + # fail_ci_if_error: true + # directory: ./coverage + # flags: qwik-city + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/packages/qwik-city/package.json b/packages/qwik-city/package.json index 81027df3..18983aee 100644 --- a/packages/qwik-city/package.json +++ b/packages/qwik-city/package.json @@ -2,18 +2,28 @@ "name": "@hono/qwik-city", "version": "0.0.5", "description": "Qwik City middleware for Hono", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/esm/index.d.ts", + "type": "module", + "module": "dist/index.js", + "types": "dist/index.d.ts", "files": [ "dist" ], "scripts": { - "build:cjs": "tsc -p tsconfig.cjs.json", - "build:esm": "tsc -p tsconfig.esm.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" + }, + "exports": { + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } + } }, "license": "MIT", "publishConfig": { @@ -22,7 +32,8 @@ }, "repository": { "type": "git", - "url": "https://github.com/honojs/middleware.git" + "url": "git+https://github.com/honojs/middleware.git", + "directory": "packages/qwik-city" }, "homepage": "https://github.com/honojs/middleware", "peerDependencies": { @@ -31,10 +42,12 @@ "hono": "^3.1.5" }, "devDependencies": { + "@arethetypeswrong/cli": "^0.17.4", "@builder.io/qwik": "^1.2.0", "@builder.io/qwik-city": "^1.2.0", "hono": "^3.11.7", - "rimraf": "^5.0.5" + "publint": "^0.3.9", + "tsup": "^8.4.0" }, "engines": { "node": ">=18" diff --git a/packages/qwik-city/tsconfig.cjs.json b/packages/qwik-city/tsconfig.cjs.json deleted file mode 100644 index b8bf50ee..00000000 --- a/packages/qwik-city/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/qwik-city/tsconfig.esm.json b/packages/qwik-city/tsconfig.esm.json deleted file mode 100644 index 8130f1a5..00000000 --- a/packages/qwik-city/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/qwik-city/tsconfig.json b/packages/qwik-city/tsconfig.json index 6c1a3990..b4e69ae1 100644 --- a/packages/qwik-city/tsconfig.json +++ b/packages/qwik-city/tsconfig.json @@ -1,9 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./src", - }, - "include": [ - "src/**/*.ts" - ], -} \ No newline at end of file + "outDir": "dist" + } +} diff --git a/yarn.lock b/yarn.lock index 241f9600..ef815312 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2777,10 +2777,12 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/qwik-city@workspace:packages/qwik-city" dependencies: + "@arethetypeswrong/cli": "npm:^0.17.4" "@builder.io/qwik": "npm:^1.2.0" "@builder.io/qwik-city": "npm:^1.2.0" hono: "npm:^3.11.7" - rimraf: "npm:^5.0.5" + publint: "npm:^0.3.9" + tsup: "npm:^8.4.0" peerDependencies: "@builder.io/qwik": ^1.2.0 "@builder.io/qwik-city": ^1.2.0