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
45 changes: 45 additions & 0 deletions .changesets/README-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Example Changeset
#
# This is an example changeset file to help you understand the format.
# When you're ready to create real changesets, use: workspace changeset add
#
# Important: Changesets should be committed to git as part of your PR.
# They tell the CI/CD pipeline what version bumps to perform on merge.
#
# Workflow:
# 1. Create a changeset: workspace changeset add
# 2. Commit it with your changes: git add .changesets/your-changeset.yaml
# 3. Push your branch: git push
# 4. When merged to main, CI runs: workspace bump --execute
# 5. Versions are bumped, changesets move to history/
#
# You can delete this example file when you're ready.

# Changeset ID (typically branch name or custom identifier)
id: example-feature

# Git branch this changeset is associated with
branch: main

# Version bump type: patch, minor, or major
bump: minor

# Packages affected (for monorepos, list package names; for single packages, use the package name)
packages:
- "@myorg/core"
- "@myorg/utils"

# Target environments (e.g., dev, staging, production)
environments:
- production

# Commits included in this changeset (optional, auto-tracked)
commits:
- abc123: "feat: add new feature"
- def456: "fix: resolve issue"

# Timestamp when changeset was created
createdAt: "2024-01-01T00:00:00Z"

# Timestamp when changeset was last updated
updatedAt: "2024-01-01T00:00:00Z"
13 changes: 13 additions & 0 deletions .changesets/feat-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"branch": "feat/ci",
"bump": "patch",
"environments": [
"production"
],
"packages": [
"@websublime/delta"
],
"changes": [],
"created_at": "2026-04-16T17:04:40.379594Z",
"updated_at": "2026-04-16T17:04:40.381291Z"
}
Empty file added .changesets/history/.gitkeep
Empty file.
32 changes: 32 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh
# pre-push: require at least one changeset before allowing a push.
#
# Bypass with: git push --no-verify
#
# A changeset is any `.json` file directly inside `.changesets/`. Files
# under `.changesets/history/` do NOT count — they represent already-
# released changesets. The `.yaml` example file is ignored by the glob.

CHANGESET_DIR=".changesets"

if [ ! -d "$CHANGESET_DIR" ]; then
echo ""
echo "pre-push: $CHANGESET_DIR/ not found — is this a workspace-managed repo?" >&2
echo ""
exit 1
fi

count=$(find "$CHANGESET_DIR" -maxdepth 1 -type f -name "*.json" 2>/dev/null | wc -l | tr -d ' ')

if [ "$count" -eq 0 ]; then
echo "" >&2
echo "pre-push: no changesets queued in $CHANGESET_DIR/" >&2
echo "" >&2
echo " Create one with: workspace changeset add" >&2
echo " Or bypass with: git push --no-verify" >&2
echo "" >&2
exit 1
fi

echo "pre-push: $count changeset(s) queued"
exit 0
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Continuous Integration Workflow
#
# What: Runs quality gates (lint, typecheck, test, build) on every PR and
# on every push to a non-main branch.
# How: Uses GitHub Actions with parallel jobs and npm caching for fast feedback.
# Why: Ensures code quality and prevents broken code from being merged.
# Pushes to main are skipped because the PR that merged already ran CI.

name: CI

on:
push:
branches-ignore: [main]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run Biome
run: npm run lint

typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run TypeScript
run: npm run typecheck

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

build:
name: Build
runs-on: ubuntu-latest
needs: [lint, typecheck, test]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build packages
run: npm run build
82 changes: 82 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Release Workflow
#
# What: Automates versioning, changelog generation, git tagging, and npm
# publishing for @websublime/delta.
# How: Uses workspace-tools to process changesets and npm to publish.
# Why: Ensures consistent releases with proper versioning and changelog updates.

name: Release

on:
push:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
release:
name: Release
runs-on: ubuntu-latest
environment: PROD
if: github.repository == 'websublime/delta'
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci

- name: Build package
run: npm run build

- name: Install workspace-tools
run: |
curl --proto '=https' --tlsv1.2 -LsSf \
https://github.com/websublime/workspace-tools/releases/latest/download/sublime_cli_tools-installer.sh | sh

- name: Check for changesets
id: changesets
run: |
COUNT=$(workspace --format json --log-level silent changeset list | jq '.data.total // 0')
echo "count=$COUNT" >> $GITHUB_OUTPUT
echo "Found $COUNT changeset(s)"

- name: Create release
if: steps.changesets.outputs.count > 0
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
workspace bump --execute --git-commit --git-tag --force
git push origin main --follow-tags

- name: Publish to npm
if: steps.changesets.outputs.count > 0
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo "ERROR: NODE_AUTH_TOKEN is empty — check NPM_TOKEN secret." >&2
exit 1
fi
npm publish --access public
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ Thumbs.db
.cache/
.npm/
.eslintcache

# Workspace Tools
# Note: .changesets/ and repo.config.* should be versioned in git
# Only backups are excluded
.workspace-backups/
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.12.0
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"format": "biome format --write .",
"check": "biome check --write .",
"verify": "npm run lint && npm run typecheck && npm test",
"prepare": "git config core.hooksPath .githooks 2>/dev/null || true",
"prepublishOnly": "npm run verify && npm run build"
},
"keywords": [
Expand Down
Loading
Loading