Skip to content
Open
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
7 changes: 7 additions & 0 deletions .changeset/changesets-cli-v3-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
---

Adjust the changesets setup for `@changesets/cli` v3: opt back into versioning private packages
(the v3 default stopped versioning them, which broke mixed changesets), point `$schema` at
`@changesets/config@4.0.0`, and wrap `changeset publish` in CI so the release action still receives
the `New tag:` lines it parses.
3 changes: 2 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"$schema": "https://unpkg.com/@changesets/config@4.0.0/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "urigo/accounter-fullstack" }],
"commit": false,
"fixed": [],
Expand All @@ -8,6 +8,7 @@
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@accounter-helper/*"],
"privatePackages": { "version": true, "tag": false },
"snapshot": {
"useCalculatedVersion": true,
"prereleaseTemplate": "{tag}-{datetime}-{commit}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
id: changesets-stable
uses: dotansimha/changesets-action@2eb8e159b258a2144d8553f527fa015a8893dfe2
with:
publish: 'yarn changeset publish'
publish: 'yarn changeset:publish'
version: 'yarn changeset version'
commit: 'chore(release): update monorepo packages versions'
title: 'Upcoming Release Changes'
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"build": "yarn generate && yarn build:tools && yarn build:main",
"build:main": "yarn workspaces foreach --all --parallel --include @accounter/client --include @accounter/server --include @accounter/scraper-app --include @accounter/mcp-server --include @accounter/email-ingestion-gateway run build",
"build:tools": "yarn workspaces foreach --all --parallel --include @accounter/etana-scraper --include @accounter/etherscan-scraper --include @accounter/green-invoice-graphql --include @accounter/hashavshevet-mesh --include @accounter/israeli-vat-scraper --include @accounter/kraken-scraper --include @accounter/payper-mesh --include @accounter/pcn874-generator --include @accounter/shaam-uniform-format-generator --include @accounter/shaam6111-generator run build",
"changeset:publish": "node scripts/changeset-publish.mjs",
"db:migrate": "yarn migration:run",
"encrypt-password": "node scripts/encrypt-password.mjs",
"generate": "concurrently -c blue,green -n GraphQL,SQL \"yarn generate:graphql\" \"yarn generate:sql\"",
Expand Down Expand Up @@ -50,7 +51,7 @@
"devDependencies": {
"@0no-co/graphqlsp": "1.17.3",
"@changesets/changelog-github": "1.0.0",
"@changesets/cli": "2.31.1",
"@changesets/cli": "3.0.0",
"@eslint/compat": "2.1.0",
"@eslint/eslintrc": "3.3.6",
"@eslint/js": "10.0.1",
Expand Down
62 changes: 62 additions & 0 deletions scripts/changeset-publish.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/* eslint-disable no-undef */

/* eslint-disable no-console */

/**
* Wrapper around `changeset publish` for CI.
*
* `@changesets/cli` v3 dropped the `🦋 New tag: <pkg>@<version>` lines from the publish
* output, but `dotansimha/changesets-action` still parses exactly those lines to know which
* packages were released (and therefore which GitHub releases to create). Instead of parsing
* the new human-facing output, we ask the CLI for a machine-readable report via
* `CHANGESETS_OUTPUT` (NDJSON, one event per created git tag) and re-emit the legacy lines.
*
* Remove this wrapper once the release action understands the v3 output.
*/
import { spawn } from 'node:child_process';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import process from 'node:process';

const reportPath = path.join(
fs.mkdtempSync(path.join(os.tmpdir(), 'changesets-publish-')),
'report.ndjson',
);

const child = spawn(
process.execPath,
['node_modules/@changesets/cli/bin.js', 'publish', ...process.argv.slice(2)],
{
stdio: 'inherit',
env: { ...process.env, CHANGESETS_OUTPUT: reportPath },
},
);

child.on('close', code => {
if (code === 0) {
for (const line of readReport()) {
if (line.type === 'git-tag' && line.tag) {
console.log(`New tag: ${line.tag}`);
}
}
}
process.exit(code ?? 1);
});
Comment on lines +44 to +45

function readReport() {
if (!fs.existsSync(reportPath)) {
return [];
}
return fs
.readFileSync(reportPath, 'utf8')
.split('\n')
.filter(Boolean)
.map(line => {
try {
return JSON.parse(line);
} catch {
return {};
}
Comment on lines +56 to +60
});
}
Loading
Loading