-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.ps1
More file actions
83 lines (70 loc) Β· 2.9 KB
/
build.ps1
File metadata and controls
83 lines (70 loc) Β· 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# SecureBit.chat Build Script
# PowerShell script for building the application
Write-Host "π¨ Building SecureBit.chat..." -ForegroundColor Green
# Check if Node.js is installed
if (!(Get-Command node -ErrorAction SilentlyContinue)) {
Write-Host "β Node.js is not installed. Please install Node.js first." -ForegroundColor Red
exit 1
}
# Check if npm is installed
if (!(Get-Command npm -ErrorAction SilentlyContinue)) {
Write-Host "β npm is not installed. Please install npm first." -ForegroundColor Red
exit 1
}
# Install dependencies if needed
if (!(Test-Path "node_modules")) {
Write-Host "π¦ Installing dependencies..." -ForegroundColor Yellow
npm install
}
# Install build tools if needed
Write-Host "π οΈ Installing build tools..." -ForegroundColor Yellow
npm install -D tailwindcss esbuild
npm install qrcode
# Create directories if they don't exist
if (!(Test-Path "dist")) { New-Item -ItemType Directory -Path "dist" }
if (!(Test-Path "assets")) { New-Item -ItemType Directory -Path "assets" }
# Build CSS
Write-Host "π¨ Building Tailwind CSS..." -ForegroundColor Cyan
try {
npx tailwindcss -i src/styles/tw-input.css -o assets/tailwind.css --minify --content "./index.html,./src/**/*.jsx,./src/**/*.js"
Write-Host "β
CSS build completed" -ForegroundColor Green
} catch {
Write-Host "β CSS build failed: $_" -ForegroundColor Red
exit 1
}
# Build JavaScript files
Write-Host "β‘ Building JavaScript files..." -ForegroundColor Cyan
# Build main app
try {
npx esbuild src/app.jsx --bundle --format=esm --outfile=dist/app.js --sourcemap
Write-Host "β
Main app build completed" -ForegroundColor Green
} catch {
Write-Host "β Main app build failed: $_" -ForegroundColor Red
exit 1
}
# Build app bootstrap
try {
npx esbuild src/scripts/app-boot.js --bundle --format=esm --outfile=dist/app-boot.js --sourcemap
Write-Host "β
App bootstrap build completed" -ForegroundColor Green
} catch {
Write-Host "β App bootstrap build failed: $_" -ForegroundColor Red
exit 1
}
# Build QR generator
try {
npx esbuild src/scripts/qr-local.js --bundle --format=esm --outfile=dist/qr-local.js --sourcemap
Write-Host "β
QR generator build completed" -ForegroundColor Green
} catch {
Write-Host "β QR generator build failed: $_" -ForegroundColor Red
exit 1
}
Write-Host "π Build completed successfully!" -ForegroundColor Green
Write-Host "π Output files:" -ForegroundColor Yellow
Write-Host " - assets/tailwind.css" -ForegroundColor White
Write-Host " - dist/app.js" -ForegroundColor White
Write-Host " - dist/app-boot.js" -ForegroundColor White
Write-Host " - dist/qr-local.js" -ForegroundColor White
Write-Host "`nπ You can now serve the application with:" -ForegroundColor Cyan
Write-Host " python -m http.server 8000" -ForegroundColor White
Write-Host " or" -ForegroundColor White
Write-Host " npx http-server" -ForegroundColor White