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
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ jobs:
- run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- run: pnpm publish --dir ./opencode --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

### 🏡 Chore

- **release:** Simplify release flow to one script and sync version for wrapper `opencode` package
- **release:** Publish wrapper package from `opencode/` in release workflow
- **release:** Keep single root changelog/release and sync wrapper package metadata only

### ⚠️ Notes

- **db path:** `createObsxa()` now defaults to an XDG-compliant data path (`~/.local/share/obsxa/obsxa.db` on Linux) instead of `./obsxa.db`. Pass `db: "./obsxa.db"` explicitly to keep legacy location.
Expand Down
1 change: 1 addition & 0 deletions opencode/index.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { createObsxaPlugin, createObsxaPlugin as default } from "obsxa/opencode";
2 changes: 2 additions & 0 deletions opencode/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { createObsxaPlugin } from "obsxa/opencode";
export { createObsxaPlugin as default } from "obsxa/opencode";
26 changes: 26 additions & 0 deletions opencode/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "obsxa-opencode",
"version": "0.0.2",
"description": "OpenCode plugin wrapper package for obsxa",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/oritwoen/obsxa.git"
},
"files": [
"index.mjs",
"index.d.mts"
],
"type": "module",
"main": "./index.mjs",
"types": "./index.d.mts",
"exports": {
".": {
"types": "./index.d.mts",
"default": "./index.mjs"
}
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"dependencies": {
"obsxa": "0.0.2"
}
Comment thread
oritwoen marked this conversation as resolved.
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"test:run": "vitest --run",
"generate": "drizzle-kit generate",
"prepack": "pnpm run build",
"release": "pnpm test:run && pnpm build && changelogen --release --push"
"release": "pnpm test:run && pnpm build && node ./scripts/release-with-opencode.mjs"
},
"dependencies": {
"@libsql/client": "^0.17.0",
Expand Down
47 changes: 47 additions & 0 deletions scripts/release-with-opencode.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { execFileSync } from "node:child_process";
import { existsSync, readFileSync, writeFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";

const rootDir = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const packageJsonPath = resolve(rootDir, "package.json");
const opencodePackageJsonPath = resolve(rootDir, "opencode/package.json");

function runChangelogen(args) {
execFileSync("changelogen", args, {
cwd: rootDir,
stdio: "inherit",
});
Comment thread
oritwoen marked this conversation as resolved.
}

function readRootVersion() {
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
const version = packageJson.version;
if (typeof version !== "string" || version.length === 0) {
throw new Error("Missing version in package.json");
}
return version;
}

function syncOpencodePackageVersion(version) {
if (!existsSync(opencodePackageJsonPath)) {
throw new Error(`Missing wrapper package definition at ${opencodePackageJsonPath}`);
}

const opencodePackageJson = JSON.parse(readFileSync(opencodePackageJsonPath, "utf8"));
opencodePackageJson.version = version;
opencodePackageJson.dependencies ??= {};
opencodePackageJson.dependencies.obsxa = version;
writeFileSync(
opencodePackageJsonPath,
`${JSON.stringify(opencodePackageJson, null, 2)}\n`,
"utf8",
);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

runChangelogen(["--bump"]);

const version = readRootVersion();
syncOpencodePackageVersion(version);

runChangelogen(["--release", "-r", version, "--push"]);
Loading