パッケージの詳細

port-claim

jasenmichael1.3kMIT3.0.0

If a port is in use, port-claim stops the process using it.

port, port-availability, process, port-conflict

readme

port-claim

If a port is in use, port-claim stops the process using it.


Installation

Via npm or pnpm (global)

# Using npm
npm install -g port-claim

# Using pnpm
pnpm add -g port-claim

In a project (package.json)

# Using npm
npm install port-claim --save-dev

# Using pnpm
pnpm add -D port-claim

Then add to your package.json scripts:

"scripts": {
  "predev": "port-claim 3000",
  "dev": "nuxt dev"
  // "dev": "port-claim 3000 && nuxt dev"
}

Via Cargo (Rust)

# Install directly from crates.io
cargo install port-claim

# Or install from source
git clone https://github.com/jasenmichael/port-claim.git
cd port-claim
cargo install --path .

Binary Installation

You can download pre-compiled binaries from the GitHub Releases page.

Available for:

  • Linux (x64, arm64, x86)
  • macOS (x64, arm64)
  • Windows (x64, x86)

Usage

port-claim -h | --help | -V | --version
port-claim <port> [<additional-ports>] [-v | --verbose]

Options

  • -h, --help: Prints usage information
  • -V, --version: Prints the version
  • -v, --verbose: Prints verbose information about port status and process killing

Arguments

  • <port>: Required argument specifying the port to check and kill if in use
  • [<additional-ports>]: Optional additional ports to check and kill

Examples

# Check if port 8080 is in use and kill the process if it is
port-claim 8080

# Check multiple ports with verbose output
port-claim 3000 8080 9000 --verbose

# Display help information
port-claim --help

# Display version information
port-claim --version

How It Works

  1. When you specify one or more ports, the tool checks if each port is available.
  2. If a port is in use, the tool attempts to kill the process using that port.
  3. With the --verbose flag, the tool will print information about each step of the process.

Platform Support

The tool works on both Unix-based systems (Linux, macOS) and Windows, using different system commands to identify and kill processes on each platform.

Development

# Clone the repository
git clone https://github.com/jasenmichael/port-claim.git
cd port-claim

# Install dependencies (for the npm wrapper)
npm install

# Build the Rust binary
cargo build --release

# Run tests
cargo test

# Format code
cargo fmt

# Lint code
cargo clippy

更新履歴

Changelog

v3.0.0

compare changes

🚀 Enhancements

  • Update package configuration for binary distribution (975cf64)
  • Add Rust implementation (a8cbc3c)
  • Add binary-install JavaScript wrapper (59d6574)
  • ⚠️ Rewrite in Rust (120c28c)

📖 Documentation

  • Update project documentation for Rust implementation (56b0716)

🏡 Chore

✅ Tests

🤖 CI

⚠️ Breaking Changes

❤️ Contributors

v2.0.0

compare changes

🚀 Enhancements

  • Update package configuration for binary distribution (975cf64)
  • Add Rust implementation (a8cbc3c)
  • Add binary-install JavaScript wrapper (59d6574)
  • ⚠️ Rewrite in Rust (120c28c)

📖 Documentation

  • Update project documentation for Rust implementation (56b0716)

🏡 Chore

  • Remove TypeScript implementation (293a441)
  • release: V2.0.0 (b35e8ee)

✅ Tests

🤖 CI

⚠️ Breaking Changes

❤️ Contributors

v2.0.0

compare changes

🚀 Enhancements

  • Update package configuration for binary distribution (975cf64)
  • Add Rust implementation (a8cbc3c)
  • Add binary-install JavaScript wrapper (59d6574)
  • ⚠️ Rewrite in Rust (120c28c)

📖 Documentation

  • Update project documentation for Rust implementation (56b0716)

🏡 Chore

  • Remove TypeScript implementation (293a441)

✅ Tests

🤖 CI

⚠️ Breaking Changes

❤️ Contributors

v1.1.0

🚀 Enhancements

📖 Documentation

📦 Build

  • Add project dependencies and configuration (a37513b)
  • Add TypeScript configuration (e244f74)
  • Add vite.config (6ba5db4)

🏡 Chore

✅ Tests

❤️ Contributors