tsbuild
tssetup で構築した Bun + TypeScript プロジェクトにおいて、開発サーバーの起動・TypeScript の自動ビルド・ブラウザのホットリロードを1コマンドで一元管理する開発支援ツールです。
🚀 特徴
- 1コマンド起動: ローカルWebサーバー起動・ブラウザ自動起動・TS監視ビルドをすべて開始します。
- ポート衝突の自動回避: デフォルトの 53000 番ポートが使用中の場合、空いているポートを自動で探します。
- 404エラー防止: 起動と同時に初回コンパイルを実行し、ブラウザ起動直後の404エラーを防ぎます。
- ホットリロード:
src/内のコード変更やindex.htmlの編集を検知し、ブラウザを自動でリロードします。 - ゾンビプロセス防止:
Ctrl + Cで終了した際に、バックグラウンドの Bun サーバーを自動停止・クリーンアップします。 - 自動バージョン確認: 実行時に最新バージョンを確認し、更新がある場合は通知します。
🛠️ インストール方法
npm(推奨):
npm i -g @lapius/tsbuild
tsbuild コマンドが使えるようになります(Node.js 18 以降が必要。本体はシステムの Python 3.9+ で動きます)。
pip:
pip install tsbuild
⚙️ 動作に必要な環境(依存関係)
| ツール | 用途 | インストール |
|---|---|---|
| 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 サーバーを自動停止してクリーンアップします。
🔄 アップデート
npm で入れた場合:
npm i -g @lapius/tsbuild
pip で入れた場合:
pip install --upgrade tsbuild
どちらの場合も tsbuild --update で、入れた方法に合わせて更新できます。
✉️ 問い合わせ先
- X (旧Twitter): @Lapius7
- GitHub Issues: Lapius7/tsbuild/issues
⚠️ 免責事項
本ソフトウェアの使用によって生じた直接的・間接的な損害について、作者は一切の責任を負いません。自己責任のもとでご使用ください。
📄 ライセンス & コピーライト
本プロジェクトは MIT License のもとで公開されています。
Copyright (c) 2026 Lapius7
Metadata
Release files for tsbuild 1.3.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tsbuild-1.3.8.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tsbuild-1.3.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.3 kB
Release files / tsbuild-1.3.8.tar.gz
| Download URL | tsbuild-1.3.8.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
033e15e99037214da857f9335565ac1be52ba8f49037fe8d692c68bbd1c74120
|
|
BLAKE2b-256 checksum How to use checksums |
b9a2acb578f7152315ad494971640b2c0e83168605067d295718e445368b51e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logRelease files / tsbuild-1.3.8-py3-none-any.whl
| Download URL | tsbuild-1.3.8-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2041dfcc97323fbff29ef59fff5a3444bef0bfb66b9f8b8092b809245c570254
|
|
BLAKE2b-256 checksum How to use checksums |
6165aa6fe9f8c05da9a5f174610b72cc29f6903059f63b9dfbf016475293b6ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency log