@barnaby.build/barnaby 0.0.233 → 0.0.236
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/barnaby.cjs +19 -19
- package/dist/assets/{index-B2QCc9UL.js → index-CTmJFf2A.js} +91 -89
- package/dist/debug-window.html +65 -65
- package/dist/index.html +1 -1
- package/dist/splash.html +46 -46
- package/dist-electron/main/index.js +6157 -10217
- package/package.json +2 -2
- package/public/debug-window.html +65 -65
- package/public/splash.html +46 -46
- package/scripts/bump-version.mjs +35 -35
- package/scripts/create-release-notes.mjs +50 -47
- package/scripts/generate-license-key.mjs +99 -99
- package/scripts/license-keypair-init.mjs +56 -56
- package/scripts/patch-nord-theme.mjs +14 -14
- package/scripts/rebuild-native.mjs +47 -47
- package/scripts/shortcut-win.mjs +57 -57
- package/scripts/sync-icon.mjs +20 -20
- package/scripts/validate-version-files.mjs +35 -0
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* One-time script: Generate an ed25519 keypair for license key signing.
|
|
4
|
-
*
|
|
5
|
-
* Run: node scripts/license-keypair-init.mjs
|
|
6
|
-
*
|
|
7
|
-
* Output:
|
|
8
|
-
* - Prints the PUBLIC key PEM (embed in licenseKeys.ts)
|
|
9
|
-
* - Saves the PRIVATE key to ~/.barnaby/license-private-key.pem
|
|
10
|
-
*
|
|
11
|
-
* IMPORTANT: The private key file must NEVER be committed to version control.
|
|
12
|
-
* Back it up securely — if you lose it, you can't generate new keys.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import crypto from 'node:crypto'
|
|
16
|
-
import fs from 'node:fs'
|
|
17
|
-
import path from 'node:path'
|
|
18
|
-
import os from 'node:os'
|
|
19
|
-
|
|
20
|
-
const PRIVATE_KEY_PATH = path.join(os.homedir(), '.barnaby', 'license-private-key.pem')
|
|
21
|
-
|
|
22
|
-
// Check if keypair already exists
|
|
23
|
-
if (fs.existsSync(PRIVATE_KEY_PATH)) {
|
|
24
|
-
console.log('⚠️ Private key already exists at:', PRIVATE_KEY_PATH)
|
|
25
|
-
console.log(' Delete it first if you want to generate a new keypair.')
|
|
26
|
-
console.log()
|
|
27
|
-
|
|
28
|
-
// Show the existing public key for reference
|
|
29
|
-
const existingPrivate = fs.readFileSync(PRIVATE_KEY_PATH, 'utf8')
|
|
30
|
-
const privateKey = crypto.createPrivateKey(existingPrivate)
|
|
31
|
-
const publicKeyPem = crypto.createPublicKey(privateKey).export({ type: 'spki', format: 'pem' })
|
|
32
|
-
console.log('Existing PUBLIC key (already in licenseKeys.ts):')
|
|
33
|
-
console.log(publicKeyPem)
|
|
34
|
-
process.exit(0)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Generate new ed25519 keypair
|
|
38
|
-
const { publicKey, privateKey } = crypto.generateKeyPairSync('ed25519')
|
|
39
|
-
|
|
40
|
-
const publicKeyPem = publicKey.export({ type: 'spki', format: 'pem' })
|
|
41
|
-
const privateKeyPem = privateKey.export({ type: 'pkcs8', format: 'pem' })
|
|
42
|
-
|
|
43
|
-
// Save private key
|
|
44
|
-
const dir = path.dirname(PRIVATE_KEY_PATH)
|
|
45
|
-
fs.mkdirSync(dir, { recursive: true })
|
|
46
|
-
fs.writeFileSync(PRIVATE_KEY_PATH, privateKeyPem, { mode: 0o600 })
|
|
47
|
-
|
|
48
|
-
console.log('✅ Ed25519 keypair generated successfully!')
|
|
49
|
-
console.log()
|
|
50
|
-
console.log('PRIVATE key saved to:', PRIVATE_KEY_PATH)
|
|
51
|
-
console.log('⚠️ NEVER commit this file. Back it up securely.')
|
|
52
|
-
console.log()
|
|
53
|
-
console.log('PUBLIC key — copy this into electron/main/licenseKeys.ts:')
|
|
54
|
-
console.log('─'.repeat(60))
|
|
55
|
-
console.log(publicKeyPem)
|
|
56
|
-
console.log('─'.repeat(60))
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* One-time script: Generate an ed25519 keypair for license key signing.
|
|
4
|
+
*
|
|
5
|
+
* Run: node scripts/license-keypair-init.mjs
|
|
6
|
+
*
|
|
7
|
+
* Output:
|
|
8
|
+
* - Prints the PUBLIC key PEM (embed in licenseKeys.ts)
|
|
9
|
+
* - Saves the PRIVATE key to ~/.barnaby/license-private-key.pem
|
|
10
|
+
*
|
|
11
|
+
* IMPORTANT: The private key file must NEVER be committed to version control.
|
|
12
|
+
* Back it up securely — if you lose it, you can't generate new keys.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import crypto from 'node:crypto'
|
|
16
|
+
import fs from 'node:fs'
|
|
17
|
+
import path from 'node:path'
|
|
18
|
+
import os from 'node:os'
|
|
19
|
+
|
|
20
|
+
const PRIVATE_KEY_PATH = path.join(os.homedir(), '.barnaby', 'license-private-key.pem')
|
|
21
|
+
|
|
22
|
+
// Check if keypair already exists
|
|
23
|
+
if (fs.existsSync(PRIVATE_KEY_PATH)) {
|
|
24
|
+
console.log('⚠️ Private key already exists at:', PRIVATE_KEY_PATH)
|
|
25
|
+
console.log(' Delete it first if you want to generate a new keypair.')
|
|
26
|
+
console.log()
|
|
27
|
+
|
|
28
|
+
// Show the existing public key for reference
|
|
29
|
+
const existingPrivate = fs.readFileSync(PRIVATE_KEY_PATH, 'utf8')
|
|
30
|
+
const privateKey = crypto.createPrivateKey(existingPrivate)
|
|
31
|
+
const publicKeyPem = crypto.createPublicKey(privateKey).export({ type: 'spki', format: 'pem' })
|
|
32
|
+
console.log('Existing PUBLIC key (already in licenseKeys.ts):')
|
|
33
|
+
console.log(publicKeyPem)
|
|
34
|
+
process.exit(0)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Generate new ed25519 keypair
|
|
38
|
+
const { publicKey, privateKey } = crypto.generateKeyPairSync('ed25519')
|
|
39
|
+
|
|
40
|
+
const publicKeyPem = publicKey.export({ type: 'spki', format: 'pem' })
|
|
41
|
+
const privateKeyPem = privateKey.export({ type: 'pkcs8', format: 'pem' })
|
|
42
|
+
|
|
43
|
+
// Save private key
|
|
44
|
+
const dir = path.dirname(PRIVATE_KEY_PATH)
|
|
45
|
+
fs.mkdirSync(dir, { recursive: true })
|
|
46
|
+
fs.writeFileSync(PRIVATE_KEY_PATH, privateKeyPem, { mode: 0o600 })
|
|
47
|
+
|
|
48
|
+
console.log('✅ Ed25519 keypair generated successfully!')
|
|
49
|
+
console.log()
|
|
50
|
+
console.log('PRIVATE key saved to:', PRIVATE_KEY_PATH)
|
|
51
|
+
console.log('⚠️ NEVER commit this file. Back it up securely.')
|
|
52
|
+
console.log()
|
|
53
|
+
console.log('PUBLIC key — copy this into electron/main/licenseKeys.ts:')
|
|
54
|
+
console.log('─'.repeat(60))
|
|
55
|
+
console.log(publicKeyPem)
|
|
56
|
+
console.log('─'.repeat(60))
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
|
|
3
|
-
const p = 'C:/Users/stuar/AppData/Roaming/Barnaby/.storage/app-state.json'
|
|
4
|
-
const d = JSON.parse(fs.readFileSync(p, 'utf8'))
|
|
5
|
-
const s = d.state
|
|
6
|
-
if (!s.themeOverrides) s.themeOverrides = {}
|
|
7
|
-
if (!s.themeOverrides['nord-light']) s.themeOverrides['nord-light'] = {}
|
|
8
|
-
Object.assign(s.themeOverrides['nord-light'], {
|
|
9
|
-
accentSoft: '#f0f6ff',
|
|
10
|
-
assistantBubbleBgLight: '#f0f0f0',
|
|
11
|
-
thinkingProgress: '#082cdd',
|
|
12
|
-
})
|
|
13
|
-
fs.writeFileSync(p, JSON.stringify(d, null, 2))
|
|
14
|
-
console.log('nord-light overrides patched')
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
|
|
3
|
+
const p = 'C:/Users/stuar/AppData/Roaming/Barnaby/.storage/app-state.json'
|
|
4
|
+
const d = JSON.parse(fs.readFileSync(p, 'utf8'))
|
|
5
|
+
const s = d.state
|
|
6
|
+
if (!s.themeOverrides) s.themeOverrides = {}
|
|
7
|
+
if (!s.themeOverrides['nord-light']) s.themeOverrides['nord-light'] = {}
|
|
8
|
+
Object.assign(s.themeOverrides['nord-light'], {
|
|
9
|
+
accentSoft: '#f0f6ff',
|
|
10
|
+
assistantBubbleBgLight: '#f0f0f0',
|
|
11
|
+
thinkingProgress: '#082cdd',
|
|
12
|
+
})
|
|
13
|
+
fs.writeFileSync(p, JSON.stringify(d, null, 2))
|
|
14
|
+
console.log('nord-light overrides patched')
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Best-effort rebuild of native Node modules (node-pty) for Electron.
|
|
4
|
-
* Runs as part of postinstall. Fails silently if build tools are missing.
|
|
5
|
-
*
|
|
6
|
-
* Requirements for a successful rebuild:
|
|
7
|
-
* - Python 3.x on PATH
|
|
8
|
-
* - C++ build tools (Visual Studio on Windows, Xcode CLT on macOS, gcc on Linux)
|
|
9
|
-
*
|
|
10
|
-
* If these are missing, node-pty's N-API prebuilds may still work at runtime.
|
|
11
|
-
*/
|
|
12
|
-
import { execSync } from 'node:child_process'
|
|
13
|
-
import { existsSync } from 'node:fs'
|
|
14
|
-
import { join, dirname } from 'node:path'
|
|
15
|
-
import { fileURLToPath } from 'node:url'
|
|
16
|
-
|
|
17
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
18
|
-
const root = join(__dirname, '..')
|
|
19
|
-
|
|
20
|
-
const nodePtyDir = join(root, 'node_modules', 'node-pty')
|
|
21
|
-
if (!existsSync(nodePtyDir)) {
|
|
22
|
-
// node-pty not installed (optional dep) — nothing to do
|
|
23
|
-
process.exit(0)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const electronRebuild = join(root, 'node_modules', '.bin', 'electron-rebuild')
|
|
27
|
-
if (!existsSync(electronRebuild) && !existsSync(electronRebuild + '.cmd')) {
|
|
28
|
-
process.exit(0)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
console.log('[postinstall] Rebuilding native modules for Electron...')
|
|
33
|
-
execSync(`"${electronRebuild}" -m "${nodePtyDir}"`, {
|
|
34
|
-
cwd: root,
|
|
35
|
-
stdio: 'inherit',
|
|
36
|
-
timeout: 120_000,
|
|
37
|
-
})
|
|
38
|
-
console.log('[postinstall] Native modules rebuilt successfully.')
|
|
39
|
-
} catch {
|
|
40
|
-
console.log(
|
|
41
|
-
'[postinstall] Native module rebuild skipped (missing Python or C++ build tools).\n' +
|
|
42
|
-
' The built-in terminal may not work. To fix:\n' +
|
|
43
|
-
' 1. Install Python 3: https://www.python.org/downloads/\n' +
|
|
44
|
-
' 2. Install C++ build tools (Visual Studio or `npm install -g windows-build-tools`)\n' +
|
|
45
|
-
' 3. Run: npx electron-rebuild'
|
|
46
|
-
)
|
|
47
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Best-effort rebuild of native Node modules (node-pty) for Electron.
|
|
4
|
+
* Runs as part of postinstall. Fails silently if build tools are missing.
|
|
5
|
+
*
|
|
6
|
+
* Requirements for a successful rebuild:
|
|
7
|
+
* - Python 3.x on PATH
|
|
8
|
+
* - C++ build tools (Visual Studio on Windows, Xcode CLT on macOS, gcc on Linux)
|
|
9
|
+
*
|
|
10
|
+
* If these are missing, node-pty's N-API prebuilds may still work at runtime.
|
|
11
|
+
*/
|
|
12
|
+
import { execSync } from 'node:child_process'
|
|
13
|
+
import { existsSync } from 'node:fs'
|
|
14
|
+
import { join, dirname } from 'node:path'
|
|
15
|
+
import { fileURLToPath } from 'node:url'
|
|
16
|
+
|
|
17
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
18
|
+
const root = join(__dirname, '..')
|
|
19
|
+
|
|
20
|
+
const nodePtyDir = join(root, 'node_modules', 'node-pty')
|
|
21
|
+
if (!existsSync(nodePtyDir)) {
|
|
22
|
+
// node-pty not installed (optional dep) — nothing to do
|
|
23
|
+
process.exit(0)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const electronRebuild = join(root, 'node_modules', '.bin', 'electron-rebuild')
|
|
27
|
+
if (!existsSync(electronRebuild) && !existsSync(electronRebuild + '.cmd')) {
|
|
28
|
+
process.exit(0)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
console.log('[postinstall] Rebuilding native modules for Electron...')
|
|
33
|
+
execSync(`"${electronRebuild}" -m "${nodePtyDir}"`, {
|
|
34
|
+
cwd: root,
|
|
35
|
+
stdio: 'inherit',
|
|
36
|
+
timeout: 120_000,
|
|
37
|
+
})
|
|
38
|
+
console.log('[postinstall] Native modules rebuilt successfully.')
|
|
39
|
+
} catch {
|
|
40
|
+
console.log(
|
|
41
|
+
'[postinstall] Native module rebuild skipped (missing Python or C++ build tools).\n' +
|
|
42
|
+
' The built-in terminal may not work. To fix:\n' +
|
|
43
|
+
' 1. Install Python 3: https://www.python.org/downloads/\n' +
|
|
44
|
+
' 2. Install C++ build tools (Visual Studio or `npm install -g windows-build-tools`)\n' +
|
|
45
|
+
' 3. Run: npx electron-rebuild'
|
|
46
|
+
)
|
|
47
|
+
}
|
package/scripts/shortcut-win.mjs
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Creates a Start menu shortcut for Barnaby on Windows (global install only).
|
|
4
|
-
* Fixes: (1) App not findable in Windows search (2) Taskbar pinning shows Electron.
|
|
5
|
-
* Tip: Pin the "Barnaby" shortcut from Start menu to taskbar for correct icon.
|
|
6
|
-
*/
|
|
7
|
-
import { platform } from 'node:os'
|
|
8
|
-
import { existsSync, writeFileSync } from 'node:fs'
|
|
9
|
-
import { dirname, join } from 'node:path'
|
|
10
|
-
import { fileURLToPath } from 'node:url'
|
|
11
|
-
import { execSync } from 'node:child_process'
|
|
12
|
-
|
|
13
|
-
function main() {
|
|
14
|
-
if (platform() !== 'win32') return
|
|
15
|
-
const force = process.argv.includes('--force')
|
|
16
|
-
if (!force && process.env.npm_config_global !== 'true') return
|
|
17
|
-
|
|
18
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
19
|
-
const pkgRoot = join(__dirname, '..')
|
|
20
|
-
|
|
21
|
-
// Use node + our script directly (barnaby.cmd may not exist yet when postinstall runs)
|
|
22
|
-
const barnabyScript = join(pkgRoot, 'bin', 'barnaby.cjs')
|
|
23
|
-
if (!existsSync(barnabyScript)) return
|
|
24
|
-
const nodeExe = process.execPath
|
|
25
|
-
|
|
26
|
-
// Prefer .ico for Windows shortcuts (PNG often fails)
|
|
27
|
-
const iconPath = [
|
|
28
|
-
join(pkgRoot, 'build', 'icon.ico'),
|
|
29
|
-
join(pkgRoot, 'dist', 'favicon.ico'),
|
|
30
|
-
join(pkgRoot, 'public', 'favicon.ico'),
|
|
31
|
-
join(pkgRoot, 'dist', 'appicon.png'),
|
|
32
|
-
join(pkgRoot, 'public', 'appicon.png')
|
|
33
|
-
].find(existsSync)
|
|
34
|
-
const startMenuDir = join(process.env.APPDATA || '', 'Microsoft', 'Windows', 'Start Menu', 'Programs')
|
|
35
|
-
const shortcutPath = join(startMenuDir, 'Barnaby.lnk')
|
|
36
|
-
|
|
37
|
-
const ps = `
|
|
38
|
-
$WshShell = New-Object -ComObject WScript.Shell
|
|
39
|
-
$Shortcut = $WshShell.CreateShortcut('${shortcutPath.replace(/'/g, "''")}')
|
|
40
|
-
$Shortcut.TargetPath = '${nodeExe.replace(/'/g, "''")}'
|
|
41
|
-
$Shortcut.Arguments = '${barnabyScript.replace(/'/g, "''")}'
|
|
42
|
-
$Shortcut.WorkingDirectory = '${(process.env.USERPROFILE || '').replace(/'/g, "''")}'
|
|
43
|
-
$Shortcut.Description = 'Barnaby - AI agent IDE'
|
|
44
|
-
${iconPath ? `if (Test-Path '${iconPath.replace(/'/g, "''")}') { $Shortcut.IconLocation = '${iconPath.replace(/'/g, "''")},0' }` : ''}
|
|
45
|
-
$Shortcut.Save()
|
|
46
|
-
`
|
|
47
|
-
try {
|
|
48
|
-
const tmp = join(process.env.TEMP || '', 'barnaby-shortcut.ps1')
|
|
49
|
-
writeFileSync(tmp, ps.trim(), 'utf8')
|
|
50
|
-
execSync(`powershell -NoProfile -ExecutionPolicy Bypass -File "${tmp}"`, { stdio: 'pipe' })
|
|
51
|
-
console.log('[Barnaby] Start menu shortcut created. Pin it to taskbar for the correct icon.')
|
|
52
|
-
} catch {
|
|
53
|
-
// Silent fail - shortcut is optional
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
main()
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Start menu shortcut for Barnaby on Windows (global install only).
|
|
4
|
+
* Fixes: (1) App not findable in Windows search (2) Taskbar pinning shows Electron.
|
|
5
|
+
* Tip: Pin the "Barnaby" shortcut from Start menu to taskbar for correct icon.
|
|
6
|
+
*/
|
|
7
|
+
import { platform } from 'node:os'
|
|
8
|
+
import { existsSync, writeFileSync } from 'node:fs'
|
|
9
|
+
import { dirname, join } from 'node:path'
|
|
10
|
+
import { fileURLToPath } from 'node:url'
|
|
11
|
+
import { execSync } from 'node:child_process'
|
|
12
|
+
|
|
13
|
+
function main() {
|
|
14
|
+
if (platform() !== 'win32') return
|
|
15
|
+
const force = process.argv.includes('--force')
|
|
16
|
+
if (!force && process.env.npm_config_global !== 'true') return
|
|
17
|
+
|
|
18
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
19
|
+
const pkgRoot = join(__dirname, '..')
|
|
20
|
+
|
|
21
|
+
// Use node + our script directly (barnaby.cmd may not exist yet when postinstall runs)
|
|
22
|
+
const barnabyScript = join(pkgRoot, 'bin', 'barnaby.cjs')
|
|
23
|
+
if (!existsSync(barnabyScript)) return
|
|
24
|
+
const nodeExe = process.execPath
|
|
25
|
+
|
|
26
|
+
// Prefer .ico for Windows shortcuts (PNG often fails)
|
|
27
|
+
const iconPath = [
|
|
28
|
+
join(pkgRoot, 'build', 'icon.ico'),
|
|
29
|
+
join(pkgRoot, 'dist', 'favicon.ico'),
|
|
30
|
+
join(pkgRoot, 'public', 'favicon.ico'),
|
|
31
|
+
join(pkgRoot, 'dist', 'appicon.png'),
|
|
32
|
+
join(pkgRoot, 'public', 'appicon.png')
|
|
33
|
+
].find(existsSync)
|
|
34
|
+
const startMenuDir = join(process.env.APPDATA || '', 'Microsoft', 'Windows', 'Start Menu', 'Programs')
|
|
35
|
+
const shortcutPath = join(startMenuDir, 'Barnaby.lnk')
|
|
36
|
+
|
|
37
|
+
const ps = `
|
|
38
|
+
$WshShell = New-Object -ComObject WScript.Shell
|
|
39
|
+
$Shortcut = $WshShell.CreateShortcut('${shortcutPath.replace(/'/g, "''")}')
|
|
40
|
+
$Shortcut.TargetPath = '${nodeExe.replace(/'/g, "''")}'
|
|
41
|
+
$Shortcut.Arguments = '${barnabyScript.replace(/'/g, "''")}'
|
|
42
|
+
$Shortcut.WorkingDirectory = '${(process.env.USERPROFILE || '').replace(/'/g, "''")}'
|
|
43
|
+
$Shortcut.Description = 'Barnaby - AI agent IDE'
|
|
44
|
+
${iconPath ? `if (Test-Path '${iconPath.replace(/'/g, "''")}') { $Shortcut.IconLocation = '${iconPath.replace(/'/g, "''")},0' }` : ''}
|
|
45
|
+
$Shortcut.Save()
|
|
46
|
+
`
|
|
47
|
+
try {
|
|
48
|
+
const tmp = join(process.env.TEMP || '', 'barnaby-shortcut.ps1')
|
|
49
|
+
writeFileSync(tmp, ps.trim(), 'utf8')
|
|
50
|
+
execSync(`powershell -NoProfile -ExecutionPolicy Bypass -File "${tmp}"`, { stdio: 'pipe' })
|
|
51
|
+
console.log('[Barnaby] Start menu shortcut created. Pin it to taskbar for the correct icon.')
|
|
52
|
+
} catch {
|
|
53
|
+
// Silent fail - shortcut is optional
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
main()
|
package/scripts/sync-icon.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Sync build/icon.ico to public/favicon.ico so the BrowserWindow and packaged
|
|
4
|
-
* app use the same icon. electron-builder reads build/icon.ico for the .exe;
|
|
5
|
-
* the runtime uses public/favicon.ico (copied to dist by Vite).
|
|
6
|
-
*/
|
|
7
|
-
import fs from 'node:fs'
|
|
8
|
-
import path from 'node:path'
|
|
9
|
-
|
|
10
|
-
const root = process.cwd()
|
|
11
|
-
const src = path.join(root, 'build', 'icon.ico')
|
|
12
|
-
const dest = path.join(root, 'public', 'favicon.ico')
|
|
13
|
-
|
|
14
|
-
if (!fs.existsSync(src)) {
|
|
15
|
-
console.warn('[sync-icon] build/icon.ico not found, skipping sync')
|
|
16
|
-
process.exit(0)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
fs.copyFileSync(src, dest)
|
|
20
|
-
console.log('[sync-icon] Copied build/icon.ico → public/favicon.ico')
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Sync build/icon.ico to public/favicon.ico so the BrowserWindow and packaged
|
|
4
|
+
* app use the same icon. electron-builder reads build/icon.ico for the .exe;
|
|
5
|
+
* the runtime uses public/favicon.ico (copied to dist by Vite).
|
|
6
|
+
*/
|
|
7
|
+
import fs from 'node:fs'
|
|
8
|
+
import path from 'node:path'
|
|
9
|
+
|
|
10
|
+
const root = process.cwd()
|
|
11
|
+
const src = path.join(root, 'build', 'icon.ico')
|
|
12
|
+
const dest = path.join(root, 'public', 'favicon.ico')
|
|
13
|
+
|
|
14
|
+
if (!fs.existsSync(src)) {
|
|
15
|
+
console.warn('[sync-icon] build/icon.ico not found, skipping sync')
|
|
16
|
+
process.exit(0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
fs.copyFileSync(src, dest)
|
|
20
|
+
console.log('[sync-icon] Copied build/icon.ico → public/favicon.ico')
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
|
|
4
|
+
const root = process.cwd()
|
|
5
|
+
const packageJsonPath = path.join(root, 'package.json')
|
|
6
|
+
const packageLockPath = path.join(root, 'package-lock.json')
|
|
7
|
+
|
|
8
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
9
|
+
const packageJsonVersion = typeof packageJson.version === 'string' ? packageJson.version.trim() : ''
|
|
10
|
+
|
|
11
|
+
if (!packageJsonVersion) {
|
|
12
|
+
console.error('[release] package.json version is missing.')
|
|
13
|
+
process.exit(1)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(packageLockPath)) {
|
|
17
|
+
console.error('[release] package-lock.json is missing.')
|
|
18
|
+
process.exit(1)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const packageLock = JSON.parse(fs.readFileSync(packageLockPath, 'utf8'))
|
|
22
|
+
const packageLockVersion = typeof packageLock.version === 'string' ? packageLock.version.trim() : ''
|
|
23
|
+
const rootPackageVersion =
|
|
24
|
+
packageLock.packages && packageLock.packages[''] && typeof packageLock.packages[''].version === 'string'
|
|
25
|
+
? packageLock.packages[''].version.trim()
|
|
26
|
+
: ''
|
|
27
|
+
|
|
28
|
+
if (packageLockVersion !== packageJsonVersion || rootPackageVersion !== packageJsonVersion) {
|
|
29
|
+
console.error(
|
|
30
|
+
`[release] Version mismatch detected. package.json=${packageJsonVersion}, package-lock.json=${packageLockVersion || '(missing)'}, package-lock packages[\"\"].version=${rootPackageVersion || '(missing)'}`,
|
|
31
|
+
)
|
|
32
|
+
process.exit(1)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
console.log(`[release] Version files aligned at ${packageJsonVersion}`)
|