|
| 1 | +const fs = require('fs'); |
| 2 | +const path = require('path'); |
| 3 | + |
| 4 | +const version = require('./package.json').version; |
| 5 | + |
| 6 | +// Update MODULE.bazel |
| 7 | +const moduleBazelPath = path.join(__dirname, 'MODULE.bazel'); |
| 8 | +let moduleBazelContent = fs.readFileSync(moduleBazelPath, 'utf8'); |
| 9 | +moduleBazelContent = moduleBazelContent.replace(/version = ".*"/, `version = "${version}"`); |
| 10 | +fs.writeFileSync(moduleBazelPath, moduleBazelContent); |
| 11 | + |
| 12 | +// Update protobuf_javascript_release.bzl |
| 13 | +const releaseBzlPath = path.join(__dirname, 'protobuf_javascript_release.bzl'); |
| 14 | +let releaseBzlContent = fs.readFileSync(releaseBzlPath, 'utf8'); |
| 15 | +releaseBzlContent = releaseBzlContent.replace(/_PROTOBUF_JAVASCRIPT_VERSION = ".*"/, `_PROTOBUF_JAVASCRIPT_VERSION = "${version}"`); |
| 16 | +fs.writeFileSync(releaseBzlPath, releaseBzlContent); |
| 17 | + |
| 18 | +// Update conformance/package.json |
| 19 | +const conformancePackageJsonPath = |
| 20 | + path.join(__dirname, 'conformance', 'package.json'); |
| 21 | +let conformancePackageJsonContent = |
| 22 | + fs.readFileSync(conformancePackageJsonPath, 'utf8'); |
| 23 | +const conformancePackageJson = JSON.parse(conformancePackageJsonContent); |
| 24 | +conformancePackageJson.dependencies['google-protobuf'] = |
| 25 | + `file:../google-protobuf-${version}.tgz`; |
| 26 | +fs.writeFileSync( |
| 27 | + conformancePackageJsonPath, |
| 28 | + JSON.stringify(conformancePackageJson, null, 2) + '\n'); |
0 commit comments