dstandish commented on code in PR #64124:
URL: https://github.com/apache/airflow/pull/64124#discussion_r3509365171
##########
scripts/ci/prek/ts_compile_lint_ui.py:
##########
@@ -50,8 +52,20 @@
all_ts_files.append("src/vite-env.d.ts")
print("All TypeScript files:", all_ts_files)
- run_command(["pnpm", "config", "set", "store-dir", ".pnpm-store"], cwd=dir)
- run_command(["pnpm", "install", "--frozen-lockfile",
"--config.confirmModulesPurge=false"], cwd=dir)
+ hash_file = AIRFLOW_ROOT_PATH / ".build" / "ui" / "pnpm-install-hash.txt"
+ node_modules = dir / "node_modules"
+ current_hash = hashlib.sha256(
+ (dir / "package.json").read_bytes() + (dir /
"pnpm-lock.yaml").read_bytes()
+ ).hexdigest()
+ stored_hash = hash_file.read_text().strip() if hash_file.exists() else ""
+
+ if node_modules.exists() and current_hash == stored_hash:
+ print("pnpm deps unchanged — skipping install.")
+ else:
+ run_command(["pnpm", "config", "set", "store-dir", ".pnpm-store"],
cwd=dir)
+ run_command(["pnpm", "install", "--frozen-lockfile",
"--config.confirmModulesPurge=false"], cwd=dir)
+ hash_file.parent.mkdir(parents=True, exist_ok=True)
+ hash_file.write_text(current_hash)
Review Comment:
Fixed — the hash is now written to a temp file
(`hash_file.with_suffix(".tmp")`) and then moved into place with
`Path.replace()`, which is an atomic rename on the same filesystem. Fixed in
9ced3a1cec.
---
Drafted-by: Claude Code (Sonnet 5) (no human review before posting)
##########
scripts/ci/prek/ts_compile_lint_ui.py:
##########
@@ -50,8 +52,20 @@
all_ts_files.append("src/vite-env.d.ts")
print("All TypeScript files:", all_ts_files)
- run_command(["pnpm", "config", "set", "store-dir", ".pnpm-store"], cwd=dir)
- run_command(["pnpm", "install", "--frozen-lockfile",
"--config.confirmModulesPurge=false"], cwd=dir)
+ hash_file = AIRFLOW_ROOT_PATH / ".build" / "ui" / "pnpm-install-hash.txt"
+ node_modules = dir / "node_modules"
+ current_hash = hashlib.sha256(
+ (dir / "package.json").read_bytes() + (dir /
"pnpm-lock.yaml").read_bytes()
+ ).hexdigest()
+ stored_hash = hash_file.read_text().strip() if hash_file.exists() else ""
+
+ if node_modules.exists() and current_hash == stored_hash:
Review Comment:
Applied your suggestion — switched to `node_modules.is_dir()`. Fixed in
9ced3a1cec.
---
Drafted-by: Claude Code (Sonnet 5) (no human review before posting)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]