fix: use corepack yarn directly in _pick_yarn_cmd
This commit is contained in:
1 parent
eeeca44e4a
commit
4b2d79e62f
1 file changed
+10
-11
+10
-11
@@ -2003,23 +2003,22 @@ def _build_frontend(src_frontend: Path, dest_frontend: Path):
|
|||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(f" debug pick: yarn_bin={yarn_bin} HANGS, skipping")
|
print(f" debug pick: yarn_bin={yarn_bin} HANGS, skipping")
|
||||||
|
|
||||||
# Use npm exec directly (bypasses broken corepack proxy)
|
# Use corepack yarn directly (bypasses broken corepack proxy)
|
||||||
if shutil.which("npm"):
|
if shutil.which("corepack") and shutil.which("npm"):
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["npm", "exec", "--yes", "yarn@stable", "--", "--version"],
|
["corepack", "yarn", "--version"],
|
||||||
capture_output=True, text=True, timeout=30,
|
capture_output=True, text=True, timeout=15,
|
||||||
)
|
)
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(f" debug pick: npm exec version={result.stdout.strip()} rc={result.returncode}")
|
print(f" debug pick: corepack yarn version={result.stdout.strip()} rc={result.returncode}")
|
||||||
major = _get_yarn_major_version(["npm", "exec", "--yes", "yarn@stable", "--"])
|
if result.returncode == 0:
|
||||||
if major and major >= 4:
|
match = re.match(r'^(\d+)', result.stdout.strip())
|
||||||
if DEBUG:
|
if match and int(match.group(1)) >= 4:
|
||||||
print(f" debug pick: using npm exec for yarn")
|
return ["corepack", "yarn"]
|
||||||
return ["npm", "exec", "--yes", "yarn@stable", "--"]
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(f" debug pick: npm exec failed: {e}")
|
print(f" debug pick: corepack yarn failed: {e}")
|
||||||
pass
|
pass
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user