Bun + TypeScript 開発サーバーをホットリロード付きで1コマンド起動するツール
Project description
tsbuild
tssetup で構築した Bun + TypeScript プロジェクトにおいて、開発サーバーの起動・TypeScript の自動ビルド・ブラウザのホットリロードを1コマンドで一元管理する開発支援ツールです。
🚀 特徴
- 1コマンド起動: ローカルWebサーバー起動・ブラウザ自動起動・TS監視ビルドをすべて開始します。
- ポート衝突の自動回避: デフォルトの 53000 番ポートが使用中の場合、空いているポートを自動で探します。
- 404エラー防止: 起動と同時に初回コンパイルを実行し、ブラウザ起動直後の404エラーを防ぎます。
- ホットリロード:
src/内のコード変更やindex.htmlの編集を検知し、ブラウザを自動でリロードします。 - ゾンビプロセス防止:
Ctrl + Cで終了した際に、バックグラウンドの Bun サーバーを自動停止・クリーンアップします。 - 自動バージョン確認: 実行時に最新バージョンを確認し、更新がある場合は通知します。
🛠️ インストール方法
pip install tsbuild
[!NOTE]
- PowerShell・CMD・Windows Terminal どれからでも使えます。
- 動作には Python 3.9+ と Bun が必要です。
⚙️ 動作に必要な環境(依存関係)
| ツール | 用途 | インストール |
|---|---|---|
| Python 3.9+ | tsbuild 本体の実行 | python.org |
| Bun | 開発サーバー起動・TSコンパイル | powershell -c "irm bun.sh/install.ps1 | iex" |
⚡ 使い方
tssetup で構築したプロジェクトのルートディレクトリ(package.json と server.ts があるフォルダ)で実行します。
tsbuild
プロジェクト外(package.json / server.ts がないディレクトリ)で実行するとバージョン情報・インフォ画面が表示されます。
パラメータ
| パラメータ | 短縮形 | 説明 |
|---|---|---|
--version |
-v |
バージョンを表示 |
--help |
-h |
ヘルプを表示 |
📁 対象プロジェクトの構成
tsbuild は tssetup で作成した以下の構成を前提としています。
my-app/
├── src/
│ └── index.ts ← 編集対象の TypeScript ファイル
├── dist/ ← tsc が自動生成する JS 出力先
├── index.html ← フロントエンドの HTML
├── server.ts ← tsbuild が起動する Bun サーバー
├── tsconfig.json ← TypeScript コンパイラ設定
└── package.json ← Bun プロジェクト設定
🚀 プロジェクトの始め方
# 1. プロジェクトを作成(カレントディレクトリが自動で移動)
tssetup my-app
# 2. 開発サーバーを起動
tsbuild
コマンド実行時の挙動
- ポート自動探索 —
53000番から順に空きポートを検索してサーバーを起動 - 初回ビルド —
bun x tscで初回コンパイルを実行(ブラウザ起動前に JS を生成) - ブラウザ自動起動 —
http://localhost:53000(または自動検出したポート)を開く - リアルタイム監視 —
bun x tsc --watchでファイル変更を検知して自動コンパイル - ホットリロード — ビルド完了後、WebSocket 経由でブラウザに通知してリロード
終了方法
Ctrl + C を押すと、バックグラウンドの Bun サーバーを自動停止してクリーンアップします。
🔄 アップデート
pip install --upgrade tsbuild
✉️ 問い合わせ先
- X (旧Twitter): @Lapius7
- GitHub Issues: Lapius7/tsbuild/issues
⚠️ 免責事項
本ソフトウェアの使用によって生じた直接的・間接的な損害について、作者は一切の責任を負いません。自己責任のもとでご使用ください。
📄 ライセンス & コピーライト
本プロジェクトは MIT License のもとで公開されています。
Copyright (c) 2026 Lapius7
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tsbuild-1.3.1.tar.gz.
File metadata
- Download URL: tsbuild-1.3.1.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb60981a08429debb0c9c5de4c3fbc073cdacb614a8f01eaab6db31b07970235
|
|
| MD5 |
b7ff68752fd7d0df472941ed009fa961
|
|
| BLAKE2b-256 |
c559a2ba9db110fcfe69ca0149742029120b06c9d7618bef83302b1c99e2d15a
|
Provenance
The following attestation bundles were made for tsbuild-1.3.1.tar.gz:
Publisher:
publish.yml on Lapius7/tsbuild
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tsbuild-1.3.1.tar.gz -
Subject digest:
eb60981a08429debb0c9c5de4c3fbc073cdacb614a8f01eaab6db31b07970235 - Sigstore transparency entry: 1810570542
- Sigstore integration time:
-
Permalink:
Lapius7/tsbuild@6fcfd2f72ccf40c0a2ca21199cb2500f4be7932d -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/Lapius7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6fcfd2f72ccf40c0a2ca21199cb2500f4be7932d -
Trigger Event:
release
-
Statement type:
File details
Details for the file tsbuild-1.3.1-py3-none-any.whl.
File metadata
- Download URL: tsbuild-1.3.1-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
652e1b494c50f252709500eba33fcb182a8dc1bfc942cc8329b9bc712de9f959
|
|
| MD5 |
301274ec30b9a0533d06b9c87c475e82
|
|
| BLAKE2b-256 |
47adb1b36e421d62449bdfd985d34412c04c4332542c29ae7c60aca99eb6af47
|
Provenance
The following attestation bundles were made for tsbuild-1.3.1-py3-none-any.whl:
Publisher:
publish.yml on Lapius7/tsbuild
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tsbuild-1.3.1-py3-none-any.whl -
Subject digest:
652e1b494c50f252709500eba33fcb182a8dc1bfc942cc8329b9bc712de9f959 - Sigstore transparency entry: 1810570555
- Sigstore integration time:
-
Permalink:
Lapius7/tsbuild@6fcfd2f72ccf40c0a2ca21199cb2500f4be7932d -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/Lapius7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6fcfd2f72ccf40c0a2ca21199cb2500f4be7932d -
Trigger Event:
release
-
Statement type: