-
-
Notifications
You must be signed in to change notification settings - Fork 367
Fix: Adjust stub file paths for accurate resolution during rolldown build #2217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe update revises the stub file generation logic in the Changes
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Size ReportBundles
Usages
|
There was a problem hiding this 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
📒 Files selected for processing (1)
scripts/rolldown.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: E2E test for rolldown build (ubuntu-latest, 20)
- GitHub Check: E2E test for rolldown build (macos-latest, 20)
- GitHub Check: E2E test for rolldown build (macos-latest, 22)
- GitHub Check: E2E test for rolldown build (windows-latest, 20)
- GitHub Check: E2E test for rolldown build (ubuntu-latest, 22)
- GitHub Check: release
- GitHub Check: upload
- GitHub Check: Build (ubuntu-latest, 20)
- GitHub Check: Build (macos-latest, 20)
- GitHub Check: Build (windows-latest, 20)
🔇 Additional comments (1)
scripts/rolldown.ts (1)
326-327
: LGTM! Stub lookup logic correctly fixed.The change correctly addresses the core issue by extracting the base filename and using the proper key format (
dist/${filename}
) to match the stubs object structure created byresolveStubs()
.
const fullpath = path.join( | ||
'packages', | ||
target, | ||
'dist', | ||
path.basename(stub) | ||
) | ||
await fs.writeFile(fullpath, contents) | ||
console.log(`created stub ${pc.bold(fullpath)}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider using absolute path resolution for better reliability.
The path construction uses relative paths which could fail if the script is executed from a different working directory. Since packagesDir
is already defined (line 18), consider using it for more robust path resolution.
- const fullpath = path.join(
- 'packages',
- target,
- 'dist',
- path.basename(stub)
- )
+ const fullpath = path.join(
+ packagesDir,
+ target,
+ 'dist',
+ path.basename(stub)
+ )
This ensures the stub files are written to the correct location regardless of the current working directory.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const fullpath = path.join( | |
'packages', | |
target, | |
'dist', | |
path.basename(stub) | |
) | |
await fs.writeFile(fullpath, contents) | |
console.log(`created stub ${pc.bold(fullpath)}`) | |
const fullpath = path.join( | |
packagesDir, | |
target, | |
'dist', | |
path.basename(stub) | |
) | |
await fs.writeFile(fullpath, contents) | |
console.log(`created stub ${pc.bold(fullpath)}`) |
🤖 Prompt for AI Agents
In scripts/rolldown.ts around lines 334 to 341, the code constructs file paths
using relative paths which may cause issues if the script runs from different
working directories. To fix this, replace the relative path construction with an
absolute path by using the already defined packagesDir variable (from line 18)
as the base directory. Join packagesDir with target, 'dist', and the stub
basename to form the fullpath, ensuring the stub files are always written to the
correct location regardless of the current working directory.
@intlify/core
@intlify/core-base
@intlify/devtools-types
@intlify/message-compiler
petite-vue-i18n
@intlify/shared
vue-i18n
@intlify/vue-i18n-core
commit: |
Thank you! |
Fixed a bug that caused stub generation to not work properly.
Summary by CodeRabbit