Skip to content

Commit 5d28b07

Browse files
jog1tCopilot
andauthored
chore: initialise repository (#1)
* init * handle move static files * update .github/workflows/preview.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * update .github/workflows/publish.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * update .github/workflows/ci.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix workflows --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1648c8a commit 5d28b07

32 files changed

+3114
-0
lines changed

.github/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# GitHub Workflows
2+
3+
This directory contains automated workflows for CI/CD.
4+
5+
## Workflows
6+
7+
### CI (`ci.yml`)
8+
Runs on every push to `main` and on pull requests:
9+
- Installs dependencies
10+
- Builds the plugin
11+
- Builds the example app
12+
13+
### Preview Package (`preview.yml`)
14+
Runs on pull requests and pushes to `main`:
15+
- Builds the package
16+
- Publishes a preview version via [pkg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new)
17+
- Adds a comment to PRs with installation instructions
18+
19+
### Publish to npm (`publish.yml`)
20+
Runs when a GitHub release is created:
21+
- Builds the package
22+
- Publishes to npm with the `--access public` flag
23+
24+
## Setup
25+
26+
### For npm Publishing
27+
28+
1. Create an npm access token:
29+
- Go to https://www.npmjs.com/settings/YOUR_USERNAME/tokens
30+
- Click "Generate New Token" → "Automation"
31+
- Copy the token
32+
33+
2. Add the token to your GitHub repository:
34+
- Go to your repository Settings → Secrets and variables → Actions
35+
- Click "New repository secret"
36+
- Name: `NPM_TOKEN`
37+
- Value: Paste your npm token
38+
- Click "Add secret"
39+
40+
3. Create a release:
41+
- Go to your repository → Releases → Draft a new release
42+
- Create a tag (e.g., `v0.1.0`)
43+
- Click "Publish release"
44+
- The workflow will automatically publish to npm
45+
46+
### For pkg.pr.new
47+
48+
No setup required! The workflow will automatically:
49+
- Publish preview packages for every PR
50+
- Comment on PRs with installation instructions
51+
- Update the comment when new commits are pushed
52+
53+
## Testing Locally
54+
55+
Before creating a release, test the build:
56+
57+
```bash
58+
pnpm install
59+
pnpm build
60+
cd example && pnpm build
61+
```

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: pnpm/action-setup@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'pnpm'
21+
22+
- name: Install dependencies
23+
run: pnpm install --frozen-lockfile
24+
25+
- name: Build plugin
26+
run: pnpm build
27+
28+
- name: Build basic example
29+
run: |
30+
cd examples/basic
31+
pnpm build
32+
33+
- name: Build Vercel example
34+
run: |
35+
cd examples/vercel
36+
pnpm build

.github/workflows/preview.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Preview Package
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
preview:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: pnpm/action-setup@v4
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
cache: 'pnpm'
25+
26+
- name: Install dependencies
27+
run: pnpm install --frozen-lockfile
28+
29+
- name: Build
30+
run: pnpm build
31+
32+
- name: Publish preview
33+
run: pnpx pkg-pr-new publish

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: pnpm/action-setup@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
cache: 'pnpm'
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
- name: Install dependencies
25+
run: pnpm install --frozen-lockfile
26+
27+
- name: Build
28+
run: pnpm build
29+
30+
- name: Publish to npm
31+
run: pnpm publish --access public --no-git-checks
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Dependencies
2+
node_modules/
3+
.pnpm-store/
4+
5+
# Build output
6+
dist/
7+
*.tsbuildinfo
8+
.vite/
9+
.turbo/
10+
11+
# Environment files
12+
.env
13+
.env.local
14+
.env.*.local
15+
16+
# Editor directories and files
17+
.vscode/*
18+
!.vscode/extensions.json
19+
!.vscode/settings.json
20+
.idea/
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
26+
*.code-workspace
27+
28+
# OS files
29+
.DS_Store
30+
Thumbs.db
31+
32+
# Logs
33+
logs/
34+
*.log
35+
npm-debug.log*
36+
yarn-debug.log*
37+
yarn-error.log*
38+
pnpm-debug.log*
39+
lerna-debug.log*
40+
41+
# Testing
42+
coverage/
43+
44+
# Temporary files
45+
*.tmp
46+
*.temp
47+
.cache/
48+
49+
# Example build output
50+
example/dist/
51+
example/api/
52+
example/public/

0 commit comments

Comments
 (0)