mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
Upstream merge brings 52 commits from safe-global/safe-wallet-monorepo into the luxfi/safe-wallet@dev fork. Conflicts resolved: - yarn.lock: deleted (we are on pnpm) - apps/web/package.json: kept pnpm version + brand build scripts (build:safe / build:lux / build:hanzo) plus upstream's new generate-version.mjs step - apps/mobile/.../Signer/appKit.ts: took upstream's import pattern for shared/projectId, shared/metadata, shared/mmkvStorageAdapter Yarn sweep applied to 42 files (docs, github-actions, workflows, AGENTS, specs, codemods, scripts, READMEs). Net result: zero yarn-* command references anywhere outside node_modules. ❯ pnpm is the law in this fork. No yarn.
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { createHash } from 'crypto'
|
|
import { readFileSync } from 'fs'
|
|
import { resolve } from 'path'
|
|
|
|
const SCRIPTS_DIR = __dirname
|
|
const SCHEMA_PATH = resolve(SCRIPTS_DIR, 'api-schema/schema.json')
|
|
const HASH_FILE_PATH = resolve(SCRIPTS_DIR, '../src/gateway/AUTO_GENERATED/.schema-hash')
|
|
|
|
function computeSchemaHash(): string {
|
|
const contents = readFileSync(SCHEMA_PATH)
|
|
return createHash('sha256').update(contents).digest('hex')
|
|
}
|
|
|
|
function readStoredHash(): string | null {
|
|
try {
|
|
return readFileSync(HASH_FILE_PATH, 'utf-8').trim()
|
|
} catch {
|
|
return null
|
|
}
|
|
}
|
|
|
|
const currentHash = computeSchemaHash()
|
|
const storedHash = readStoredHash()
|
|
|
|
if (storedHash === null) {
|
|
console.error(
|
|
'AUTO_GENERATED/.schema-hash not found.\n' +
|
|
'Run `pnpm --filter @safe-global/store build:dev` to regenerate AUTO_GENERATED files and update the hash.',
|
|
)
|
|
process.exit(1)
|
|
}
|
|
|
|
if (currentHash !== storedHash) {
|
|
console.error(
|
|
'AUTO_GENERATED files may be out of date.\n' +
|
|
`Schema hash: ${currentHash}\n` +
|
|
`Stored hash: ${storedHash}\n` +
|
|
'Run `pnpm --filter @safe-global/store build:dev` to regenerate.',
|
|
)
|
|
process.exit(1)
|
|
}
|
|
|
|
console.log('AUTO_GENERATED files are in sync with schema.json.')
|
|
process.exit(0)
|