Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { execSync } from 'node:child_process'
import { existsSync, mkdirSync } from 'node:fs'
import { chmodSync, existsSync, mkdirSync } from 'node:fs'
import { join } from 'node:path'

const WIN_OUTPUT_NAME = 'Git_Commit_Analytics_win.exe'
Expand All @@ -19,10 +19,21 @@ async function buildWin() {
`node -e "require('fs').copyFileSync(process.execPath, '${OUTPUT_PATH}')" `,
)

if (existsSync(OUTPUT_PATH)) {
console.log(`✅ The file was successfully copied to: ${OUTPUT_PATH}`)
} else {
console.error(`❌ Copy failed, file not found: ${OUTPUT_PATH}`)
process.exit(1)
}

try {
execSync(`signtool remove /s ${OUTPUT_PATH}`)
} catch {}

try {
chmodSync(OUTPUT_PATH, 0o666)
} catch {}

execSync(
[
`postject ${OUTPUT_PATH} NODE_SEA_BLOB ${SEA_BLOB}`,
Expand All @@ -47,6 +58,13 @@ async function buildMac() {

execSync(`cp ${NODE_PATH} ${OUTPUT_PATH}`)

if (existsSync(OUTPUT_PATH)) {
console.log(`✅ The file was successfully copied to: ${OUTPUT_PATH}`)
} else {
console.error(`❌ Copy failed, file not found: ${OUTPUT_PATH}`)
process.exit(1)
}

execSync(`codesign --remove-signature ${OUTPUT_PATH}`)

execSync(
Expand Down
Loading