Skip to content

Commit 8e750ed

Browse files
committed
docgen + add publish-rc gh action
1 parent 4474a31 commit 8e750ed

File tree

9 files changed

+151
-9
lines changed

9 files changed

+151
-9
lines changed

.github/workflows/publish-latest.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,30 @@ jobs:
3939
"@commandkit/i18n:packages/i18n"
4040
"@commandkit/devtools:packages/devtools"
4141
"@commandkit/cache:packages/cache"
42+
"@commandkit/analytics:packages/analytics"
43+
"@commandkit/ai:packages/ai"
4244
"@commandkit/queue:packages/queue"
4345
"@commandkit/tasks:packages/tasks"
4446
)
4547
4648
for entry in "${PACKAGES[@]}"; do
4749
IFS=":" read -r name path <<< "$entry"
4850
echo "Publishing $name..."
49-
(pnpm --filter="$name" publish --no-git-checks --access public && echo "✅ Published $name") || echo "❌ Failed to publish $name"
51+
52+
VERSION=$(node -p "require('./$path/package.json').version")
53+
54+
if npm view "$name@$VERSION" version >/dev/null 2>&1; then
55+
echo "📦 $name@$VERSION already exists on npm, skipping..."
56+
else
57+
if pnpm --filter="$name" publish --no-git-checks --access public; then
58+
echo "✅ Published $name@$VERSION"
59+
else
60+
if npm view "$name@$VERSION" version >/dev/null 2>&1; then
61+
echo "📦 $name@$VERSION was published by another process, skipping..."
62+
else
63+
echo "❌ Failed to publish $name@$VERSION"
64+
exit 1
65+
fi
66+
fi
67+
fi
5068
done

