Skip to content

Conversation

userquin
Copy link
Member

@userquin userquin commented Sep 17, 2025

Replaced tail -n +10 with node script to allow generate dts on Windows.

Summary by CodeRabbit

  • Chores
    • Improved generation of TypeScript declaration files for the router package to ensure more reliable and consistent typings.
    • Enhanced error handling during the declaration build step for clearer feedback if augmentation content is missing.
    • No changes to public APIs or type signatures; existing integrations remain unaffected.
Copy link

netlify bot commented Sep 17, 2025

Deploy Preview for vue-router canceled.

Name Link
🔨 Latest commit ef3fc56
🔍 Latest deploy log https://app.netlify.com/projects/vue-router/deploys/68cab54dc6bf1000081eae1c
Copy link
Contributor

coderabbitai bot commented Sep 17, 2025

Walkthrough

Replaces a shell-based DTS append step with a Node.js script in the build:dts pipeline. Adds add-dts-module-augmentation.mjs to extract module augmentation from src/globalExtensions.ts and append it to dist/vue-router.d.ts after api-extractor runs. No public API signatures were changed.

Changes

Cohort / File(s) Summary
Build script update
packages/router/package.json
Updated build:dts to run api-extractor run --local --verbose followed by node ./add-dts-module-augmentation.mjs, replacing a prior tail-based append of augmentation content.
New DTS augmentation script
packages/router/add-dts-module-augmentation.mjs
New Node script reads src/globalExtensions.ts, extracts augmentation starting at the first /**, appends it to dist/vue-router.d.ts, and writes back. Throws descriptive error if marker not found.

Sequence Diagram(s)

sequenceDiagram autonumber participant Dev as npm script participant AE as api-extractor participant Script as add-dts-module-augmentation.mjs participant Src as src/globalExtensions.ts participant Dts as dist/vue-router.d.ts Dev->>AE: Run api-extractor (--local --verbose) AE-->>Dev: Emit vue-router.d.ts Dev->>Script: node add-dts-module-augmentation.mjs Script->>Src: Read file alt Marker found (/**) Script->>Dts: Read current contents Script->>Dts: Append augmentation block + newline Dts-->>Script: Write complete Script-->>Dev: Done else Marker missing Script-->>Dev: Throw Error("Augmentation marker not found") end 
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I hop through builds with whiskers bright,
Stitching typings late at night.
A gentle nudge, a script anew,
To glue the docs in d.ts brew.
Tail is gone, but fear not, friend—
My Node-y paws will see it end. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "chore(build:dts): fix building dts on Windows" succinctly and accurately summarizes the primary change: fixing the dts build process specifically for Windows and scoped to the build:dts task. It is concise, follows conventional commit style, and clearly communicates the intent to reviewers scanning history.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59c5248 and ef3fc56.

📒 Files selected for processing (2)
  • packages/router/add-dts-module-augmentation.mjs (1 hunks)
  • packages/router/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/router/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
packages/router/add-dts-module-augmentation.mjs (2)

1-25: Good call replacing tail with Node for Windows compatibility.

Cross‑platform DTS patching via Node is the right direction. After addressing the robustness points above, this should be solid.

Please confirm the script runs via the updated package.json on Windows and Linux (e.g., GitHub Actions) and that the resulting dist/vue-router.d.ts stays unchanged on a second invocation.


1-25: Make patcher robust and deterministic — verification blocked: dist/vue-router.d.ts missing (ENOENT)

Verification run failed with: ENOENT opening './dist/vue-router.d.ts' (packages/router). Cannot confirm idempotency or apply verification.

  • Keep the proposed patch: anchor on "declare module" (include preceding JSDoc if present), resolve paths relative to the script (fileURLToPath/dirname), make idempotent (skip if augmentation already present), normalize trailing newline, and ensure the script exits non‑zero on error; use consistent "utf8".
  • Locations: packages/router/add-dts-module-augmentation.mjs (script), dist/vue-router.d.ts (target — currently missing).

Re-run verification after producing dist/vue-router.d.ts (run your types build), e.g.:

cd packages/router

run your regular types build first so dist/vue-router.d.ts exists

node ./add-dts-module-augmentation.mjs
rg -n '^declare module ' dist/vue-router.d.ts
node ./add-dts-module-augmentation.mjs
rg -n '^declare module ' dist/vue-router.d.ts


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 and usage tips.

Copy link

pkg-pr-new bot commented Sep 17, 2025

Open in StackBlitz

npm i https://pkg.pr.new/vue-router@2552 

commit: ef3fc56

Copy link

codecov bot commented Sep 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.80%. Comparing base (6171856) to head (ef3fc56).
⚠️ Report is 192 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@ ## main #2552 +/- ## ======================================= Coverage 94.80% 94.80% ======================================= Files 34 34 Lines 3004 3004 Branches 846 846 ======================================= Hits 2848 2848 Misses 153 153 Partials 3 3 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6fbdab and 065a158.

📒 Files selected for processing (2)
  • packages/router/add-dts-module-augmentation.js (1 hunks)
  • packages/router/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
packages/router/add-dts-module-augmentation.js (1)

1-25: Make patcher robust, idempotent, file‑relative — anchor on "declare module" (verified)

  • Confirmed: packages/router/src/globalExtensions.ts contains a declare module block; use it as the primary anchor and fall back to the second /** JSDoc if needed.
  • Change packages/router/add-dts-module-augmentation.js to:
    • be idempotent (skip if augmentation already present),
    • use file‑relative paths (compute dirname),
    • use consistent "utf8" encoding, avoid trailing-space noise, and ensure safe newline separation,
    • add top‑level .catch that logs the stack and sets process.exitCode = 1.
  • Verify module system in packages/router/package.json ("type"): if ESM, keep import syntax and compute dirname via fileURLToPath(import.meta.url); if CJS, convert the script to .cjs or use require.
@posva
Copy link
Member

posva commented Sep 18, 2025

the tail is no longer there 🎉

@posva posva closed this Sep 18, 2025
@userquin userquin deleted the fix-windows-build branch September 19, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants