1// @ts-check
2const fs = require("node:fs");
3const path = require("node:path");
4
5// Include the major version, which Expo ignores, to prevent OTAs reaching older store binaries.
6const appConfig = fs.readFileSync(path.join(__dirname, "app.config.ts"), "utf8");
7const version =
8 process.env.T3CODE_MOBILE_VERSION ??
9 appConfig.match(/^ {2}version: repoEnv\.T3CODE_MOBILE_VERSION \?\? "([^"]+)"/m)?.[1];
10const majorVersion = version?.match(/^(\d+)\./)?.[1];
11if (!majorVersion) {
12 throw new Error("fingerprint.config.js could not read the app version from app.config.ts");
13}
14
15module.exports = {
16 nativeModuleSourceType: "files",
17 extraSources: [{ type: "contents", id: "appMajorVersion", contents: majorVersion }],
18};