Windows progress
This commit is contained in:
parent
fd00b56f12
commit
24c98d6656
|
@ -29,10 +29,16 @@ echo "#!/usr/bin/env node" > build/global/downloadnet.cjs
|
|||
cat build/cjs/dn.cjs >> build/global/downloadnet.cjs
|
||||
chmod +x build/global/downloadnet.cjs
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
echo "Using macOS builder..." >&2
|
||||
./stampers/macos.sh dn build/cjs/dn.cjs build/bin/
|
||||
elif [[ "$OSTYPE" == win* ]]; then
|
||||
./stampers/win.sh dn build/cjs/dn.cjs build/bin/
|
||||
elif [[ "$(node.exe -p process.platform)" == win* ]]; then
|
||||
echo "Using windows builder..." >&2
|
||||
./stampers/win.bat dn build/cjs/dn.cjs build/bin/
|
||||
else
|
||||
echo "Using linux builder..." >&2
|
||||
./stampers/nix.sh dn build/cjs/dn.cjs build/bin/
|
||||
fi
|
||||
echo "Done"
|
||||
|
||||
read -p "Any key to exit"
|
||||
|
||||
|
|
|
@ -15,9 +15,6 @@ set "OUTPUT_FOLDER=%~3"
|
|||
:: Ensure output folder exists
|
||||
if not exist "%OUTPUT_FOLDER%" mkdir "%OUTPUT_FOLDER%"
|
||||
|
||||
:: Create a JavaScript file
|
||||
echo console.log(`Hello, %%argv[2]!`); > "%JS_SOURCE_FILE%"
|
||||
|
||||
:: Create configuration file for SEA
|
||||
(
|
||||
echo {
|
||||
|
@ -43,17 +40,13 @@ node --experimental-sea-config "%OUTPUT_FOLDER%\%SEA_CONFIG%"
|
|||
node -e "require('fs').copyFileSync(process.execPath, '%OUTPUT_FOLDER%\%EXE_NAME%')"
|
||||
|
||||
:: Optionally, remove signature from the binary (use signtool if necessary, or skip this step)
|
||||
:: signtool remove /s "%OUTPUT_FOLDER%\%EXE_NAME%"
|
||||
signtool remove /s "%OUTPUT_FOLDER%\%EXE_NAME%"
|
||||
|
||||
:: Inject the blob into the copied binary
|
||||
npx postject "%OUTPUT_FOLDER%\%EXE_NAME%" NODE_SEA_BLOB sea-prep.blob ^
|
||||
--sentinel-fuse %NODE_SEA_FUSE%
|
||||
|
||||
:: Clean up
|
||||
del "%JS_SOURCE_FILE%"
|
||||
del "%OUTPUT_FOLDER%\%SEA_CONFIG%"
|
||||
del sea-prep.blob
|
||||
|
||||
echo Application built successfully.
|
||||
|
||||
:end
|
||||
|
|
100
stampers/win.ps1
100
stampers/win.ps1
|
@ -1,100 +0,0 @@
|
|||
param(
|
||||
[string]$exeName,
|
||||
[string]$jsSourceFile,
|
||||
[string]$outputFolder
|
||||
)
|
||||
|
||||
# Validate parameters
|
||||
if (-not $exeName) {
|
||||
Write-Error "Executable name is required."
|
||||
exit 1
|
||||
}
|
||||
if (-not $jsSourceFile) {
|
||||
Write-Error "JavaScript source file path is required."
|
||||
exit 1
|
||||
}
|
||||
if (-not $outputFolder) {
|
||||
Write-Error "Output folder is required."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Ensure NVM is installed
|
||||
if (-not (Get-Command nvm -ErrorAction SilentlyContinue)) {
|
||||
Write-Output "NVM not found. Installing..."
|
||||
Invoke-WebRequest https://raw.githubusercontent.com/coreybutler/nvm-windows/master/nvm-setup.exe -OutFile nvm-setup.exe
|
||||
Start-Process -Wait -FilePath nvm-setup.exe
|
||||
Remove-Item nvm-setup.exe
|
||||
}
|
||||
|
||||
# Use Node 22
|
||||
nvm install 22
|
||||
nvm use 22
|
||||
|
||||
# Create sea-config.json
|
||||
$seaConfigContent = @"
|
||||
{
|
||||
"main": "$jsSourceFile",
|
||||
"output": "sea-prep.blob",
|
||||
"disableExperimentalSEAWarning": true,
|
||||
"useCodeCache": true,
|
||||
"assets": {
|
||||
"index.html": "public/index.html",
|
||||
"favicon.ico": "public/favicon.ico",
|
||||
"top.html": "public/top.html",
|
||||
"style.css": "public/style.css",
|
||||
"injection.js": "public/injection.js",
|
||||
"redirector.html": "public/redirector.html"
|
||||
}
|
||||
}
|
||||
"@
|
||||
$seaConfigContent | Out-File sea-config.json
|
||||
|
||||
# Generate the blob
|
||||
try {
|
||||
node --experimental-sea-config sea-config.json
|
||||
} catch {
|
||||
Write-Error "Failed to generate the blob: $_"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Copy node binary
|
||||
try {
|
||||
node -e "require('fs').copyFileSync(process.execPath, '$exeName.exe')"
|
||||
} catch {
|
||||
Write-Error "Failed to copy node binary: $_"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Optionally remove the signature of the binary
|
||||
signtool remove /s "$exeName.exe"
|
||||
|
||||
# Inject the blob
|
||||
try {
|
||||
npx postject "$exeName.exe" NODE_SEA_BLOB sea-prep.blob `
|
||||
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
||||
} catch {
|
||||
Write-Error "Failed to inject the blob: $_"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Optionally sign the binary
|
||||
signtool sign /fd SHA256 "$exeName.exe"
|
||||
|
||||
# Move the executable to the output folder
|
||||
try {
|
||||
Move-Item -Path "$exeName.exe" -Destination (Join-Path -Path $outputFolder -ChildPath "$exeName.exe")
|
||||
} catch {
|
||||
Write-Error "Failed to move the executable: $_"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Clean up
|
||||
try {
|
||||
Remove-Item sea-config.json, sea-prep.blob
|
||||
} catch {
|
||||
Write-Error "Failed to clean up: $_"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Output "Process completed successfully."
|
||||
|
Loading…
Reference in New Issue