Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Package checks

on:
pull_request:
branches:
- main
paths:
- package.json
- pnpm-lock.yaml
- tsconfig.json
- tsup.config.ts
- src/**
- .github/workflows/package.yml
- .github/workflows/release.yaml
- PUBLISHING.md
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read

jobs:
package:
name: Node.js ${{ matrix.node-version }} package
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node-version:
- 22.x
- 24.x

steps:
- uses: actions/checkout@v6.0.2

- uses: actions/setup-node@v6.4.0
with:
node-version: ${{ matrix.node-version }}

- name: Enable pnpm
run: |
corepack enable
corepack prepare pnpm@10.26.2 --activate

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build package
run: pnpm build

- name: Check package tarball
run: pnpm pack:dry-run
85 changes: 85 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release

on:
workflow_dispatch:
inputs:
dry_run:
description: "Run npm publish in dry-run mode"
required: false
default: true
type: boolean

env:
NODE_VERSION: "24.15.0"
NPM_CONFIG_REGISTRY: https://registry.npmjs.org

permissions:
contents: read

jobs:
npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
with:
fetch-depth: 0

- name: Setup release flow
run: |
package_version="$(node -p "require('./package.json').version")"
echo "RELEASE_VERSION=$package_version" >> "$GITHUB_ENV"

- name: Verify release source
run: |
git fetch --no-tags origin main:refs/remotes/origin/main
if [ "$GITHUB_REF" != "refs/heads/main" ]; then
echo "Manual release must run from the main branch"
exit 1
fi
if [ "$GITHUB_SHA" != "$(git rev-parse origin/main)" ]; then
echo "Manual release must run from the current origin/main HEAD"
exit 1
fi

- uses: actions/setup-node@v6.4.0
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: "https://registry.npmjs.org"

- name: Enable pnpm
run: |
corepack enable
corepack prepare pnpm@10.26.2 --activate

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check release version
run: |
PACKAGE_NAME="$(node -p "require('./package.json').name")"
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
if [ "$PACKAGE_VERSION" != "$RELEASE_VERSION" ]; then
echo "Release version $RELEASE_VERSION does not match package version $PACKAGE_VERSION"
exit 1
fi
if npm view "$PACKAGE_NAME@$PACKAGE_VERSION" version >/dev/null 2>&1; then
echo "$PACKAGE_NAME@$PACKAGE_VERSION is already published"
exit 1
fi

- name: Pack dry run
run: npm pack --dry-run

- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo "NPM_TOKEN secret is required for publishing"
exit 1
fi
args=(--access public)
if [ "${{ inputs.dry_run }}" = "true" ]; then
args+=(--dry-run)
fi
npm publish "${args[@]}"
68 changes: 68 additions & 0 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Publishing `@api7/better-auth-ui`

This fork is published as `@api7/better-auth-ui` so API7 projects can depend on
a prebuilt npm package instead of rebuilding this repository during consumer
installation.

## Versioning

Use the upstream version plus an API7 suffix:

```text
3.3.15-api7.0
3.3.15-api7.1
3.4.0-api7.0
```

Increment the API7 suffix for fork-only fixes. Move the upstream base version
when rebasing onto a newer upstream release.

## Release Checks

Run these commands before publishing:

```bash
pnpm install --frozen-lockfile
pnpm build
npm pack --dry-run
```

`npm pack --dry-run` runs `prepack`, which rebuilds `dist` and shows the files
that will be included in the published tarball.

## Automated Release

This repository publishes the npm package from GitHub Actions with a single
token-based release path. The `Release` workflow is started with
`workflow_dispatch` and defaults to a dry run.

Before running the workflow, ask an API7 npm/GitHub administrator to add an npm
automation token with permission to publish under the `@api7` scope as the
`NPM_TOKEN` repository or environment secret.

Run the `Release` workflow manually from the `main` branch:

- `dry_run`: `true` first
- `dry_run`: `false` after the dry run succeeds

The release workflow installs dependencies, verifies that the package version
has not already been published, verifies that the workflow is running from the
current `origin/main` commit, runs `npm pack --dry-run`, and publishes to npm
with `NPM_TOKEN`. Do not add another publishing path.

Do not restore a `prepare` script for this package. Consumers should install the
prebuilt npm tarball rather than rebuilding the GitHub repository during their
own install step.

## Portal Dependency

API7 Developer Portal can keep existing source imports while installing the API7
package through an npm alias:

```json
{
"dependencies": {
"@daveyplate/better-auth-ui": "npm:@api7/better-auth-ui@3.3.15-api7.0"
}
}
```
22 changes: 16 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
{
"name": "@daveyplate/better-auth-ui",
"name": "@api7/better-auth-ui",
"homepage": "https://better-auth-ui.com",
"version": "3.3.15",
"version": "3.3.15-api7.0",
"description": "Plug & play shadcn/ui components for better-auth",
"repository": {
"type": "git",
"url": "git+https://github.com/api7/better-auth-ui.git"
},
"scripts": {
"build": "tsup --clean --dts && cp src/style.css dist/style.css",
"prepare": "pnpm build",
"dev": "tsc-watch",
"prepublishOnly": "rm -rf dist && turbo build",
"prepack": "pnpm build",
"prepublishOnly": "pnpm build",
"pack:dry-run": "npm pack --dry-run",
"lint": "biome check",
"lint:fix": "biome check --write"
},
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
"./css": "./dist/style.css",
".": {
Expand Down Expand Up @@ -68,8 +74,9 @@
}
},
"files": [
"src",
"dist"
"dist",
"README.md",
"LICENSE"
],
"keywords": [
"typescript",
Expand Down Expand Up @@ -161,5 +168,8 @@
"vaul": "^1.1.2"
},
"packageManager": "pnpm@10.26.2",
"publishConfig": {
"access": "public"
},
"overrides": {}
}