.github/workflows/publish-rc.yaml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Publish release candidate builds
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
rc_version:
7+
description: 'Release candidate version number (e.g., 1 for -rc1, 2 for -rc2)'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
publish:
13+
name: Publish release candidate builds
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: pnpm/action-setup@v4
17+
with:
18+
version: '10.14.0'
19+
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 24
25+
registry-url: https://registry.npmjs.org
26+
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile
29+
30+
- name: Validate RC version input
31+
run: |
32+
if ! [[ "${{ github.event.inputs.rc_version }}" =~ ^[0-9]+$ ]]; then
33+
echo "❌ RC version must be a positive integer"
34+
exit 1
35+
fi
36+
37+
- name: Update package versions
38+
run: |
39+
rc_suffix="-rc${{ github.event.inputs.rc_version }}"
40+
echo "Adding suffix: $rc_suffix"
41+
42+
for dir in packages/*; do
43+
[ -f "$dir/package.json" ] || continue
44+
echo "Updating $dir/package.json..."
45+
node -e "
46+
const fs = require('fs');
47+
const path = './$dir/package.json';
48+
const pkg = require(path);
49+
pkg.version += '$rc_suffix';
50+
fs.writeFileSync(path, JSON.stringify(pkg, null, 2));
51+
console.log('Updated ' + pkg.name + ' to version ' + pkg.version);
52+
"
53+
done
54+
55+
- name: Build packages
56+
run: pnpm dlx turbo build --filter='./packages/*'
57+
58+
- name: Publish packages
59+
env:
60+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
61+
run: |
62+
PACKAGES=(
63+
"commandkit:packages/commandkit"
64+
"create-commandkit:packages/create-commandkit"
65+
"@commandkit/legacy:packages/legacy"
66+
"@commandkit/redis:packages/redis"
67+
"@commandkit/i18n:packages/i18n"
68+
"@commandkit/devtools:packages/devtools"
69+
"@commandkit/cache:packages/cache"
70+
"@commandkit/analytics:packages/analytics"
71+
"@commandkit/ai:packages/ai"
72+
"@commandkit/queue:packages/queue"
73+
"@commandkit/tasks:packages/tasks"
74+
)
75+
76+
for entry in "${PACKAGES[@]}"; do
77+
IFS=":" read -r name path <<< "$entry"
78+
echo "Publishing $name..."
79+
80+
VERSION=$(node -p "require('./$path/package.json').version")
81+
82+
if npm view "$name@$VERSION" version >/dev/null 2>&1; then
83+
echo "📦 $name@$VERSION already exists on npm, skipping..."
84+
else
85+
if pnpm --filter="$name" publish --no-git-checks --access public --tag next; then
86+
echo "✅ Published $name@$VERSION under 'next' tag"
87+
else
88+
if npm view "$name@$VERSION" version >/dev/null 2>&1; then
89+
echo "📦 $name@$VERSION was published by another process, skipping..."
90+
else
91+
echo "❌ Failed to publish $name@$VERSION"
92+
exit 1
93+
fi
94+
fi
95+
fi
96+
done
97+
98+
- name: Summary
99+
run: |
100+
echo "🎉 Release candidate build completed!"
101+
echo "📋 Summary:"
102+
echo " RC Version: ${{ github.event.inputs.rc_version }}"
103+
echo " Tag: next"
104+
echo " Suffix: -rc${{ github.event.inputs.rc_version }}"

apps/website/docs/api-reference/commandkit/interfaces/command-context.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
1313

1414
## CommandContext
1515

16-
<GenerationInfo sourceFile="packages/commandkit/src/types.ts" sourceLine="26" packageName="commandkit" />
16+
<GenerationInfo sourceFile="packages/commandkit/src/types.ts" sourceLine="27" packageName="commandkit" />
1717

1818
Represents a command context.
1919

apps/website/docs/api-reference/commandkit/interfaces/command-kit-options.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
1313

1414
## CommandKitOptions
1515

16-
<GenerationInfo sourceFile="packages/commandkit/src/types.ts" sourceLine="16" packageName="commandkit" />
16+
<GenerationInfo sourceFile="packages/commandkit/src/types.ts" sourceLine="17" packageName="commandkit" />
1717

1818
Options for instantiating a CommandKit handler.
1919

apps/website/docs/api-reference/commandkit/types/command-data.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
1313

1414
## CommandData
1515

16-
<GenerationInfo sourceFile="packages/commandkit/src/types.ts" sourceLine="47" packageName="commandkit" />
16+
<GenerationInfo sourceFile="packages/commandkit/src/types.ts" sourceLine="48" packageName="commandkit" />
1717

1818
Represents a command that can be executed by CommandKit.
1919

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "EventHandler"
3+
isDefaultIndex: false
4+
generated: true
5+
---
6+
7+
import MemberInfo from '@site/src/components/MemberInfo';
8+
import GenerationInfo from '@site/src/components/GenerationInfo';
9+
import MemberDescription from '@site/src/components/MemberDescription';
10+
11+
<!-- This file was generated from the CommandKit source. Do not modify. Instead, re-run the "docgen" script -->
12+
13+
14+
## EventHandler
15+
16+
<GenerationInfo sourceFile="packages/commandkit/src/types.ts" sourceLine="59" packageName="commandkit" />
17+
18+
Represents an event handler for a specific event.
19+
20+
```ts title="Signature"
21+
type EventHandler<K extends keyof ClientEvents> = (
22+
...args: ClientEvents[K]
23+
) => void | Promise<void>
24+
```

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
"bootstrap": "turbo gen bootstrap --args",
1212
"check-types": "turbo run --filter=\"./packages/*\" check-types",
1313
"build": "turbo run --filter=\"./packages/*\" build",
14-
"publish-package": "pnpm publish-package",
15-
"build-docs": "pnpm run --filter=\"./apps/website\" build",
1614
"docgen": "tsx ./scripts/docs/generate-typescript-docs.ts && pnpm prettier:format",
1715
"prettier:check": "prettier --check . --ignore-path=.prettierignore",
1816
"prettier:format": "prettier --write . --ignore-path=.prettierignore"

packages/commandkit/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
"check-types": "tsc --noEmit",
150150
"dev": "pnpm run --filter=test-bot dev",
151151
"build": "tsdown",
152-
"publish-package": "npm publish",
153152
"test": "vitest"
154153
},
155154
"repository": {

packages/create-commandkit/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
"scripts": {
3131
"check-types": "tsc --noEmit",
3232
"dev": "tsc --watch",
33-
"build": "tsc",
34-
"publish-package": "npm publish"
33+
"build": "tsc"
3534
},
3635
"dependencies": {
3736
"@clack/prompts": "^0.11.0",

0 commit comments

Comments
 (0)