Skip to content

Commit 1f39e61

Browse files
2214962083claude
andauthored
build: migrate from changesets to semantic-release (#12)
* chore: remove obsolete VibeSync configuration files and update changelog links * chore: update package references to @nicepkg/vsync and release version 1.0.9 * chore: update package.json with repository details, author information, and keywords * chore: update package.json description to clarify functionality of the CLI tool * chore: remove obsolete changeset for version 10 * feat: add isMainModule function to determine if the current module is the main entry point * fix: resolve CLI functionality issue * docs: add full documentation link to README files * chore: add changeset for release v1.0.9 with patch for @nicepkg/vsync * chore: update documentation links to absolute paths and remove obsolete changeset * build: migrate from changesets to semantic-release Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 4b5145b commit 1f39e61

File tree

15 files changed

+2126
-675
lines changed

15 files changed

+2126
-675
lines changed

.changeset/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.changeset/config.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

.claude/commands/commit.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ argument-hint: [optional message]
66
# Create Git Commit
77

88
Create a git commit following Angular/Conventional Commits format.
9+
This repo uses semantic-release, so commit messages directly drive versioning.
910

1011
## Context
1112

@@ -27,10 +28,14 @@ type(scope): subject
2728

2829
**Rules:**
2930

30-
- Subject must be max 100 characters
31-
- Use lowercase for type and scope
31+
- Header must be <= 100 characters
32+
- Type and scope must be lowercase
33+
- Subject must be lowercase
3234
- No period at the end of subject
3335
- Use imperative mood: "add feature" not "added feature"
36+
- Scope is optional, but if used must be one of: `website`, `docs`, `deps`
37+
- Use `docs` for README/markdown only changes
38+
- Use `website` for `website/` changes
3439

3540
### Commit Types
3641

@@ -53,21 +58,24 @@ type(scope): subject
5358
Common scopes in this project:
5459

5560
- `website` - website folder changes
61+
- `docs` - documentation only changes
5662
- `deps` - Dependencies
63+
- `cli` - cli folder vsync package changes
5764

5865
### Examples
5966

6067
```
6168
feat(website): add hotel card component
6269
chore(deps): update React to v19
70+
docs(docs): update README with new setup instructions
6371
docs: update README with new setup instructions
6472
style: format code with prettier
6573
```
6674

6775
## Task
6876

6977
1. If $ARGUMENTS provided, use as commit message hint
70-
2. Analyze the staged/unstaged changes
71-
3. Stage relevant files with `git add`
78+
2. Analyze staged/unstaged changes and choose a single coherent scope
79+
3. Stage relevant files with `git add` (avoid unrelated files)
7280
4. Create commit with appropriate type, scope (if applicable), and subject
73-
5. Keep subject concise (max 100 chars), focus on "what" changed
81+
5. Keep subject concise (<= 100 chars), focus on "what" changed

.claude/commands/create-pr.md

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,22 @@ description: Create GitHub Pull Request following Angular commit convention
33
argument-hint: [optional description]
44
---
55

6-
# Create Pull Request
6+
# Create Pull Request (Semantic-release Friendly)
77

8-
Create a GitHub Pull Request following the project's Angular commit convention.
8+
Create a GitHub Pull Request that works with semantic-release.
9+
This repo defaults to **Squash and merge**, so the **PR title becomes the release commit**.
10+
Therefore the PR title MUST follow Conventional Commits _exactly_:
11+
12+
```
13+
<type>(<scope>): <subject>
14+
```
15+
16+
**Hard rules (must pass CI):**
17+
18+
- Subject must be lowercase
19+
- Subject must NOT end with a period
20+
- Header length must be <= 100 characters
21+
- Scope is optional, but if used must be one of: `website`, `docs`, `deps`, `cli`
922

1023
## Context
1124

@@ -18,39 +31,41 @@ Create a GitHub Pull Request following the project's Angular commit convention.
1831

1932
## Prerequisites
2033

21-
1. Check if `gh` CLI is available and authenticated:
34+
1. Ensure `gh` CLI is available and authenticated:
35+
2236
```bash
2337
gh auth status
2438
```
2539

26-
2. Ensure all changes are committed:
40+
2. Ensure all changes are committed and branch is pushed:
2741
```bash
2842
git status
43+
git push -u origin HEAD
2944
```
3045

3146
## PR Title Format (Angular Convention)
3247

33-
**IMPORTANT**: PR titles MUST follow Angular commit convention. This is enforced by GitHub Action.
48+
**IMPORTANT**: PR title MUST follow Angular/Conventional Commit format because squash uses it as the release commit.
3449

3550
```
3651
<type>(<scope>): <subject>
3752
```
3853

3954
### Types
4055

41-
| Type | Description |
42-
|------|-------------|
43-
| `feat` | A new feature |
44-
| `fix` | A bug fix |
45-
| `docs` | Documentation only changes |
46-
| `style` | Changes that do not affect the meaning of the code |
47-
| `refactor` | A code change that neither fixes a bug nor adds a feature |
48-
| `perf` | A code change that improves performance |
49-
| `test` | Adding missing tests or correcting existing tests |
50-
| `build` | Changes that affect the build system or external dependencies |
51-
| `ci` | Changes to CI configuration files and scripts |
52-
| `chore` | Other changes that don't modify src or test files |
53-
| `revert` | Reverts a previous commit |
56+
| Type | Description |
57+
| ---------- | ------------------------------------------------------------- |
58+
| `feat` | A new feature |
59+
| `fix` | A bug fix |
60+
| `docs` | Documentation only changes |
61+
| `style` | Changes that do not affect the meaning of the code |
62+
| `refactor` | A code change that neither fixes a bug nor adds a feature |
63+
| `perf` | A code change that improves performance |
64+
| `test` | Adding missing tests or correcting existing tests |
65+
| `build` | Changes that affect the build system or external dependencies |
66+
| `ci` | Changes to CI configuration files and scripts |
67+
| `chore` | Other changes that don't modify src or test files |
68+
| `revert` | Reverts a previous commit |
5469

5570
### Scopes (optional)
5671

@@ -77,66 +92,50 @@ refactor: simplify authentication logic
7792

7893
## Creating a Pull Request
7994

80-
### Basic Command
81-
82-
```bash
83-
gh pr create \
84-
--title "feat(website): your descriptive title" \
85-
--body "## Description
86-
87-
Brief summary of changes.
95+
### Fill the PR Template
8896

89-
Fixes #123
90-
91-
## Type of Change
92-
93-
- [x] New feature
94-
95-
## Checklist
97+
Use `.github/PULL_REQUEST_TEMPLATE.md` as the base. Fill in the summary, fixes, and type.
9698

97-
- [x] Code follows style guidelines
98-
- [x] Self-review completed
99-
- [x] No new warnings" \
100-
--base main
101-
```
102-
103-
### Using HEREDOC for Complex Descriptions
99+
### Recommended Command (template-based)
104100

105101
```bash
106-
gh pr create --title "feat(website): add new feature" --body "$(cat <<'EOF'
102+
gh pr create \
103+
--title "feat(scope): short, lowercase summary" \
104+
--body "$(cat <<'EOF'
107105
## Description
108106
109-
Brief summary of the changes and the motivation behind them.
107+
Brief summary of the change and why it matters.
110108
111109
Fixes #123
112110
113111
## Type of Change
114112
115113
- [ ] Bug fix (non-breaking change which fixes an issue)
116-
- [x] New feature (non-breaking change which adds functionality)
114+
- [ ] New feature (non-breaking change which adds functionality)
117115
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
118116
- [ ] Documentation update
119117
120118
## Checklist
121119
122-
- [x] My code follows the style guidelines of this project
123-
- [x] I have performed a self-review of my code
124-
- [x] I have made corresponding changes to the documentation
125-
- [x] My changes generate no new warnings
120+
- [ ] My code follows the style guidelines of this project
121+
- [ ] I have performed a self-review of my code
122+
- [ ] I have commented my code, particularly in hard-to-understand areas
123+
- [ ] I have made corresponding changes to the documentation
124+
- [ ] My changes generate no new warnings
125+
- [ ] Any dependent changes have been merged and published
126126
127127
## Screenshots (if applicable)
128128
129129
N/A
130130
EOF
131-
)" --base main
131+
)" \
132+
--base main
132133
```
133134

134-
### Create as Draft
135-
136-
Add `--draft` flag for work in progress:
135+
### Draft PR (WIP)
137136

138137
```bash
139-
gh pr create --title "feat: wip feature" --body "..." --base main --draft
138+
gh pr create --title "feat(scope): wip summary" --body "WIP" --base main --draft
140139
```
141140

142141
## Useful Commands

.github/workflows/pr-title.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# =============================================================================
22
# PR Title Validation
33
# =============================================================================
4-
# Validates that PR titles follow Angular commit convention.
5-
# This ensures consistent and meaningful PR titles for changelog generation.
4+
# Validates PR titles using Conventional Commits (semantic-release friendly).
5+
# This repo uses **Squash and merge**, so the PR title becomes the release commit.
6+
# Keeping titles compliant ensures correct version bumps and clean changelogs.
7+
#
8+
# Title requirements:
9+
# - Format: <type>(<scope>): <subject>
10+
# - Subject: lowercase, no trailing period, <= 100 chars total header
11+
# - Scope: optional; if present must be one of the allowed scopes below
612
#
713
# Format: <type>(<scope>): <subject>
814
# Example: feat(website): add dark mode toggle
@@ -50,6 +56,7 @@ jobs:
5056
website
5157
docs
5258
deps
59+
cli
5360
# Ensure subject doesn't start with uppercase
5461
subjectPattern: ^(?![A-Z]).+$
5562
subjectPatternError: |

.github/workflows/release.yaml

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ name: Release
33
on:
44
push:
55
branches: [main]
6-
paths:
7-
- '.changeset/**'
8-
- 'package.json'
9-
- 'pnpm-lock.yaml'
10-
# optional: include package manifests if you want release to run when versions are bumped
11-
- 'cli/package.json'
126
workflow_dispatch:
137

148
concurrency:
@@ -23,6 +17,18 @@ permissions:
2317
jobs:
2418
release:
2519
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
max-parallel: 1
23+
matrix:
24+
package:
25+
- name: "@nicepkg/vsync"
26+
dir: "cli"
27+
copyReadme: "true"
28+
# add new packages here
29+
# - name: "@nicepkg/vsync-core"
30+
# dir: "core"
31+
# copyReadme: "false"
2632
steps:
2733
- uses: actions/checkout@v6
2834
with:
@@ -31,27 +37,33 @@ jobs:
3137
- name: Setup Node.js and pnpm
3238
uses: ./.github/actions/setup-node-pnpm
3339

34-
- name: Create Release PR or Publish
35-
uses: changesets/action@v1
36-
with:
37-
# use git-cli so symlinks in the repo don't break GitHub API commits
38-
commitMode: git-cli
39-
setupGitUser: true
40-
commit: "chore: version packages"
41-
title: "chore: version packages"
42-
43-
# calculate version + generate changelog + update lockfile (very important)
44-
version: pnpm version-packages
45-
46-
# build before publish (to avoid empty dist)
47-
# then publish (you currently use pnpm publish -r)
48-
# then tag (to allow action to push tags + create GitHub Releases)
49-
publish: bash ./scripts/release-publish.sh
50-
51-
# explicitly enable GitHub Releases
52-
createGithubReleases: true
53-
40+
- name: Check package exists
41+
id: package-check
42+
shell: bash
43+
run: |
44+
if [ -f "${{ matrix.package.dir }}/package.json" ]; then
45+
echo "exists=true" >> "$GITHUB_OUTPUT"
46+
else
47+
echo "exists=false" >> "$GITHUB_OUTPUT"
48+
fi
49+
50+
- name: Copy README files into package
51+
if: steps.package-check.outputs.exists == 'true' && matrix.package.copyReadme == 'true'
52+
shell: bash
53+
run: |
54+
cp README.md "${{ matrix.package.dir }}/README.md"
55+
cp README_cn.md "${{ matrix.package.dir }}/README_cn.md"
56+
57+
- name: Build package
58+
if: steps.package-check.outputs.exists == 'true'
59+
run: pnpm --filter ${{ matrix.package.name }} build
60+
61+
- name: Run semantic-release
62+
if: steps.package-check.outputs.exists == 'true'
63+
run: pnpm run semantic-release
5464
env:
65+
SEMREL_PKG_ROOT: ${{ matrix.package.dir }}
66+
SEMREL_PKG_NAME: ${{ matrix.package.name }}
5567
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5668
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5769
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"[mdx]": {
100100
"editor.defaultFormatter": "esbenp.prettier-vscode"
101101
},
102-
"cSpell.words": ["MCPO", "opencode", "vsync"],
102+
"cSpell.words": ["MCPO", "nicepkg", "opencode", "SEMREL", "vsync"],
103103

104104
// i18n-ally Configuration for CLI workspace
105105
"i18n-ally.localesPaths": ["cli/src/locales"],

0 commit comments

Comments
 (0)