Skip to content

Commit dc18f96

Browse files
committed
feat: local copies of the js/css deps to enable sandboxed builds
Script to download the js and css dependencies that the HTML reports depend on. This means that the reports can be viewed offline and removes unnecessary dependency on CDN. Signed-off-by: James McCorrie <[email protected]>
1 parent e4522bd commit dc18f96

File tree

5 files changed

+56
-1
lines changed

5 files changed

+56
-1
lines changed

scripts/license_check.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
"CHANGELOG.md",
2626
]
2727

28-
IGNORE_SUFFIXES = [".lock"]
28+
IGNORE_SUFFIXES = [
29+
".lock", # lock files are generated files
30+
".min.js", # Vendored in JS files
31+
".bundle.min.js", # Vendored in JS files
32+
".min.css", # Vendored in CSS files
33+
]
2934

3035
OPTIONAL_TRAILING_NEWLINE = [".nix", ".md"]
3136

scripts/update_js.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
# Copyright lowRISC contributors (OpenTitan project).
3+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# Find the Git repository root directory
7+
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
8+
9+
if [ -z "$GIT_ROOT" ]; then
10+
echo "Error: This script must be run from within a Git repository."
11+
exit 1
12+
fi
13+
14+
# Define the target directory relative to the Git root
15+
TARGET_DIR="$GIT_ROOT/src/dvsim/templates/static"
16+
17+
# Create the directory (and any missing parents) if it doesn't exist
18+
mkdir -p "$TARGET_DIR/css" "$TARGET_DIR/js"
19+
echo "Downloading latest Bootstrap and htmx to $TARGET_DIR..."
20+
21+
# Bootstrap CSS (latest 5.x)
22+
curl -L -o "$TARGET_DIR/css/bootstrap.min.css" \
23+
https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css
24+
25+
# Bootstrap JS Bundle (includes Popper, latest 5.x)
26+
curl -L -o "$TARGET_DIR/js/bootstrap.bundle.min.js" \
27+
https://cdn.jsdelivr.net/npm/bootstrap@5/dist/js/bootstrap.bundle.min.js
28+
29+
# htmx (latest version via @latest tag)
30+
curl -L -o "$TARGET_DIR/js/htmx.min.js" \
31+
https://cdn.jsdelivr.net/npm/htmx.org@latest/dist/htmx.min.js
32+
33+
echo "Done! Files saved to:"
34+
echo " - $TARGET_DIR/css/bootstrap.min.css"
35+
echo " - $TARGET_DIR/js/bootstrap.bundle.min.js"
36+
echo " - $TARGET_DIR/js/htmx.min.js"

src/dvsim/templates/static/css/bootstrap.min.css

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dvsim/templates/static/js/bootstrap.bundle.min.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dvsim/templates/static/js/htmx.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)