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
25 changes: 25 additions & 0 deletions AGENTS.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
# Working on diffity

## Bump the version in every pull request

A running instance replaces itself only when the binary's version differs from the one it
registered (`packages/cli/src/index.ts`, `isStale`). Merge a behaviour change without a bump and
every instance already running keeps serving the old build, silently, until someone restarts it by
hand. So the version is not a release ceremony here — it is how a change reaches the people who
have diffity open.

Bump inside the pull request, as part of the branch:

```bash
npx tsx scripts/release.ts patch --no-git # or: minor
```

`--no-git` is what makes it safe in a branch. Without it the script commits and tags, and since
`develop` takes squash merges the commit is rewritten on the way in and the tag is left pointing at
a commit that never lands.

Do not use the `release:patch` / `release:minor` npm scripts for this. They publish to npm, which
is a separate decision and, in this fork, one that is not ours to make.

A pull request that changes nothing a user could observe — a test, a comment, a rename — does not
need a bump. Everything else does.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "diffity",
"version": "0.9.6",
"version": "0.9.7",
"description": "GitHub-style git diff viewer in the browser",
"type": "module",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion packages/git/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "@diffity/git",
"version": "0.9.6",
"version": "0.9.7",
"private": true,
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/github/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "@diffity/github",
"version": "0.9.6",
"version": "0.9.7",
"private": true,
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/parser/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "@diffity/parser",
"version": "0.9.6",
"version": "0.9.7",
"private": true,
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "@diffity/ui",
"version": "0.9.6",
"version": "0.9.7",
"type": "module",
"private": true,
"scripts": {
Expand Down
20 changes: 14 additions & 6 deletions scripts/release.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,9 +15,13 @@ const packagePaths = [
'packages/ui',
];

const bump = process.argv[2] as 'patch' | 'minor';
const args = process.argv.slice(2);
const bump = args.find(arg => !arg.startsWith('--')) as 'patch' | 'minor';
// A bump that travels inside a pull request must not commit or tag: develop takes squash merges,
// so the commit this would make is rewritten and the tag is left pointing at a commit nobody has.
const noGit = args.includes('--no-git');
if (bump !== 'patch' && bump !== 'minor') {
console.error('Usage: tsx scripts/release.ts <patch|minor>');
console.error('Usage: tsx scripts/release.ts <patch|minor> [--no-git]');
process.exit(1);
}

Expand DownExpand Up@@ -51,8 +55,12 @@ for (const pkgDir of packagePaths) {
writeFileSync(lockPath, JSON.stringify(lockJson, null, 2) + '\n');
filesToStage.push('package-lock.json');

execSync(`git add ${filesToStage.join(' ')}`, { cwd: root, stdio: 'inherit' });
execSync(`git commit -m "chore: release v${newVersion}"`, { cwd: root, stdio: 'inherit' });
execSync(`git tag v${newVersion}`, { cwd: root, stdio: 'inherit' });
if (noGit) {
console.log(`\nBumped to ${newVersion}. Commit it with the rest of your branch.`);
} else {
execSync(`git add ${filesToStage.join(' ')}`, { cwd: root, stdio: 'inherit' });
execSync(`git commit -m "chore: release v${newVersion}"`, { cwd: root, stdio: 'inherit' });
execSync(`git tag v${newVersion}`, { cwd: root, stdio: 'inherit' });

console.log(`\nTagged v${newVersion}`);
console.log(`\nTagged v${newVersion}`);
}