diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..60aa5b8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: [main, develop] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install + + - name: Lint + run: bun run lint + + - name: Build + run: bun run build + + - name: Check package can be published + run: bun pm pack --dry-run diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..baae983 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: Publish to NPM + +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install + + - name: Lint + run: bun run lint + + - name: Build + run: bun run build + + - name: Publish to NPM + run: bun publish + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index a14702c..719223b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # dependencies (bun install) node_modules +package-lock.json # output out diff --git a/README.md b/README.md index c9757ba..1003522 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,26 @@ -# elysia-htmx +# @zeroaurora/elysia-htmx Make it easier to use HTMX headers with Elysia. +## Installation + +```bash +npm install @zeroaurora/elysia-htmx +``` + ## Usage Refer to `example/` for now. Full docs coming later! +## Publishing + +This package is automatically published to npm as `@zeroaurora/elysia-htmx` when a new release is created on GitHub. The publishing workflow will: + +1. Install dependencies +2. Run linting checks +3. Build the package +4. Publish to npm + ## License MIT diff --git a/package.json b/package.json index ffb4b7f..643b687 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,35 @@ { - "name": "elysia-htmx", + "name": "@zeroaurora/elysia-htmx", "type": "module", "version": "0.1.1", + "description": "Make it easier to use HTMX headers with Elysia", + "author": "ZeroAurora", + "license": "MIT", + "homepage": "https://github.com/ZeroAurora/elysia-htmx", + "repository": { + "type": "git", + "url": "https://github.com/ZeroAurora/elysia-htmx.git" + }, + "bugs": { + "url": "https://github.com/ZeroAurora/elysia-htmx/issues" + }, + "keywords": ["elysia", "htmx", "typescript", "web", "framework"], + "main": "dist/index.js", "module": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "LICENSE", + "README.md", + "dist" + ], + "publishConfig": { + "access": "public" + }, "scripts": { "build": "tsup", "lint": "eslint", - "lint:fix": "eslint --fix" + "lint:fix": "eslint --fix", + "prepublishOnly": "bun run build" }, "peerDependencies": { "@elysiajs/html": ">=1.4.0 <2.0.0",