Skip to content
Merged
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
19 changes: 0 additions & 19 deletions .eslintrc.json

This file was deleted.

48 changes: 24 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,26 @@ on:
branches: [main]

jobs:
test:
node:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [23.x]
node-version: [24, 25]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
uses: pnpm/action-setup@v4

- uses: actions/cache@v3
name: Setup pnpm cache
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-${{ runner.os }}-
node-version: ${{ matrix.node-version }}
cache: pnpm

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

- name: Type check
run: pnpm typecheck
Expand All @@ -54,3 +39,18 @@ jobs:

- name: Build
run: pnpm build

bun:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Use Bun
uses: oven-sh/setup-bun@v2

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

- name: Test Bun providers
run: bun run test:bun
116 changes: 63 additions & 53 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,87 @@
name: Publish to NPM

on:
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g., 1.0.0)"
required: true
type: string
release:
types:
- published

permissions:
contents: read
id-token: write

jobs:
publish:
verify-ci:
name: Verify CI passed
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
actions: read
contents: read
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify CI passed for the release commit
env:
GH_TOKEN: ${{ github.token }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
run_id="$(gh run list \
--workflow ci.yml \
--branch "$DEFAULT_BRANCH" \
--commit "${{ github.sha }}" \
--event push \
--status completed \
--json databaseId,conclusion \
--jq 'map(select(.conclusion == "success"))[0].databaseId // ""')"

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "23.x"
registry-url: "https://registry.npmjs.org"
if [ -z "$run_id" ]; then
echo "No successful CI run found for ${{ github.sha }} on $DEFAULT_BRANCH."
echo "Run CI successfully before publishing this release."
exit 1
fi

echo "Found successful CI run: $run_id"

publish:
name: Publish to npm
runs-on: ubuntu-latest
needs: verify-ci

steps:
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4

- name: Setup Node.js 24
uses: actions/setup-node@v6
with:
version: 10
node-version: 24
registry-url: "https://registry.npmjs.org"
cache: pnpm

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

- name: Setup pnpm cache
- name: Validate release tag
run: |
mkdir -p ~/.pnpm-store
echo "STORE_PATH=~/.pnpm-store" >> $GITHUB_ENV
package_version="$(node -p "require('./package.json').version")"
release_version="${GITHUB_REF_NAME#v}"

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
if [ "$package_version" != "$release_version" ]; then
echo "Release tag v$release_version does not match package.json version $package_version."
exit 1
fi

- name: Install dependencies
run: pnpm install
- name: Type check
run: pnpm typecheck

- name: Lint
run: pnpm lint

- name: Test
run: pnpm test
run: pnpm test:coverage

- name: Build
run: pnpm build

- name: Validate version
run: |
if ! [[ "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?$ ]]; then
echo "Invalid version format. Please use semantic versioning (e.g., 1.0.0 or 1.0.0-beta.1)"
exit 1
fi

- name: Update package version
run: |
npm version ${{ github.event.inputs.version }} --no-git-tag-version
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git add package.json
git commit -m "release: ${{ github.event.inputs.version }}"
git tag v${{ github.event.inputs.version }}
git push origin main --tags

- name: Publish to NPM
shell: bash
run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --provenance --access public
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ build/Release

# Dependency directories
node_modules/
.pnpm-store/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
Expand Down Expand Up @@ -136,4 +137,7 @@ dist
.pnp.*

# OS
.DS_Store
.DS_Store

# Example databases
*.sqlite
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
minimum-release-age=10080
9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2025 Sandrino Di Mattia
Copyright (c) 2026 Sandrino Di Mattia

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
Loading
Loading