# MCP Builder CLI Deployment Script for Windows PowerShell
param(
[switch]$Npm,
[switch]$Test,
[switch]$Help
)
if ($Help) {
Write-Host "MCP Builder CLI Deployment Script" -ForegroundColor Cyan
Write-Host "Usage: .\deploy.ps1 -Npm [-Test]" -ForegroundColor Yellow
Write-Host " .\deploy.ps1 -Help" -ForegroundColor Yellow
Write-Host ""
Write-Host "Options:" -ForegroundColor Yellow
Write-Host " -Npm Build and prepare for NPM publishing" -ForegroundColor White
Write-Host " -Test Run tests before deployment" -ForegroundColor White
Write-Host " -Help Show this help message" -ForegroundColor White
exit 0
}
if (-not $Npm) {
Write-Host "Please specify -Npm to build for NPM publishing" -ForegroundColor Red
Write-Host "Use -Help for more information" -ForegroundColor Yellow
exit 1
}
Write-Host "π MCP Builder CLI NPM Deployment" -ForegroundColor Cyan
# Check npm
try {
npm --version | Out-Null
Write-Host "β
NPM found" -ForegroundColor Green
} catch {
Write-Host "β NPM not found. Please install Node.js" -ForegroundColor Red
exit 1
}
# Check Node.js version
try {
$nodeVersion = node --version
$majorVersion = [int]($nodeVersion -replace 'v(\d+)\..*', '$1')
if ($majorVersion -lt 18) {
Write-Host "β Node.js version 18 or higher is required. Current version: $nodeVersion" -ForegroundColor Red
exit 1
}
Write-Host "β
Node.js version compatible: $nodeVersion" -ForegroundColor Green
} catch {
Write-Host "β Node.js not found" -ForegroundColor Red
exit 1
}
# Run tests if requested
if ($Test) {
Write-Host "π§ͺ Running tests..." -ForegroundColor Blue
npm run test
if ($LASTEXITCODE -ne 0) {
Write-Host "β Tests failed. Deployment aborted." -ForegroundColor Red
exit 1
}
Write-Host "β
All tests passed" -ForegroundColor Green
}
# Build
Write-Host "π¨ Building..." -ForegroundColor Blue
npm run build
if ($LASTEXITCODE -eq 0) {
Write-Host "β
Build successful" -ForegroundColor Green
} else {
Write-Host "β Build failed" -ForegroundColor Red
exit 1
}
# Test CLI functionality
Write-Host "π§ͺ Testing CLI functionality..." -ForegroundColor Blue
node dist/src/cli/cli-main.js --help | Out-Null
if ($LASTEXITCODE -eq 0) {
Write-Host "β
CLI functionality test passed" -ForegroundColor Green
} else {
Write-Host "β CLI functionality test failed" -ForegroundColor Red
exit 1
}
# Package
Write-Host "π¦ Creating package..." -ForegroundColor Blue
npm pack
Write-Host "β
Package created: mcp-builder-1.0.0.tgz" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host "1. npm login" -ForegroundColor White
Write-Host "2. npm publish" -ForegroundColor White
Write-Host "3. Users can install with: npm install -g mcp-builder" -ForegroundColor White
Write-Host "4. Or run directly with: npx mcp-builder" -ForegroundColor White