bump-version.ts 803 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Bump the version of all benchmark related files by changing the `Unreleased`
  3. * version to a new version and adding a new `Unreleased` version.
  4. */
  5. import {
  6. ANCHOR_VERSION_ARG,
  7. BenchData,
  8. LockFile,
  9. getVersionFromArgs,
  10. } from "./utils";
  11. (async () => {
  12. const newVersion = getVersionFromArgs();
  13. if (newVersion === "unreleased") {
  14. console.error(
  15. `Usage: anchor run bump-version -- ${ANCHOR_VERSION_ARG} <VERSION>`
  16. );
  17. process.exitCode = 1;
  18. return;
  19. }
  20. // Cache lock file in ./locks
  21. await LockFile.cache(newVersion);
  22. // Bump bench data
  23. const bench = await BenchData.open();
  24. bench.bumpVersion(newVersion);
  25. await bench.save();
  26. // Bump markdown files
  27. await BenchData.forEachMarkdown((markdown) => {
  28. markdown.bumpVersion(newVersion);
  29. });
  30. })();