Skip to content

Commit

Permalink
build: Convert Nu script to python
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed May 21, 2024
1 parent 06c4cf1 commit b83d1bd
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions crates/bump-versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import json
from pathlib import Path

import tomlkit

HERE = Path(__file__).parent
CRATES = json.loads((HERE / "release.json").read_text())

VERSION = "0.1.1-alpha.5"


def workspace(manifest, version):
manifest["workspace"]["package"]["version"] = version
return manifest


def crate(manifest, version):
internals = set(manifest["dependencies"].keys()).intersection(CRATES)
for dep in internals:
manifest["dependencies"][dep]["version"] = version
return manifest


def update(path, version, edit):
path = HERE / Path(path) / "Cargo.toml"
manifest = tomlkit.parse(path.read_text())
manifest = edit(manifest, version)
path.write_text(tomlkit.dumps(manifest))


def main():
update("..", VERSION, workspace)
for name in CRATES:
update(name, VERSION, crate)


if __name__ == "__main__":
main()

0 comments on commit b83d1bd

Please sign in to comment.