From 2b5b8c05320e9f64be6f7de729bf6b434dc8d419 Mon Sep 17 00:00:00 2001 From: lcian <17258265+lcian@users.noreply.github.com> Date: Tue, 4 Nov 2025 10:56:10 +0100 Subject: [PATCH 1/3] chore: Add .envrc and pre-commit hook --- .envrc | 7 +++++++ .pre-commit-config.yaml | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .envrc create mode 100644 .pre-commit-config.yaml diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..571a8d67 --- /dev/null +++ b/.envrc @@ -0,0 +1,7 @@ +if [ ! -d "node_modules" ]; then + yarn install +fi + +if command -v uvx >/dev/null 2>&1 && [ ! -f ".git/hooks/pre-commit" ]; then + uvx pre-commit@latest install +fi diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..7d0898a9 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +repos: + - repo: local + hooks: + - id: format + name: format + description: yarn format + entry: yarn format + language: system + pass_filenames: false + - id: lint + name: lint + description: yarn lint + entry: yarn lint + language: system + pass_filenames: false From 6737f1570226aafd95830a4bbec0595e1fe79e64 Mon Sep 17 00:00:00 2001 From: lcian <17258265+lcian@users.noreply.github.com> Date: Tue, 11 Nov 2025 12:33:26 +0100 Subject: [PATCH 2/3] devenv --- .envrc | 18 ++++++++++++++++++ .gitignore | 5 ++++- devenv/config.ini | 8 ++++++++ devenv/sync.py | 17 +++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 devenv/config.ini create mode 100644 devenv/sync.py diff --git a/.envrc b/.envrc index 571a8d67..cc1944dc 100644 --- a/.envrc +++ b/.envrc @@ -1,3 +1,21 @@ +# Runs `devenv sync` to install `uv`, `yarn install`, and installs the `pre-commit` hook. + +if [[ -x "${PWD}/.devenv/bin/devenv" ]]; then + DEVENV="${PWD}/.devenv/bin/devenv" +elif command -v devenv >/dev/null 2>&1; then + DEVENV="devenv" +fi + +if [[ -n "$DEVENV" ]]; then + $DEVENV sync + PATH_add "${PWD}/.devenv/bin" +fi + +if ! command -v uv >/dev/null 2>&1; then + echo "ERROR: Please install devenv (https://github.com/getsentry/devenv) or uv (https://docs.astral.sh/uv/)" + return 1 +fi + if [ ! -d "node_modules" ]; then yarn install fi diff --git a/.gitignore b/.gitignore index 868f4471..d245a449 100644 --- a/.gitignore +++ b/.gitignore @@ -146,4 +146,7 @@ dist # Turborepo .turbo -.DS_Store \ No newline at end of file +.DS_Store + +# Devenv pycache +**/__pycache__ diff --git a/devenv/config.ini b/devenv/config.ini new file mode 100644 index 00000000..493f776f --- /dev/null +++ b/devenv/config.ini @@ -0,0 +1,8 @@ +[devenv] +minimum_version = 1.22.0 + +[uv] +darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.9.3/uv-aarch64-apple-darwin.tar.gz +darwin_arm64_sha256 = d6b2eaa1025b24b4779602763ad92f20112cbf19732fc6e0c72bb57a6a592c6c +# used for autoupdate +version = 0.9.3 diff --git a/devenv/sync.py b/devenv/sync.py new file mode 100644 index 00000000..054d4dd9 --- /dev/null +++ b/devenv/sync.py @@ -0,0 +1,17 @@ +from devenv.lib import config, uv + +from devenv import constants + + +def main(context: dict[str, str]) -> int: + reporoot = context["reporoot"] + cfg = config.get_repo(reporoot) + + uv.install( + cfg["uv"]["version"], + cfg["uv"][constants.SYSTEM_MACHINE], + cfg["uv"][f"{constants.SYSTEM_MACHINE}_sha256"], + reporoot, + ) + + return 0 From 82344594f5920cf08571c36b4841a3b3a55702f5 Mon Sep 17 00:00:00 2001 From: lcian <17258265+lcian@users.noreply.github.com> Date: Wed, 12 Nov 2025 16:46:19 +0100 Subject: [PATCH 3/3] add node and yarn to devenv --- .gitignore | 2 +- biome.json | 2 +- devenv/config.ini | 13 +++++++++++++ devenv/sync.py | 12 ++++++++++-- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d245a449..013db6fd 100644 --- a/.gitignore +++ b/.gitignore @@ -148,5 +148,5 @@ dist .DS_Store -# Devenv pycache +# Devenv **/__pycache__ diff --git a/biome.json b/biome.json index 9f8e97d0..a466299f 100644 --- a/biome.json +++ b/biome.json @@ -3,7 +3,7 @@ "vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false }, "files": { "ignoreUnknown": false, - "ignore": ["dist/*", "javascript/sentry-conventions/package.json", "rust/*", "python/*"] + "ignore": [".devenv/*", "dist/*", "javascript/sentry-conventions/package.json", "rust/*", "python/*"] }, "formatter": { "enabled": true, diff --git a/devenv/config.ini b/devenv/config.ini index 493f776f..9c6d4725 100644 --- a/devenv/config.ini +++ b/devenv/config.ini @@ -6,3 +6,16 @@ darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.9.3/uv-aarch6 darwin_arm64_sha256 = d6b2eaa1025b24b4779602763ad92f20112cbf19732fc6e0c72bb57a6a592c6c # used for autoupdate version = 0.9.3 + +[node] +darwin_x86_64 = https://storage.googleapis.com/sentry-dev-infra-assets/node/node-v22.16.0-darwin-x64.tar.xz +darwin_x86_64_sha256 = 5c34638f2c0e3f3aaa7b3a94b58304765a169730da1896ebba8515ea4d987a9c +darwin_arm64 = https://storage.googleapis.com/sentry-dev-infra-assets/node/node-v22.16.0-darwin-arm64.tar.xz +darwin_arm64_sha256 = aaf7fc3c936f1b359bc312b63638e41f258689ac2303966ad932cda18c54ea00 +linux_x86_64 = https://storage.googleapis.com/sentry-dev-infra-assets/node/node-v22.16.0-linux-x64.tar.xz +linux_x86_64_sha256 = f4cb75bb036f0d0eddf6b79d9596df1aaab9ddccd6a20bf489be5abe9467e84e +# used for autoupdate +version = v22.16.0 + +[yarn] +version = 1.22.22 diff --git a/devenv/sync.py b/devenv/sync.py index 054d4dd9..989ae963 100644 --- a/devenv/sync.py +++ b/devenv/sync.py @@ -1,6 +1,5 @@ -from devenv.lib import config, uv - from devenv import constants +from devenv.lib import config, node, uv def main(context: dict[str, str]) -> int: @@ -14,4 +13,13 @@ def main(context: dict[str, str]) -> int: reporoot, ) + node.install( + cfg["node"]["version"], + cfg["node"][constants.SYSTEM_MACHINE], + cfg["node"][f"{constants.SYSTEM_MACHINE}_sha256"], + reporoot, + ) + + node.install_yarn(cfg["yarn"]["version"], reporoot) + return 0