Skip to content

Commit

Permalink
Fixing lerna setup (#136)
Browse files Browse the repository at this point in the history
* Try fixing lerna setup

* Missing bump script

* Update

* Meh
  • Loading branch information
martinRenou authored Dec 13, 2024
1 parent e530971 commit 8b774d7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
},
"license": "BSD-3-Clause",
"author": "JupyterLite Contributors",
"workspaces": [
"packages/*"
],
"workspaces": {
"packages": [
"packages/*"
]
},
"repository": {
"type": "git",
"url": "https://github.com/jupyterlite/xeus.git"
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ 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",
"YARN_ENABLE_IMMUTABLE_INSTALLS=0 jlpm",
"jlpm build:prod"
]
before-build-python = ["jlpm clean:all"]
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=4))


if __name__ == "__main__":
main()

0 comments on commit 8b774d7

Please sign in to comment.