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.6.tar.gz (11.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.3.6-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tsbuild-1.3.6.tar.gz
  • Upload date:
  • Size: 11.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.3.6.tar.gz
Algorithm Hash digest
SHA256 123b6f1d91e790342d458840f9970aca1ffcde4ac625ef88679fb59dd35dbb49
MD5 0568f062922935a4cca3154107cb670f
BLAKE2b-256 583d8421d1d4648d79984a9d758987f491cb5c3336c9a11ea420ea3d7253e677

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tsbuild-1.3.6-py3-none-any.whl
  • Upload date:
  • Size: 9.9 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2f96f4da20e1f36a5090cc5ca7825208de66b641f03e43ca180851d2c84f595e
MD5 e6efd72642f23fd505b43bf2a57fda0d
BLAKE2b-256 e41e58739995a675b6b938d63047ab3fc9dee0d84a6adec6b43b156152168fba

See more details on using hashes here.

Provenance

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