Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"permissions": {
"allow": [
"Bash(pnpm install:*)",
"Bash(npm install:*)"
]
}
}
61 changes: 61 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# GitHub Workflows

This directory contains automated workflows for CI/CD.

## Workflows

### CI (`ci.yml`)
Runs on every push to `main` and on pull requests:
- Installs dependencies
- Builds the plugin
- Builds the example app

### Preview Package (`preview.yml`)
Runs on pull requests and pushes to `main`:
- Builds the package
- Publishes a preview version via [pkg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new)
- Adds a comment to PRs with installation instructions

### Publish to npm (`publish.yml`)
Runs when a GitHub release is created:
- Builds the package
- Publishes to npm with the `--access public` flag

## Setup

### For npm Publishing

1. Create an npm access token:
- Go to https://www.npmjs.com/settings/YOUR_USERNAME/tokens
- Click "Generate New Token" → "Automation"
- Copy the token

2. Add the token to your GitHub repository:
- Go to your repository Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name: `NPM_TOKEN`
- Value: Paste your npm token
- Click "Add secret"

3. Create a release:
- Go to your repository → Releases → Draft a new release
- Create a tag (e.g., `v0.1.0`)
- Click "Publish release"
- The workflow will automatically publish to npm

### For pkg.pr.new

No setup required! The workflow will automatically:
- Publish preview packages for every PR
- Comment on PRs with installation instructions
- Update the comment when new commits are pushed

## Testing Locally

Before creating a release, test the build:

```bash
pnpm install
pnpm build
cd example && pnpm build
```
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
pull_request:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 9

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

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

- name: Build plugin
run: pnpm build

- name: Build example
run: |
cd example
pnpm build
35 changes: 35 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Preview Package

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main

jobs:
preview:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 9

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

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

- name: Build
run: pnpm build

- name: Publish preview
run: pnpx pkg-pr-new publish
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish to npm

on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 9

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

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

- name: Build
run: pnpm build

- name: Publish to npm
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Dependencies
node_modules/
.pnpm-store/

# Build output
dist/
*.tsbuildinfo
.vite/
.turbo/

# Environment files
.env
.env.local
.env.*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea/
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.code-workspace

# OS files
.DS_Store
Thumbs.db

# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Testing
coverage/

# Temporary files
*.tmp
*.temp
.cache/

# Example build output
example/dist/
example/api/
example/public/
Loading
Loading