Skip to content

Commit

Permalink
Missing bump script
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Dec 13, 2024
1 parent fe470c2 commit 10d928a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ source_dir = "src"
build_dir = "jupyterlite_xeus/labextension"

[tool.jupyter-releaser.options]
version_cmd = "hatch version"
version_cmd = "python ./scripts/bump_version.py"

[tool.jupyter-releaser.hooks]
before-bump-version = ["python -m pip install 'jupyterlab>=4.0.0,<5'", "jlpm"]
before-build-npm = [
"python -m pip install 'jupyterlab>=4.0.0,<4.3'",
"jlpm",
Expand Down
30 changes: 30 additions & 0 deletions scripts/bump_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import argparse
import json
from pathlib import Path
from subprocess import run

BUMP_VERSION_CMD = "npx lerna version --no-push --force-publish --no-git-tag-version --yes"


def main():
parser = argparse.ArgumentParser()
parser.add_argument("version")
args = parser.parse_args()
version = args.version

run(f"{BUMP_VERSION_CMD} {version}", shell=True, check=True)

root = Path(__file__).parent.parent
version_file = root / "packages" / "xeus-extension" / "package.json"
package_file = root / "package.json"

version_json = json.loads(version_file.read_text())
version = version_json["version"].replace("-alpha.", "-a").replace("-beta.", "-b").replace("-rc.", "-rc")

package_json = json.loads(package_file.read_text())
package_json["version"] = version
package_file.write_text(json.dumps(package_json, indent=2))


if __name__ == "__main__":
main()

0 comments on commit 10d928a

Please sign in to comment.