-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-wasm.ps1
More file actions
80 lines (70 loc) · 2.54 KB
/
build-wasm.ps1
File metadata and controls
80 lines (70 loc) · 2.54 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
# Quantum ARK WASM Build Script for Windows
# Compiles Rust code to WebAssembly and generates npm package
$ErrorActionPreference = "Stop"
Write-Host "🔨 Building Quantum ARK for WebAssembly..." -ForegroundColor Cyan
# Create output directory
if (-not (Test-Path "pkg")) {
New-Item -ItemType Directory -Path "pkg" | Out-Null
}
# Compile to WASM
Write-Host "📦 Compiling to wasm32-unknown-unknown..." -ForegroundColor Yellow
& "$env:USERPROFILE\.cargo\bin\cargo.exe" build --target wasm32-unknown-unknown --release
# Copy WASM binary
Write-Host "📋 Copying WASM binary..." -ForegroundColor Yellow
Copy-Item "target\wasm32-unknown-unknown\release\quantum_ark.wasm" "pkg\" -Force
# Generate JavaScript bindings using wasm-bindgen
Write-Host "🔗 Generating JavaScript bindings..." -ForegroundColor Yellow
& "$env:USERPROFILE\.cargo\bin\wasm-bindgen.exe" "pkg\quantum_ark.wasm" --out-dir "pkg" --target web
# Create package.json for npm
Write-Host "📝 Creating package.json..." -ForegroundColor Yellow
$packageJson = @{
name = "quantum_ark"
version = "0.3.0"
description = "Post-quantum cryptographic hashing library with neural network chaos and lattice-based security"
main = "quantum_ark.js"
types = "quantum_ark.d.ts"
files = @(
"quantum_ark.js",
"quantum_ark_bg.wasm",
"quantum_ark_bg.wasm.d.ts",
"quantum_ark.d.ts",
"README.md"
)
keywords = @(
"quantum",
"cryptography",
"hashing",
"post-quantum",
"wasm",
"security",
"encryption",
"crypto"
)
author = "Quantum ARK Contributors"
license = "MIT"
repository = @{
type = "git"
url = "https://github.com/yourusername/quantum_ark"
}
bugs = @{
url = "https://github.com/yourusername/quantum_ark/issues"
}
homepage = "https://github.com/yourusername/quantum_ark"
engines = @{
node = ">=14.0.0"
}
} | ConvertTo-Json -Depth 10
Set-Content -Path "pkg\package.json" -Value $packageJson -Encoding UTF8
# Copy README
Write-Host "📄 Copying README..." -ForegroundColor Yellow
Copy-Item "README.md" "pkg\" -Force
Write-Host "✅ Build complete!" -ForegroundColor Green
Write-Host ""
Write-Host "📦 Package ready in ./pkg/" -ForegroundColor Cyan
Write-Host ""
Write-Host "To publish to npm:" -ForegroundColor Yellow
Write-Host " cd pkg" -ForegroundColor Gray
Write-Host " npm publish" -ForegroundColor Gray
Write-Host ""
Write-Host "To use locally:" -ForegroundColor Yellow
Write-Host " npm install ./pkg" -ForegroundColor Gray