Skip to content

build: use npm ci for clean, reproducible installs#839

Open
SunsetDrifter wants to merge 1 commit into
mainfrom
docs/npm-ci
Open

build: use npm ci for clean, reproducible installs#839
SunsetDrifter wants to merge 1 commit into
mainfrom
docs/npm-ci

Conversation

@SunsetDrifter

@SunsetDrifter SunsetDrifter commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Why

Now that the lockfile is tracked (#838), switch installs to npm ci for clean, deterministic, lockfile-pinned installs. Third of the docs build/deploy speed series.

What

  • pr-build.yml: npm installnpm ci, and enable setup-node's cache: 'npm' (caches ~/.npm keyed on the lockfile).
  • docker/Dockerfile: npm install --productionnpm ci --omit=dev.

Impact

Testing

Ran both install paths in an isolated dir (did not touch the repo's node_modules):

  • npm ci --omit=dev (Docker path): exit 0; next 16.1.6, react, shiki present; eslint/prettier correctly omitted.
  • full npm ci (pr-build path): exit 0; devDeps present.

Depends on

Test plan

  • npm ci in sync with committed lockfile (both --omit=dev and full)
  • pr-build CI green

Summary by CodeRabbit

  • Chores
    • Updated build and container dependency installation to use cleaner, lockfile-based installs.
    • Enabled dependency caching in the build workflow to help speed up repeated runs.
    • Improved install consistency by omitting development-only packages in production image builds.

Switch pr-build and the Docker image from `npm install` to `npm ci` (`npm ci --omit=dev` in the image), and enable setup-node's npm cache. Deterministic installs from the committed lockfile; CI now fails fast on an out-of-sync lockfile.

Depends on the lockfile being tracked (PR #838) — npm ci requires a committed package-lock.json.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR build workflow now caches npm dependencies via actions/setup-node@v4 and installs dependencies using npm ci instead of npm install. Similarly, the Dockerfile replaces npm install --production with npm ci --omit=dev, updating its comment accordingly.

Changes

Lockfile-based npm installs

Layer / File(s) Summary
CI workflow npm caching and install
.github/workflows/pr-build.yml
Adds cache: 'npm' to actions/setup-node@v4 and switches the install step from npm install to npm ci.
Dockerfile clean install
docker/Dockerfile
Replaces npm install --production with npm ci --omit=dev and updates the accompanying comment.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Poem

A rabbit hops through logs and locks,
Swapping installs for tidy blocks,
npm ci, clean and neat,
Caching carrots for a quicker feat,
Hop, hop, ship! 🐇📦

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: switching build installs to npm ci for reproducible installs.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/npm-ci

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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