()
| 66 | |
| 67 | |
| 68 | def main(): |
| 69 | ui_dir = sys.argv[1] |
| 70 | # shell=True so the npm shim resolves on every platform (npm.cmd on |
| 71 | # Windows is not found by bare-name exec). Constant command, no injection. |
| 72 | ls = subprocess.run( |
| 73 | "npm ls --omit=dev --all --json", |
| 74 | shell=True, cwd=ui_dir, capture_output=True, text=True, check=False, |
| 75 | ) |
| 76 | tree = json.loads(ls.stdout or "{}") |
| 77 | pkgs = set() |
| 78 | excluded = set() |
| 79 | collect(ui_dir, tree.get("dependencies"), pkgs, excluded) |
| 80 | |
| 81 | print("## External Graph UI asset pack — bundled npm packages") |
| 82 | print() |
| 83 | print("The `-ui` archives ship a compiled frontend asset pack beside the binary.") |
| 84 | print("The packages below are its production dependency tree; license texts are") |
| 85 | print("reproduced verbatim from the packages as installed at build time.") |
| 86 | print() |
| 87 | |
| 88 | for name, version in sorted(pkgs): |
| 89 | pkg_dir = os.path.join(ui_dir, "node_modules", *name.split("/")) |
| 90 | lic = declared_license(pkg_dir) |
| 91 | text = license_text(pkg_dir) |
| 92 | print(f"### {name}@{version} — {lic}") |
| 93 | print() |
| 94 | if text: |
| 95 | print(text) |
| 96 | else: |
| 97 | print(f"(no license file shipped in the package; declared license: {lic})") |
| 98 | print() |
| 99 | |
| 100 | if excluded: |
| 101 | print("### Platform-specific build tooling (not part of the bundle)") |
| 102 | print() |
| 103 | print("Resolved in the dependency tree but excluded above: these are") |
| 104 | print("native per-platform build binaries whose code does not ship in") |
| 105 | print("the browser bundle.") |
| 106 | print() |
| 107 | for name, version in sorted(excluded): |
| 108 | print(f"- {name}@{version}") |
| 109 | print() |
| 110 | |
| 111 | |
| 112 | if __name__ == "__main__": |
no test coverage detected