| 1 | // @ts-check |
| 2 | const fs = require("node:fs"); |
| 3 | const path = require("node:path"); |
| 4 | |
| 5 | // Expo's fingerprint ignores the app version, so binaries of different majors |
| 6 | // share a runtime version whenever native code is unchanged, and a production |
| 7 | // OTA from main would reach every older store binary. Hashing the major |
| 8 | // version keeps each major's OTAs on its own binaries: a new major reaches |
| 9 | // users only once its store build is promoted. |
| 10 | const appConfig = fs.readFileSync(path.join(__dirname, "app.config.ts"), "utf8"); |
| 11 | const majorVersion = appConfig.match(/^ {2}version: "(\d+)\./m)?.[1]; |
| 12 | if (!majorVersion) { |
| 13 | throw new Error("fingerprint.config.js could not read the app version from app.config.ts"); |
| 14 | } |
| 15 | |
| 16 | module.exports = { |
| 17 | // Hash the pinned Screens fork's native source, rather than only its version. |
| 18 | nativeModuleSourceType: "files", |
| 19 | extraSources: [{ type: "contents", id: "appMajorVersion", contents: majorVersion }], |
| 20 | }; |