Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
44c8cfb
chore: yarn
johngeorgewright Jun 12, 2024
958370b
ci: upgrade actions
johngeorgewright Jan 22, 2026
e3876cc
chore: node@24
johngeorgewright Jan 22, 2026
9415821
chore: remove yarn and use bun
johngeorgewright Jan 23, 2026
6e410fd
chore: remove yarn and use bun
johngeorgewright Jan 23, 2026
a61c875
chore: don't auto clean before building
johngeorgewright Jan 23, 2026
e876773
ci: use release-please
johngeorgewright Jan 23, 2026
edc64e5
ci: extract complicated build
johngeorgewright Jan 23, 2026
cee481d
ci: fix release command
johngeorgewright Jan 23, 2026
7a0e266
Merge branch 'main' of github.com:johngeorgewright/stream
johngeorgewright Jan 23, 2026
3fed494
Merge branch 'main' into upgrade
johngeorgewright Jan 23, 2026
613d22e
chore: use linting
johngeorgewright Jan 23, 2026
5425a65
chore: upgrade dev deps
johngeorgewright Jan 23, 2026
5d38b4c
fix: make sure to use import extensions
johngeorgewright Jan 23, 2026
7aefe3e
chore: use txconfig references for building
johngeorgewright Jan 26, 2026
ad144cc
test: wrap all files in describes
johngeorgewright Jan 26, 2026
9df10c3
test: wrap all files in describes
johngeorgewright Jan 26, 2026
f598711
test: wrap all files in describes
johngeorgewright Jan 26, 2026
dbf61c1
refactor: midly simplify tsconfig
johngeorgewright Jan 26, 2026
312ed94
ci: remove unused action
johngeorgewright Jan 26, 2026
a08a6c7
docs: correct examples
johngeorgewright Jan 27, 2026
82d20bd
refactor: undefined/void
johngeorgewright Jan 27, 2026
3880fb6
refactor: only reference things we need at test
johngeorgewright Jan 27, 2026
ea3b812
chore: add simple scaffolder
johngeorgewright Jan 27, 2026
2568f64
chore(scaffold): use external package
johngeorgewright Jan 27, 2026
d746712
fix: add .js import extensions
johngeorgewright Jan 27, 2026
6c9aca5
chore: move to node.js
johngeorgewright May 27, 2026
2439b38
ci: drop bun
johngeorgewright May 27, 2026
5597ead
ci: concurrent processes
johngeorgewright May 27, 2026
908baa7
chore: specify node version
johngeorgewright May 27, 2026
116601b
ci: install deps
johngeorgewright May 27, 2026
8bc2213
chore: publish ignore list
johngeorgewright May 27, 2026
e8a74f1
ci: use token generator
johngeorgewright May 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
111 changes: 111 additions & 0 deletions .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
description: Use Bun instead of Node.js, npm, pnpm, or vite.
globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
alwaysApply: false
---

Default to using Bun instead of Node.js.

- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
- Use `bun test` instead of `jest` or `vitest`
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
- Use `bunx <package> <command>` instead of `npx <package> <command>`
- Bun automatically loads .env, so don't use dotenv.

## APIs

- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
- `Bun.redis` for Redis. Don't use `ioredis`.
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
- `WebSocket` is built-in. Don't use `ws`.
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
- Bun.$`ls` instead of execa.

## Testing

Use `bun test` to run tests.

```ts#index.test.ts
import { test, expect } from "bun:test";

test("hello world", () => {
expect(1).toBe(1);
});
```

## Frontend

Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.

Server:

```ts#index.ts
import index from "./index.html"

Bun.serve({
routes: {
"/": index,
"/api/users/:id": {
GET: (req) => {
return new Response(JSON.stringify({ id: req.params.id }));
},
},
},
// optional websocket support
websocket: {
open: (ws) => {
ws.send("Hello, world!");
},
message: (ws, message) => {
ws.send(message);
},
close: (ws) => {
// handle close
}
},
development: {
hmr: true,
console: true,
}
})
```

HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.

```html#index.html
<html>
<body>
<h1>Hello, world!</h1>
<script type="module" src="./frontend.tsx"></script>
</body>
</html>
```

With the following `frontend.tsx`:

```tsx#frontend.tsx
import React from "react";
import { createRoot } from "react-dom/client";

// import .css files directly and it works
import './index.css';

const root = createRoot(document.body);

export default function Frontend() {
return <h1>Hello, world!</h1>;
}

root.render(<Frontend />);
```

Then, run index.ts

```sh
bun --hot ./index.ts
```

For more information, read the Bun API docs in `node_modules/bun-types/docs/**.mdx`.
23 changes: 0 additions & 23 deletions .eslintrc.cjs

This file was deleted.

48 changes: 1 addition & 47 deletions .github/workflows/bots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,6 @@ jobs:
runs-on: ubuntu-latest
if: github.actor == 'renovate[bot]' || github.actor == 'dependabot[bot]'
steps:
- uses: hmarr/auto-approve-action@v3
- uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.PUSH_TOKEN }}

yarn-sdk:
name: Rebuild Yarn SDKs
runs-on: ubuntu-latest
if: github.actor == 'renovate[bot]' || github.actor == 'dependabot[bot]'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Use Node.js
id: node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Restore cache
uses: actions/cache@v3
id: cache
with:
path: |
.yarn/unplugged
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ steps.node.outputs.node-version }}-${{ hashFiles('**/yarn.lock') }}

- name: Yarn
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Update SDKs
run: yarn dlx @yarnpkg/sdks

- name: Commit
run: |
git config user.name "$(git log -n 1 --pretty=format:%an)"
git config user.email "$(git log -n 1 --pretty=format:%ae)"
git add .yarn

if [[ $(git status --short) ]]
then
git commit -m "chore: rebuild yarn sdks"
git push
fi
63 changes: 31 additions & 32 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ "main" ]
branches: ['main']
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ['main']
schedule:
- cron: '41 20 * * 1'

Expand All @@ -32,45 +32,44 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v6

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v4

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: '/language:${{matrix.language}}'
49 changes: 9 additions & 40 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,19 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Install Node.js
id: node
uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: actions/configure-pages@v5
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc

- name: Restore cache
uses: actions/cache@v3
id: cache
with:
path: |
.yarn/unplugged
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ steps.node.outputs.node-version }}-${{ hashFiles('**/yarn.lock') }}

- name: Yarn
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Install Ruby
uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Bundle
run: bundle install

- name: Build
run: yarn build

- name: Build Docs
run: yarn build:docs

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
- run: bundle install
- run: npm ci
- run: npm run build:docs
- uses: actions/upload-pages-artifact@v4
with:
path: docs/_site

- name: Deploy to GitHub Pages
id: deployment
- id: deployment
uses: actions/deploy-pages@v4
45 changes: 5 additions & 40 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,11 @@ name: Pull Request

on:
pull_request:
types: [opened, synchronize]

concurrency:
cancel-in-progress: true
group: pr-${{ github.head_ref }}

jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
pull-requests: write
strategy:
matrix:
node-version: [18, 20, 21]
steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Meta
id: meta
run: echo "node-version=$(cat .nvmrc)" >> $GITHUB_OUTPUT

- name: Use Node.js ${{ matrix.node-version }}
id: node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Restore cache
uses: actions/cache@v3
id: cache
with:
path: |
.yarn/unplugged
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ steps.node.outputs.node-version }}-${{ hashFiles('**/yarn.lock') }}

- name: Yarn
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Build
run: yarn build

- name: Test
run: yarn test
uses: ./.github/workflows/test.yml
Loading