diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml index 13b293eb..9b76a88f 100644 --- a/.github/workflows/jekyll.yml +++ b/.github/workflows/jekyll.yml @@ -2,9 +2,9 @@ name: Jekyll site CI on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] permissions: contents: read @@ -15,61 +15,72 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Block node_modules changes on pull requests - if: github.event_name == 'pull_request' - run: | - BASE_SHA="${{ github.event.pull_request.base.sha }}" - HEAD_SHA="${{ github.event.pull_request.head.sha }}" - CHANGED_NODE_MODULES="$(git diff --name-only "${BASE_SHA}...${HEAD_SHA}" -- 'node_modules/**')" - - if [ -n "${CHANGED_NODE_MODULES}" ]; then - echo "::error title=Blocked path::Pull request includes changes under node_modules/." - echo "${CHANGED_NODE_MODULES}" - exit 1 - fi - - - name: Block node_modules changes on pushes - if: github.event_name == 'push' - run: | - BASE_SHA="${{ github.event.before }}" - HEAD_SHA="${{ github.sha }}" - ZERO_SHA="0000000000000000000000000000000000000000" - - if [ "${BASE_SHA}" = "${ZERO_SHA}" ]; then - echo "Initial push detected; skipping node_modules diff guard." - exit 0 - fi - - CHANGED_NODE_MODULES="$(git diff --name-only "${BASE_SHA}...${HEAD_SHA}" -- 'node_modules/**')" - - if [ -n "${CHANGED_NODE_MODULES}" ]; then - echo "::error title=Blocked path::Push includes changes under node_modules/." - echo "${CHANGED_NODE_MODULES}" - exit 1 - fi - - - name: Verify thesis navigation docs stay in sync - run: | - chmod +x scripts/check-phd-thesis-nav-docs.sh - ./scripts/check-phd-thesis-nav-docs.sh - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.2' - bundler-cache: true - - - name: Build site and search database - run: | - chmod +x scripts/build.sh - ./scripts/build.sh - - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Block node_modules changes on pull requests + if: github.event_name == 'pull_request' + run: | + BASE_SHA="${{ github.event.pull_request.base.sha }}" + HEAD_SHA="${{ github.event.pull_request.head.sha }}" + CHANGED_NODE_MODULES="$(git diff --name-only "${BASE_SHA}...${HEAD_SHA}" -- 'node_modules/**')" + + if [ -n "${CHANGED_NODE_MODULES}" ]; then + echo "::error title=Blocked path::Pull request includes changes under node_modules/." + echo "${CHANGED_NODE_MODULES}" + exit 1 + fi + + - name: Block node_modules changes on pushes + if: github.event_name == 'push' + run: | + BASE_SHA="${{ github.event.before }}" + HEAD_SHA="${{ github.sha }}" + ZERO_SHA="0000000000000000000000000000000000000000" + + if [ "${BASE_SHA}" = "${ZERO_SHA}" ]; then + echo "Initial push detected; skipping node_modules diff guard." + exit 0 + fi + + CHANGED_NODE_MODULES="$(git diff --name-only "${BASE_SHA}...${HEAD_SHA}" -- 'node_modules/**')" + + if [ -n "${CHANGED_NODE_MODULES}" ]; then + echo "::error title=Blocked path::Push includes changes under node_modules/." + echo "${CHANGED_NODE_MODULES}" + exit 1 + fi + + - name: Verify thesis navigation docs stay in sync + run: | + chmod +x scripts/check-phd-thesis-nav-docs.sh + ./scripts/check-phd-thesis-nav-docs.sh + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22.16.0" + cache: "npm" + + - name: Lint markdown + run: | + npm ci --no-fund --no-audit --ignore-scripts + npm run lint:md + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + bundler-cache: true + + - name: Build site and search database + run: | + chmod +x scripts/build.sh + ./scripts/build.sh + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 deploy: # Only run deploy job on push to main, not on PRs diff --git a/.github/workflows/update-search.yml b/.github/workflows/update-search.yml index e5ca419e..5de31e72 100644 --- a/.github/workflows/update-search.yml +++ b/.github/workflows/update-search.yml @@ -39,22 +39,29 @@ jobs: run: | GITHUB_ORG="${GITHUB_REPOSITORY%%/*}" SEARCH_REPO="${SEARCH_REPO:-comphy-search}" - echo "Attempting to clone search database from ${GITHUB_ORG}/${SEARCH_REPO}..." + SEARCH_BRANCH="${SEARCH_BRANCH:-main}" + CLONE_URL="https://github.com/${GITHUB_ORG}/${SEARCH_REPO}.git" + CLONE_LOG="$(mktemp)" - if git clone "https://github.com/${GITHUB_ORG}/${SEARCH_REPO}.git"; then + echo "Attempting to clone search database from ${GITHUB_ORG}/${SEARCH_REPO} (${SEARCH_BRANCH})..." + + if git clone --single-branch --branch "${SEARCH_BRANCH}" "${CLONE_URL}" 2>"${CLONE_LOG}"; then mkdir -p assets/js echo "clone_ok=true" >> "${GITHUB_OUTPUT}" echo "Search database repository cloned successfully" else echo "clone_ok=false" >> "${GITHUB_OUTPUT}" - echo "Warning: Could not clone ${GITHUB_ORG}/${SEARCH_REPO}" - echo "Search functionality may be limited. This is expected if the search repository does not exist." - echo "::warning title=Search DB clone failed::Could not clone ${GITHUB_ORG}/${SEARCH_REPO}. Search update will be skipped." + CLONE_ERROR="$(tr '\n' ' ' < "${CLONE_LOG}" | sed 's/[[:space:]]\+/ /g; s/^ //; s/ $//')" + echo "::error title=Search DB clone failed::Could not clone ${GITHUB_ORG}/${SEARCH_REPO} (${SEARCH_BRANCH})." { - echo "### Search DB update skipped" - echo "- Clone failed for \`${GITHUB_ORG}/${SEARCH_REPO}\`." + echo "### Search DB clone failed" + echo "- Repository: \`${GITHUB_ORG}/${SEARCH_REPO}\`" + echo "- Branch: \`${SEARCH_BRANCH}\`" + echo "- URL: \`${CLONE_URL}\`" + echo "- Error: \`${CLONE_ERROR}\`" } >> "${GITHUB_STEP_SUMMARY}" - exit 0 + cat "${CLONE_LOG}" >&2 + exit 1 fi - name: Copy search database diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..29f1c7af --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +set -e + +REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)" + +if [ -z "$REPO_ROOT" ]; then + echo "Unable to determine repository root for pre-commit checks." + exit 1 +fi + +sh "$REPO_ROOT/scripts/check-node-modules.sh" diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc index 45757da9..0f25a2bd 100644 --- a/.markdownlint-cli2.jsonc +++ b/.markdownlint-cli2.jsonc @@ -1,5 +1,6 @@ { "config": { + "default": false, "MD034": true, }, "ignores": ["node_modules/**", "assets/css/academicons-1.7.0/README.md"], diff --git a/AGENTS.md b/AGENTS.md index 146e1a07..cf414b6f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -94,6 +94,12 @@ The following pages redirect to the CoMPhy Lab website: - Escape literal dollar signs in content as `\$` to prevent accidental math parsing. +### MathJax Update Checklist + +- Refresh vendored MathJax at `assets/js/mathjax/tex-svg.js`. +- Update pinned fallback URL and SRI hash in `_layouts/default.html`. +- Re-run `scripts/check-phd-thesis-nav-docs.sh` and `npm run lint:md`. + ### Content Management - Team information and research papers are managed at the CoMPhy Lab diff --git a/Gemfile.lock b/Gemfile.lock index 4f794e40..1160d305 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,12 +10,12 @@ GEM eventmachine (>= 0.12.9) http_parser.rb (~> 0) eventmachine (1.2.7) - faraday (2.12.2) + faraday (2.14.1) faraday-net_http (>= 2.0, < 3.5) json logger - faraday-net_http (3.4.0) - net-http (>= 0.5.0) + faraday-net_http (3.4.2) + net-http (~> 0.5) ffi (1.17.1) ffi (1.17.1-aarch64-linux-gnu) ffi (1.17.1-aarch64-linux-musl) @@ -80,7 +80,7 @@ GEM jekyll (>= 3.7, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) - json (2.9.1) + json (2.18.1) kramdown (2.5.1) rexml (>= 3.3.9) kramdown-parser-gfm (1.1.0) @@ -89,10 +89,10 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.5) + logger (1.7.0) mercenary (0.4.0) - net-http (0.6.0) - uri + net-http (0.9.1) + uri (>= 0.11.1) octokit (4.25.1) faraday (>= 1, < 3) sawyer (~> 0.9) diff --git a/README.md b/README.md index 5633868c..e73841d7 100644 --- a/README.md +++ b/README.md @@ -47,14 +47,17 @@ The personal website for Vatsal Sanjay, hosted at [comphy-lab.org/vatsalsy](http - Bundler (`gem install bundler`) 2. **Install Dependencies** + ```bash bundle install ``` 3. **Run Local Server** + ```bash bundle exec jekyll serve ``` + - Visit in the browser - Changes in source files trigger automatic rebuilds @@ -62,9 +65,18 @@ The personal website for Vatsal Sanjay, hosted at [comphy-lab.org/vatsalsy](http - Typically managed via GitHub Pages when merged/pushed to the main branch - Local testing is recommended before committing changes +### Commit Guardrails + +- Run `./scripts/check-node-modules.sh` before commits if you touch dependencies. +- If `node_modules/` changes were accidental, clean them with: + - `git restore --staged --worktree -- node_modules` + - `git clean -fdX -- node_modules/` +- Install hooks with `npm install` so `.husky/pre-commit` blocks staged `node_modules/` changes automatically. + ### Content Management #### About Page & Content + - `about.md`: Redirects to the About section on the homepage (/#about) - `aboutVatsal.md`: Contains the About section content loaded via JavaScript on the homepage - The main.js file fetches and renders aboutVatsal.md in the #about-content element @@ -72,15 +84,17 @@ The personal website for Vatsal Sanjay, hosted at [comphy-lab.org/vatsalsy](http **IMPORTANT**: When updating `aboutVatsal.md`, you must also update the fallback content in `about.md` (lines 15-37) to keep them synchronized. The fallback content is displayed when JavaScript is disabled. #### Research Pages + - `research-interests.md`: Redirects to comphy-lab.org/research - `research-interest.md`: Redirects to comphy-lab.org/research - `phd-thesis.md`: Redirects to comphy-lab.org/research#thesis - `talks.md`: Redirects to comphy-lab.org/research #### Contact Page + - `contact.md`: Redirects to comphy-lab.org/join -#### Adding or Editing Team +#### Adding or Editing Team See: [comphy-lab.org/team](https://comphy-lab.org/team) and to edit, see: [github](https://github.com/comphy-lab/comphy-lab.github.io) @@ -91,12 +105,14 @@ See: [comphy-lab.org/research](https://comphy-lab.org/research) and to edit, see ## Part B: Back-End Documentation ### Configuration and Layouts + - `_config.yml`: Site-wide settings, collections, build options - Layout Templates in `_layouts/` - Partial Includes in `_includes/` - Assets in `assets/` ### Design Elements + - **Color Scheme** - Gradient text (Red to Blue) for lab name - Warm orange tint + blur for header @@ -109,16 +125,17 @@ See: [comphy-lab.org/research](https://comphy-lab.org/research) and to edit, see - Generated from CoMPhy Lab logo ### Fonts and Icons Attribution + - [Academicons 1.7.0 (SIL OFL 1.1, MIT)](https://jpswalsh.github.io/academicons/) - [Font Awesome](https://fontawesome.com/) - Fontello (Various licenses) - Libre Baskerville (SIL Open Font License) - Open Sans (Apache License 2.0) - ## Contributing Guidelines ### Issue Templates + The repository includes several issue templates to streamline the process of reporting problems or requesting changes: 1. **[Bug Report](https://github.com/VatsalSy/VatsalSy.github.io/issues/new?template=bug_report.yml)**: Use this template to report website issues, broken links, or display problems @@ -126,6 +143,7 @@ The repository includes several issue templates to streamline the process of rep 3. **[Add Publication](https://github.com/VatsalSy/VatsalSy.github.io/issues/new?template=add_publication.yml)**: Template for adding new research publications with metadata To create a new issue: + 1. Click one of the template links above, or 2. Go to the Issues tab in GitHub 3. Click "New Issue" @@ -134,7 +152,9 @@ To create a new issue: 6. Submit the issue ### Pull Request Template + When submitting changes, use the provided PR template which includes: + - Description of changes - Type of change (bug fix, feature, content update, etc.) - Testing checklist @@ -142,6 +162,7 @@ When submitting changes, use the provided PR template which includes: - Screenshots (if applicable) To submit a PR: + 1. Fork the repository 2. Create a new branch for your changes 3. Make and test your changes locally diff --git a/about.md b/about.md index 0e017d3e..4501d81d 100644 --- a/about.md +++ b/about.md @@ -52,9 +52,8 @@ We’re building a computationally focused group at Durham. If you’re excited - Sanjay, V., Zhang, B., Lv, C., & Lohse, D. The role of viscosity on drop impact forces on non-wetting surfaces. J. Fluid Mech., 1004, A6 (2025). [![Open Access](https://img.shields.io/badge/Open%20Access-Open-orange?logo=openaccess&logoColor=white&style=flat)](https://doi.org/10.1017/jfm.2024.982) ### Find me -[![Location](https://img.shields.io/badge/-Physics%20of%20Fluids-4285F4?style=flat&logo=googlemaps&logoColor=white)](https://maps.app.goo.gl/jSTCYnfcndF1uZPV8) +[![Location](https://img.shields.io/badge/-Durham%20University-4285F4?style=flat&logo=googlemaps&logoColor=white)](https://www.durham.ac.uk/staff/vatsal-sanjay/) [![Website](https://img.shields.io/badge/-comphy--lab.org-4285F4?style=flat&logo=googlechrome&logoColor=white)](https://comphy-lab.org) -[![Email](https://img.shields.io/badge/-mailto:vatsal.sanjay@comphy--lab.org-EA4335?style=flat&logo=gmail&logoColor=white)](mailto:vatsal.sanjay@comphy-lab.org)
diff --git a/package.json b/package.json index e81910ea..c9356e45 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,8 @@ "lint:js": "eslint assets/js/**/*.js", "lint:css": "stylelint 'assets/css/**/*.css'", "lint:md": "markdownlint-cli2 '**/*.md' --ignore node_modules", + "lint:md:fix": "markdownlint-cli2 --fix '**/*.md' --ignore node_modules", + "check:node-modules": "./scripts/check-node-modules.sh", "lint": "npm run lint:js && npm run lint:css && npm run lint:md", "format": "prettier --write assets/js/**/*.js assets/css/**/*.css", "prepare": "husky", diff --git a/scripts/check-node-modules.sh b/scripts/check-node-modules.sh new file mode 100755 index 00000000..11d345ab --- /dev/null +++ b/scripts/check-node-modules.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + echo "This check must run inside a git repository." + exit 1 +fi + +STAGED_NODE_MODULES="$(git diff --cached --name-only -- 'node_modules/**')" + +if [[ -n "${STAGED_NODE_MODULES}" ]]; then + echo "Blocked: staged changes detected under node_modules/." + echo "Unstage or revert these paths before committing:" + echo "${STAGED_NODE_MODULES}" + echo + echo "Quick cleanup options:" + echo " git restore --staged --worktree -- node_modules" + echo " git clean -fdX -- node_modules/" + exit 1 +fi + +echo "No staged node_modules changes found." diff --git a/scripts/check-phd-thesis-nav-docs.sh b/scripts/check-phd-thesis-nav-docs.sh index 5d1b592d..2a77b363 100755 --- a/scripts/check-phd-thesis-nav-docs.sh +++ b/scripts/check-phd-thesis-nav-docs.sh @@ -5,9 +5,12 @@ set -euo pipefail REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" LAYOUT_FILE="${REPO_ROOT}/_layouts/default.html" DOC_FILE="${REPO_ROOT}/AGENTS.md" +ABOUT_SOURCE_FILE="${REPO_ROOT}/aboutVatsal.md" +ABOUT_FALLBACK_FILE="${REPO_ROOT}/about.md" NAV_LINK='href="{{ site.baseurl }}/phd-thesis/"' DOC_PHRASE="This page is included in the main navigation menu" +ABOUT_HEADING="# About Me" if [[ ! -f "${LAYOUT_FILE}" ]]; then echo "Missing layout file: ${LAYOUT_FILE}" @@ -19,6 +22,16 @@ if [[ ! -f "${DOC_FILE}" ]]; then exit 1 fi +if [[ ! -f "${ABOUT_SOURCE_FILE}" ]]; then + echo "Missing source about content file: ${ABOUT_SOURCE_FILE}" + exit 1 +fi + +if [[ ! -f "${ABOUT_FALLBACK_FILE}" ]]; then + echo "Missing fallback about content file: ${ABOUT_FALLBACK_FILE}" + exit 1 +fi + nav_present=0 doc_phrase_present=0 @@ -42,4 +55,35 @@ if [[ ${nav_present} -eq 0 && ${doc_phrase_present} -eq 1 ]]; then exit 1 fi -echo "PhD thesis nav/docs check passed." +tmp_about_source="$(mktemp "${TMPDIR:-/tmp}/about_source.XXXXXX")" +tmp_about_fallback="$(mktemp "${TMPDIR:-/tmp}/about_fallback.XXXXXX")" +tmp_about_diff="$(mktemp "${TMPDIR:-/tmp}/about_diff.XXXXXX")" +trap 'rm -f "${tmp_about_source}" "${tmp_about_fallback}" "${tmp_about_diff}"' EXIT + +cp "${ABOUT_SOURCE_FILE}" "${tmp_about_source}" +awk -v about_heading="${ABOUT_HEADING}" ' + $0 == about_heading { + in_section = 1 + } + in_section && $0 ~ /^# / && $0 != about_heading { + exit + } + in_section { + print + } +' "${ABOUT_FALLBACK_FILE}" > "${tmp_about_fallback}" + +if [[ ! -s "${tmp_about_fallback}" ]]; then + echo "Could not find fallback heading '${ABOUT_HEADING}' in ${ABOUT_FALLBACK_FILE}." + exit 1 +fi + +if ! diff -u "${tmp_about_source}" "${tmp_about_fallback}" > "${tmp_about_diff}"; then + echo "About content drift detected between aboutVatsal.md and fallback content in about.md." + echo "Update ${ABOUT_FALLBACK_FILE} fallback section to match ${ABOUT_SOURCE_FILE}." + echo "Diff:" + cat "${tmp_about_diff}" + exit 1 +fi + +echo "PhD thesis nav/docs and about fallback sync checks passed."