Skip to content

Commit 5ff4003

Browse files
dahliaclaude
andcommitted
Add Node.js support alongside Deno
- Add package.json with npm dependencies - Configure tsdown for Node.js builds - Update test imports to use node: protocol - Add pnpm lockfile for dependency management - Configure GitHub Actions for both Deno and Node.js - Update development tooling configuration Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3daeab1 commit 5ff4003

22 files changed

+3909
-1502
lines changed

.claude/settings.local.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"WebFetch(domain:nodejs.org)",
5+
"Bash(grep:*)",
6+
"Bash(rg:*)",
7+
"Bash(awk:*)",
8+
"Bash(sed:*)",
9+
"Bash(deno task:*)",
10+
"Bash(deno test:*)"
11+
],
12+
"deny": []
13+
}
14+
}

.github/workflows/main.yaml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ jobs:
1616
- uses: denoland/setup-deno@v2
1717
with:
1818
deno-version: v2.x
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: "22"
22+
- uses: pnpm/action-setup@v4
23+
with:
24+
version: 10
1925
- run: deno task test --coverage --junit-path=junit.xml
2026
env:
2127
RUST_BACKTRACE: ${{ runner.debug }}
@@ -33,6 +39,8 @@ jobs:
3339
with:
3440
token: ${{ secrets.CODECOV_TOKEN }}
3541
files: coverage.lcov
42+
- run: pnpm install
43+
- run: pnpm test
3644
- run: deno task check
3745

3846
publish:
@@ -47,16 +55,44 @@ jobs:
4755
- uses: denoland/setup-deno@v2
4856
with:
4957
deno-version: v2.x
58+
- uses: actions/setup-node@v4
59+
with:
60+
node-version: "22"
61+
- uses: pnpm/action-setup@v4
62+
with:
63+
version: 10
5064
- if: github.ref_type == 'branch'
5165
run: |
66+
set -euo pipefail
5267
jq \
5368
--arg build "$GITHUB_RUN_NUMBER" \
5469
--arg commit "${GITHUB_SHA::8}" \
5570
'.version = .version + "-dev." + $build + "+" + $commit' \
5671
deno.json > deno.json.tmp
5772
mv deno.json.tmp deno.json
73+
jq \
74+
--arg build "$GITHUB_RUN_NUMBER" \
75+
--arg commit "${GITHUB_SHA::8}" \
76+
'.version = .version + "-dev." + $build + "+" + $commit' \
77+
package.json > package.json.tmp
78+
mv package.json.tmp package.json
5879
- if: github.ref_type == 'tag'
59-
run: '[[ "$(jq -r .version deno.json)" = "$GITHUB_REF_NAME" ]]'
80+
run: |
81+
set -euo pipefail
82+
[[ "$(jq -r .version deno.json)" = "$GITHUB_REF_NAME" ]]
83+
[[ "$(jq -r .version package.json)" = "$GITHUB_REF_NAME" ]]
84+
- run: |
85+
set -euo pipefail
86+
pnpm config set //registry.npmjs.org/:_authToken "$NPM_AUTH_TOKEN"
87+
pnpm install
88+
if [[ "$GITHUB_REF_TYPE" = tag ]]; then
89+
pnpm publish --access public --no-git-checks
90+
else
91+
pnpm publish --access public --no-git-checks --tag dev
92+
fi
93+
env:
94+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
95+
NPM_CONFIG_PROVENANCE: "true"
6096
- run: deno publish --allow-dirty
6197
- if: github.ref_type == 'tag'
6298
id: extract-changelog
@@ -77,6 +113,7 @@ jobs:
77113
body_path: ${{ steps.extract-changelog.outputs.output-file }}
78114
name: BotKit ${{ github.ref_name }}
79115
generate_release_notes: false
116+
files: fedify-botkit-*.tgz
80117

81118
publish-docs:
82119
if: github.event_name == 'push'

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
coverage/
2+
dist/
3+
node_modules/
4+
fedify-botkit-*.tgz

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"Pixelfed",
6969
"smallweb",
7070
"Tailscale",
71+
"tsdown",
7172
"unfollow",
7273
"unfollowed",
7374
"unfollowing",

deno.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,22 @@
2121
"@fedify/fedify": "jsr:@fedify/fedify@^1.6.1",
2222
"@fedify/markdown-it-hashtag": "jsr:@fedify/markdown-it-hashtag@^0.3.0",
2323
"@fedify/markdown-it-mention": "jsr:@fedify/markdown-it-mention@^0.3.0",
24-
"@hongminhee/x-forwarded-fetch": "jsr:@hongminhee/x-forwarded-fetch@^0.2.0",
2524
"@logtape/logtape": "jsr:@logtape/logtape@^1.0.0",
2625
"@phensley/language-tag": "npm:@phensley/language-tag@^1.12.2",
27-
"@std/assert": "jsr:@std/assert@^1.0.12",
2826
"hono": "jsr:@hono/hono@^4.8.2",
2927
"html-entities": "npm:html-entities@^2.6.0",
3028
"markdown-it": "npm:markdown-it@^14.1.0",
3129
"mime-db": "npm:mime-db@^1.54.0",
30+
"tsdown": "npm:tsdown@^0.12.8",
3231
"uuid": "npm:uuid@^11.1.0",
32+
"x-forwarded-fetch": "jsr:@hongminhee/x-forwarded-fetch@^0.2.0",
3333
"xss": "npm:xss@^1.0.15"
3434
},
35-
"lock": false,
35+
"nodeModulesDir": "none",
3636
"exclude": [
3737
".github",
3838
".vscode",
39+
"dist",
3940
"docs",
4041
"src/css"
4142
],
@@ -48,8 +49,7 @@
4849
]
4950
},
5051
"tasks": {
51-
"embed-css": "deno run -A jsr:@smallweb/embed src/css src/static",
52-
"check": "deno check src/ && deno lint && deno fmt --check && deno publish --dry-run --allow-dirty",
52+
"check": "deno check src/ && deno lint && deno fmt --check && deno publish --dry-run --allow-dirty && deno run scripts/check_versions.ts",
5353
"test": "deno test --allow-env=NODE_V8_COVERAGE,JEST_WORKER_ID --allow-net=hollo.social --parallel",
5454
"test-all": "deno task check && deno task test",
5555
"coverage": "deno task test --coverage --clean && deno coverage --html",

0 commit comments

Comments
 (0)