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.1.0.tar.gz (7.6 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.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tsbuild-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3b96bfc8c85d2f07eda462101af86df611be0ca2946d871d0e10bf4c4abec47a
MD5 f564616ce89fbfe4acab622db70cfecb
BLAKE2b-256 da6cd3b355528c586869c88b640e5111a1cc340f129f3685fe6447a143adbbb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsbuild-1.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: tsbuild-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a672926c61a93f93d9fb9be2fd6e08a342427e9bfa5100c54dbe7d1c3631e9ae
MD5 89e4adccb4d875d117c52b1d157fa707
BLAKE2b-256 e5808261f698cce9fef553da6be9b0cd9bc4d6826d0dfdd3e481fff83fac176f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsbuild-1.1.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