()
| 62 | } |
| 63 | |
| 64 | function loadPackageJson() { |
| 65 | const pkg = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8")); |
| 66 | if (!pkg.version) { |
| 67 | throw new Error("Missing version field in package.json"); |
| 68 | } |
| 69 | if (!pkg.ocrConfig || !pkg.ocrConfig.urlPattern) { |
| 70 | throw new Error("Missing ocrConfig.urlPattern in package.json"); |
| 71 | } |
| 72 | return pkg; |
| 73 | } |
| 74 | |
| 75 | function resolveVersion(pkg) { |
| 76 | const envVersion = process.env.OCR_VERSION; |