Skip to content

enhance: restore SRC_ROOT to setup-cms.sh - #1107

Merged
wesleyboar merged 2 commits into
mainfrom
enhance/restore-vars-core-cms-template-uses
Feb 26, 2026
Merged

enhance: restore SRC_ROOT to setup-cms.sh#1107
wesleyboar merged 2 commits into
mainfrom
enhance/restore-vars-core-cms-template-uses

Conversation

@wesleyboar

Copy link
Copy Markdown
Member

Overview

Restore SRC_ROOT to setup-cms.sh. TACC/Core-CMS-Custom changes this variable. Having it here introduces parity.

Related

TACC/Core-CMS-Custom changes this variable. Having it here introduces parity.
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Restore SRC_ROOT variable to setup-cms.sh for parity

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Introduce SRC_ROOT variable for source directory management
• Allow TACC/Core-CMS-Custom to adjust source root independently
• Replace PROJECT_ROOT with SRC_ROOT in file operations
• Maintain PROJECT_ROOT for Docker build/start commands
Diagram
flowchart LR
  A["setup-cms.sh"] -->|"Define SRC_ROOT"| B["SRC_ROOT variable"]
  B -->|"Use in file ops"| C["File downloads & paths"]
  B -->|"Use in cd commands"| D["Directory navigation"]
  A -->|"Keep PROJECT_ROOT"| E["Docker operations"]
  E -->|"make build/start"| F["Container management"]
Loading

Grey Divider

File Changes

1. bin/setup-cms.sh ✨ Enhancement +8/-4

Introduce SRC_ROOT for flexible source directory handling

• Add SRC_ROOT variable definition pointing to script directory
• Replace PROJECT_ROOT with SRC_ROOT for file operations and directory navigation
• Preserve PROJECT_ROOT usage for Docker build and start commands
• Add explicit cd "$PROJECT_ROOT" before make commands to ensure correct context

bin/setup-cms.sh


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Feb 26, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. SRC_ROOT diverges from /code 🐞 Bug ✓ Correctness
Description
setup-cms.sh now supports an adjustable SRC_ROOT and uses it for writing settings and building
CSS, but containers are still started from PROJECT_ROOT where docker-compose mounts .:/code. If
SRC_ROOT != PROJECT_ROOT, the generated settings/CSS can land outside the container’s mounted
/code, leading to startup failures (missing settings) or stale/missing static assets.
Code

bin/setup-cms.sh[R196-199]

# FAQ: To rebuild CSS via ad-hoc Node container, because
#      `docker-compose.dev.yml` mounts `.:/code` which erases pre-built CSS   
echo -e "${INF}Building CSS...${RST}"
-docker run --rm -v "$PROJECT_ROOT:/code" -w /code "$NODE_IMAGE" sh -c "npm ci && npm run build"
+docker run --rm -v "$SRC_ROOT:/code" -w /code "$NODE_IMAGE" sh -c "npm ci && npm run build"
Evidence
The script explicitly introduces SRC_ROOT as something a downstream repo can adjust, then uses it
for file operations; however, make start runs docker-compose from PROJECT_ROOT, and
docker-compose mounts the *current directory* into the container as /code. The Node/CSS build
writes outputs into paths under the repo root (derived from __dirname + '/..'), so building in a
different root than what the container mounts means the CMS container won’t see those outputs.

bin/setup-cms.sh[14-17]
bin/setup-cms.sh[51-52]
bin/setup-cms.sh[118-122]
Makefile[41-47]
docker-compose.dev.yml[1-7]
Dockerfile[22-26]
bin/setup-cms.sh[195-199]
bin/build-css.js[9-23]
package.json[17-21]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`bin/setup-cms.sh` introduces `SRC_ROOT` as an adjustable root and uses it for file generation (settings download) and CSS build mounts, but still starts containers from `PROJECT_ROOT` where docker-compose mounts `.:/code`. If these diverge, generated files can land outside the container’s `/code`.

## Issue Context
- docker-compose mounts the directory where it is executed (`.`) into `/code`.
- The CSS build writes output under the repo root (`__dirname + '/..'`).

## Fix Focus Areas
- bin/setup-cms.sh[14-17]
- bin/setup-cms.sh[51-52]
- bin/setup-cms.sh[69-75]
- bin/setup-cms.sh[118-122]
- bin/setup-cms.sh[195-199]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@wesleyboar

wesleyboar commented Feb 26, 2026

Copy link
Copy Markdown
Member Author

Qodo, they are the same. If they differ, build output would be in… well, for this repo, maybe still project root. Okay, I yield. Changed in c925039.

@wesleyboar
wesleyboar merged commit d27d380 into main Feb 26, 2026
@wesleyboar
wesleyboar deleted the enhance/restore-vars-core-cms-template-uses branch February 26, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant