Fix scope path to end with slash#927
Conversation
📝 WalkthroughWalkthroughThe PR centralizes and normalizes BUILD_BASE_PATH handling: adds trailing-slash normalization in Changes
Sequence Diagram(s)(omitted — changes are small normalization adjustments without multi-component flow requiring visualization) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ 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). (2)
🔇 Additional comments (1)
✏️ Tip: You can disable this entire section by setting 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@convert/convertManifest.ts`:
- Around line 27-34: The local variable named `path` inside the scope-handling
block shadows the imported `path` module and breaks calls like
`path.join(dataDir, bareFileName)`; rename that local variable (for example to
`scopePath` or `buildBasePath`) in the `if (line.includes('scope')) { ... }`
block and update its usage in the template literal (`"scope" : "${...}",`) so
the imported `path` module remains available for calls such as `path.join(...)`.
🧹 Nitpick comments (1)
convert/convertManifest.ts (1)
23-26: Note: Pre-existing variable shadowing issue here as well.Line 24 also declares a
const paththat shadows the importedpathmodule. While this isn't part of your changes, consider renaming both tobasePathor similar for consistency and to resolve the shadowing throughout this function.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
convert/convertManifest.tssvelte.config.js
⏰ 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). (2)
- GitHub Check: test
- GitHub Check: lint
🔇 Additional comments (2)
svelte.config.js (2)
10-16: LGTM! Clean implementation of scope normalization.The helper variable with clear comments effectively normalizes the trailing slash. Consider extracting this logic into a shared utility if it needs to be reused elsewhere (e.g.,
convertManifest.tsuses identical logic).
43-47: LGTM!The service worker scope now correctly uses the normalized path with a trailing slash.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
a916c1f to
dc18a4f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@convert/convertManifest.ts`:
- Around line 23-26: The start_url handling can produce a double slash when
BUILD_BASE_PATH ends with '/', so update the logic in the block that checks
line.includes('start_url') to normalize urlPath like scopePath does: compute
urlPath from process.env.BUILD_BASE_PATH (falling back to '.') and ensure it
does not end with a trailing slash before appending a single '/' when building
the line string for "start_url" (refer to the urlPath variable and the code that
sets line = ` "start_url" : "${urlPath}/",`). Ensure the same trailing-slash
check used for scopePath is applied to urlPath to avoid producing '//'.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
convert/convertManifest.tssvelte.config.js
⏰ 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). (2)
- GitHub Check: test
- GitHub Check: lint
🔇 Additional comments (3)
svelte.config.js (2)
10-16: LGTM! Clear trailing-slash normalization for service worker scope.The logic correctly handles all cases: appending a slash when BUILD_BASE_PATH is defined but lacks one, preserving it when already present, and defaulting to
'/'when undefined. The comments provide good documentation of the intent.
43-46: LGTM!Using the pre-computed
serviceWorkerScopevariable keeps the config object clean and consistent.convert/convertManifest.ts (1)
27-34: LGTM! Trailing-slash normalization correctly applied.The
scopePathlogic properly handles all cases and is consistent with theserviceWorkerScopeimplementation insvelte.config.js. The previous variable shadowing issue has been addressed.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Based on ChatGPT feedback: https://chatgpt.com/share/696a8487-ece8-8006-a032-9a4d0230719e
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.