refactor: centralize WhatsApp version to single source of truth

Instead of maintaining the version number in 3 separate files
(baileys-version.json, index.ts, generics.ts), this change makes
baileys-version.json the single source of truth. Other files now
import the version from this JSON file.

This follows the DRY principle and reduces:
- Risk of version inconsistency across files
- Maintenance burden (only 1 file to update)
- PR diff size (3 files → 1 file for version updates)
- Merge conflict probability

Addresses inefficiency found in Baileys PR #2269.
This commit is contained in:
Claude
2026-01-21 16:17:14 +00:00
parent f59e8cfe8b
commit 8a134d2420
3 changed files with 85 additions and 90 deletions
+3 -1
View File
@@ -3,8 +3,10 @@ import { makeLibSignalRepository } from '../Signal/libsignal'
import type { AuthenticationState, SocketConfig, WAVersion } from '../Types'
import { Browsers } from '../Utils/browser-utils'
import logger from '../Utils/logger'
// Single source of truth for WhatsApp Web version - imported from JSON
import baileysVersionData from './baileys-version.json'
const version = [2, 3000, 1032141294]
const version = baileysVersionData.version
export const UNAUTHORIZED_CODES = [401, 403, 419]
+4 -1
View File
@@ -1,7 +1,10 @@
import { Boom } from '@hapi/boom'
import { createHash, randomBytes } from 'crypto'
import { proto } from '../../WAProto/index.js'
const baileysVersion = [2, 3000, 1032141294]
// Single source of truth for WhatsApp Web version - imported from JSON
import baileysVersionData from '../Defaults/baileys-version.json'
const baileysVersion = baileysVersionData.version
import type {
BaileysEventEmitter,
BaileysEventMap,