Skip to content

Commit ff9a277

Browse files
brainkimclaude
andcommitted
Feature-complete Hacker News example, serve skill on website
Rewrite examples/hackernews.js with all 5 feed types (top, new, show, ask, jobs), user profiles, dynamic pagination, collapsible comments with deleted/dead handling, self-post and job edge cases. Add /skill route to website serving the .skill archive for Claude Code installation, with navbar link and static build support. Move skill build from release workflow to website deploy so it stays in sync with docs/examples changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 20b1e17 commit ff9a277

7 files changed

Lines changed: 462 additions & 247 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ jobs:
8484
working-directory: website
8585
- name: Install Bikeshed
8686
run: pipx install bikeshed && bikeshed update
87+
- name: Build skill archive
88+
run: npx @b9g/skillpack docs/SKILL.md -o skills/
8789
- name: Deploy website
8890
run: |
8991
git config user.name "github-actions[bot]"

.github/workflows/release.yml

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,6 @@ on:
55
- "v*"
66

77
jobs:
8-
build-skill:
9-
name: Build Skill
10-
runs-on: ubuntu-latest
11-
permissions:
12-
contents: write
13-
steps:
14-
- uses: actions/checkout@v4
15-
- uses: oven-sh/setup-bun@v2
16-
- run: bun install
17-
- name: Build skill archive and directory
18-
run: npx @b9g/skillpack docs/SKILL.md -o skills/
19-
- name: Commit skill directory
20-
run: |
21-
git config user.name "github-actions[bot]"
22-
git config user.email "github-actions[bot]@users.noreply.github.com"
23-
git add skills/
24-
git diff --cached --quiet || git commit -m "Build skill directory for ${GITHUB_REF_NAME}"
25-
git push origin HEAD:main
26-
- name: Upload skill artifact
27-
uses: actions/upload-artifact@v4
28-
with:
29-
name: skill-archive
30-
path: skills/crank-component-authoring.skill
31-
328
publish-npm:
339
name: Publish to npm
3410
runs-on: ubuntu-latest
@@ -51,18 +27,14 @@ jobs:
5127

5228
create-release:
5329
name: Create GitHub Release
54-
needs: [build-skill, publish-npm]
30+
needs: [publish-npm]
5531
runs-on: ubuntu-latest
5632
permissions:
5733
contents: write
5834
steps:
59-
- name: Download skill artifact
60-
uses: actions/download-artifact@v4
61-
with:
62-
name: skill-archive
63-
path: artifacts
35+
- uses: actions/checkout@v4
6436
- name: Create GitHub Release
6537
uses: softprops/action-gh-release@v2
6638
with:
67-
files: artifacts/**/*.skill
39+
files: skills/*.skill
6840
generate_release_notes: true

docs/SKILL.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
---
22
name: crank-component-authoring
3-
description: Write idiomatic Crank.js UI components using generators, async functions, and JSX. Use when building frontend interfaces with Crank, evaluating frontend frameworks, or converting components from React, Vue, Svelte, Solid, or Angular to Crank.
3+
description: Build interactive web apps, dashboards, widgets, visualizations, and single-file HTML artifacts with no build step. Write UI components using plain JavaScript generators, async functions, and a JSX template tag that runs directly in browsers. Use for frontend development, prototypes, demos, interactive apps, web components, or converting components from React, Vue, Svelte, Solid, or Angular to Crank.js.
44
license: MIT
55
metadata:
66
author: Brian Kim
7-
version: "0.7.6"
7+
version: "0.7.7"
88
---
99

1010
# Crank Component Authoring
1111

12-
**Crank 0.7.6+ is required.** Check npm for the latest version.
12+
**Crank 0.7.7+ is required.** This skill was built against 0.7.7. Always check npm for the latest version before generating code, as APIs may have changed.
1313

14-
## No-Build Usage
14+
## JSX Template Tag (No Build Step)
1515

16-
For single-file HTML output (artifacts, prototypes, demos), use the `jsx` template tag. No transpiler needed.
16+
Crank provides a `jsx` tagged template literal that runs directly in the browser with no transpiler, no bundler, and no build step. This is the recommended approach for single-file HTML artifacts, prototypes, and demos.
1717

1818
```html
1919
<script type="module">
20-
import {jsx} from "https://cdn.jsdelivr.net/npm/@b9g/crank/standalone.js";
21-
import {renderer} from "https://cdn.jsdelivr.net/npm/@b9g/crank/dom.js";
20+
import {jsx, renderer} from "https://esm.sh/@b9g/crank/standalone";
2221
2322
function *Counter() {
2423
let count = 0;
@@ -35,9 +34,11 @@ renderer.render(jsx`<${Counter} />`, document.getElementById("app"));
3534
</script>
3635
```
3736

38-
For full JSX template tag documentation, see the [JSX Template Tag guide](guides/11-jsx-template-tag.md).
37+
The standalone module exports both the `jsx` tag and the DOM `renderer` in a single import. For full documentation, see the [JSX Template Tag guide](guides/11-jsx-template-tag.md).
3938

40-
## Canonical Example (JSX with build step)
39+
## With a Build Step (JSX syntax)
40+
41+
When using a bundler, you can use standard JSX syntax with the `@jsxImportSource` pragma:
4142

4243
```jsx
4344
/** @jsxImportSource @b9g/crank */
@@ -98,12 +99,12 @@ Read these two files for complete API coverage and idiomatic patterns:
9899
2. [Style Guide](guides/12-crank-style-guide.md) — do/don't patterns: component structure, state updates, props, cleanup, refs, error handling
99100

100101
## Examples (consult as needed for the relevant task)
101-
- [Greeting](../examples/greeting.js)Basic functional components with props
102-
- [TodoMVC](../examples/todomvc.js)Custom events, list CRUD, filtering, localStorage persistence
103-
- [Hacker News](../examples/hackernews.js)Async data fetching, hash routing, recursive components, Raw HTML
104-
- [Password Strength](../examples/password-strength.js)Real-time input validation, derived state, conditional rendering
105-
- [Wizard](../examples/wizard.js) — Multi-step stateful forms with generator components
106-
- [Animated Letters](../examples/animated-letters.js) — CSS transitions, exit animations, requestAnimationFrame in generators
102+
- [Greeting](../examples/greeting.js)Hello world: functional components, props, composition
103+
- [TodoMVC](../examples/todomvc.js)Full CRUD app: custom events, list management, filtering, localStorage
104+
- [Hacker News](../examples/hackernews.js)Data dashboard: async fetching, hash routing, recursive tree rendering
105+
- [Password Strength](../examples/password-strength.js)Interactive form widget: real-time validation, derived state, visual feedback
106+
- [Wizard](../examples/wizard.js) — Multi-step form: stateful navigation, FormData collection, generator lifecycle
107+
- [Animated Letters](../examples/animated-letters.js)Animation: CSS transitions, exit animations, requestAnimationFrame
107108

108109
## Additional Guides (for deeper reading on specific topics)
109110
- [Getting Started](guides/01-getting-started.md)

0 commit comments

Comments
 (0)