Skip to content

Commit 255bf05

Browse files
committed
Update publish.ts
1 parent f9fcf08 commit 255bf05

1 file changed

Lines changed: 14 additions & 24 deletions

File tree

script/publish.ts

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,26 @@ const team = [
1919
"opencode-agent[bot]",
2020
]
2121

22-
const PACKAGE_PATHS = [
23-
"packages/opencode",
24-
"packages/desktop",
25-
"packages/tauri",
26-
"packages/sdk",
27-
"packages/plugin",
28-
"packages/extensions/zed",
29-
"packages/ui",
30-
"packages/docs",
31-
"sdks/vscode",
32-
"github",
33-
"nix",
34-
"infra",
35-
"script",
36-
]
22+
function getAreaFromPath(file: string): string {
23+
if (file.startsWith("packages/")) {
24+
const parts = file.replace("packages/", "").split("/")
25+
if (parts[0] === "extensions" && parts[1]) return `extensions/${parts[1]}`
26+
return parts[0] ?? "other"
27+
}
28+
if (file.startsWith("sdks/")) {
29+
return file.replace("sdks/", "").split("/")[0] ?? "other"
30+
}
31+
const rootDir = file.split("/")[0]
32+
if (rootDir && !rootDir.includes(".")) return rootDir
33+
return "other"
34+
}
3735

3836
async function getAreasForCommit(hash: string): Promise<string[]> {
3937
const files = await $`git diff-tree --no-commit-id --name-only -r ${hash}`.text()
4038
const areas = new Set<string>()
41-
4239
for (const file of files.split("\n").filter(Boolean)) {
43-
for (const pkg of PACKAGE_PATHS) {
44-
if (file.startsWith(pkg + "/") || file === pkg) {
45-
const area = pkg.replace("packages/", "").replace("sdks/", "")
46-
areas.add(area)
47-
break
48-
}
49-
}
40+
areas.add(getAreaFromPath(file))
5041
}
51-
5242
return [...areas]
5343
}
5444

0 commit comments

Comments
 (0)