Skip to content

UID2-7874: separate React build and runtime dependencies - #214

Merged
swibi-ttd merged 5 commits into
mainfrom
swi-UID2-7874-runtime-dependencies
Sep 18, 2026
Merged

swibi-ttd merged 5 commits into
mainfrom
swi-UID2-7874-runtime-dependencies

Conversation

@swibi-ttd

@swibi-ttd swibi-ttd commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep application runtime libraries (react, react-dom, and express) in dependencies.
  • Move build and local-development tooling, including react-scripts and dotenv, to devDependencies in both React examples.
  • Use multi-stage Docker builds so runtime images install only production dependencies and run as the non-root node user.
  • Keep .trivyignore unchanged; removing the existing CVE suppressions is intentionally deferred to a follow-up.

Dependency classification

Packages imported by deployed application source remain production dependencies. Development dependencies are limited to tooling used to build, test, or develop the application and are not required by the deployed server or browser application. dotenv is only used to load the repository .env file locally; deployed environments inject variables directly, and the guarded import allows the server to run without it.

Lockfile/toolchain notes

  • Regenerated and verified lockfiles with Node 20.11.0 and its bundled npm 10.2.4, matching the Docker build environment.
  • The regenerated lockfiles add the missing nested yaml@2.9.1 entry required for clean npm ci with npm 10.2.4. No other package versions, resolved URLs, or integrity hashes changed.

Testing

  • Clean npm ci and CI=true npm run build pass for both React examples using Node 20.11.0 / npm 10.2.4.
  • Both Docker images build successfully and pass health endpoint, static asset, and runtime environment-injection smoke tests.
  • Final images include react and react-dom but exclude dotenv and the build-only react-scripts, bfj, and jsonpath packages.
  • Trivy filesystem scans report no jsonpath finding by default; --include-dev-deps still reports it as expected.

Out of scope

The pinned Alpine 3.18 base image and bundled npm CLI may still report unrelated vulnerability findings. Updating those components and removing obsolete .trivyignore entries should be handled separately.

Jira: UID2-7874

@swibi-ttd
swibi-ttd marked this pull request as ready for review September 17, 2026 04:59
@swibi-ttd
swibi-ttd requested a balanced review from Copilot September 17, 2026 04:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Dependency metadata and container stages consistently preserve required runtime packages while excluding development tooling.

Pull request overview

Separates build-time and runtime dependencies for both React examples and produces smaller, non-root runtime containers.

Changes:

  • Reclassifies build tooling under devDependencies.
  • Introduces multi-stage Docker builds with production-only installs.
  • Adds consistent Docker build-context exclusions.
File summaries
File Description
web-integrations/javascript-sdk/react-client-side/package.json Separates runtime and build dependencies.
web-integrations/javascript-sdk/react-client-side/package-lock.json Records updated dependency classifications.
web-integrations/javascript-sdk/react-client-side/Dockerfile Adds builder/runtime stages and non-root execution.
web-integrations/javascript-sdk/react-client-side/.dockerignore Excludes local and generated files.
web-integrations/google-secure-signals/react-client-side/package.json Separates runtime and build dependencies.
web-integrations/google-secure-signals/react-client-side/package-lock.json Records updated dependency classifications.
web-integrations/google-secure-signals/react-client-side/Dockerfile Adds builder/runtime stages and non-root execution.
web-integrations/google-secure-signals/react-client-side/.dockerignore Expands Docker exclusions.
Review details
  • Files reviewed: 6/8 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

swibi-ttd

This comment was marked as outdated.

…eason: automated release]

Automated release (PR #215).
mcollins-ttd
mcollins-ttd previously approved these changes Sep 18, 2026
@swibi-ttd
swibi-ttd merged commit a777b8a into main Sep 18, 2026
4 checks passed
@swibi-ttd
swibi-ttd deleted the swi-UID2-7874-runtime-dependencies branch September 18, 2026 03:28
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.

3 participants