Skip to main content

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.jsonserver.ts があるフォルダ)で実行します。

tsbuild

プロジェクト外(package.json / server.ts がないディレクトリ)で実行するとバージョン情報・インフォ画面が表示されます。

パラメータ

パラメータ 短縮形 説明
--version -v バージョンを表示
--help -h ヘルプを表示

📁 対象プロジェクトの構成

tsbuildtssetup で作成した以下の構成を前提としています。

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

コマンド実行時の挙動

  1. ポート自動探索53000 番から順に空きポートを検索してサーバーを起動
  2. 初回ビルドbun x tsc で初回コンパイルを実行(ブラウザ起動前に JS を生成)
  3. ブラウザ自動起動http://localhost:53000(または自動検出したポート)を開く
  4. リアルタイム監視bun x tsc --watch でファイル変更を検知して自動コンパイル
  5. ホットリロード — ビルド完了後、WebSocket 経由でブラウザに通知してリロード

終了方法

Ctrl + C を押すと、バックグラウンドの Bun サーバーを自動停止してクリーンアップします。


🔄 アップデート

pip install --upgrade tsbuild

✉️ 問い合わせ先


⚠️ 免責事項

本ソフトウェアの使用によって生じた直接的・間接的な損害について、作者は一切の責任を負いません。自己責任のもとでご使用ください。


📄 ライセンス & コピーライト

本プロジェクトは MIT License のもとで公開されています。

Copyright (c) 2026 Lapius7

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsbuild-1.3.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsbuild-1.3.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file tsbuild-1.3.0.tar.gz.

File metadata

  • Download URL: tsbuild-1.3.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tsbuild-1.3.0.tar.gz
Algorithm Hash digest
SHA256 2e69dbd8d42d7bdb809bcdd644ccb6c6f5bb2489b2002bc4469b709e54be824a
MD5 7b8360ebbc620503e57d5d2685227184
BLAKE2b-256 e5bd8773e4547c11f43eb884339fe2f30996da7751cebe9bd124d7c8f55b8639

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsbuild-1.3.0.tar.gz:

Publisher: publish.yml on Lapius7/tsbuild

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsbuild-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: tsbuild-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tsbuild-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3cb2549887ded7bc889750e99297d2bb45da513c9cab4f0244c4edadd81582d
MD5 463b3a8884a1f60ac9e3a070a9954990
BLAKE2b-256 0ce66c4dfd0c9d7d3331559121762bd0b71d3a01ad218a1ece788bfc3f610bfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsbuild-1.3.0-py3-none-any.whl:

Publisher: publish.yml on Lapius7/tsbuild

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page