-
Notifications
You must be signed in to change notification settings - Fork 0
fix(global): fix cjs default export #26
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 pull request introduces updates across several Changes
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
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
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (7)
packages/commit-analyzer/package.json(2 hunks)packages/configs/package.json(1 hunks)packages/configs/tsup.mjs(2 hunks)packages/git/package.json(2 hunks)packages/github/package.json(2 hunks)packages/mono-pub/package.json(2 hunks)packages/npm/package.json(2 hunks)
🔇 Additional comments (10)
packages/npm/package.json (1)
12-12: LGTM! Changes align with PR objective
The modifications correctly implement the CommonJS default export fix by:
- Adding the fix-tsup-cjs build step
- Including necessary dependencies
- Pinning tsup version for consistency
Also applies to: 37-37, 39-39
packages/commit-analyzer/package.json (2)
12-12: LGTM! Changes are consistent with other packages
The modifications correctly implement the CommonJS default export fix and maintain consistency with other packages in the monorepo.
Also applies to: 37-37, 39-39
Line range hint 1-1: Verify consistency across all package.json files
Let's ensure all packages have consistent configurations.
✅ Verification successful
All packages have consistent tsup configuration
Based on the verification results:
- All packages use the same tsup version (8.3.5)
- All packages (except configs) have the same build script "tsup && fix-tsup-cjs"
- The fix-tsup-cjs package is not found in devDependencies, but this is expected as it's likely defined in the root package.json
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check consistency of tsup and fix-tsup-cjs across all packages
echo "Checking package.json files..."
# Find all package.json files
fd package.json packages/ --type f --exec sh -c '
echo "\nChecking: {}"
echo "tsup version:"
jq -r ".devDependencies.tsup // empty" {}
echo "fix-tsup-cjs version:"
jq -r ".devDependencies.fix-tsup-cjs // empty" {}
echo "build script:"
jq -r ".scripts.build // empty" {}
'
Length of output: 2599
packages/configs/tsup.mjs (2)
4-4: LGTM: Import of CJS export fix plugin
The addition of the fixCjsExports plugin aligns with the PR objective of fixing CommonJS default exports.
34-37: Verify the impact of disabled minification
The build configuration changes look appropriate for fixing CJS exports, but let's verify the impact of disabled minification.
✅ Verification successful
Let me try a different approach to verify the impact of disabled minification.
Let me try one final verification to understand the build configuration context better.
Disabled minification is appropriate for this build configuration
The disabled minification is intentional and correct for this setup because:
- This is a shared build configuration for Node.js packages (target: 'node16')
- The packages are internal dependencies, not client-side bundles
- Source maps are enabled for better debugging
- The focus is on CommonJS compatibility (cjsInterop and fixCjsExports)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check the size impact of disabled minification
echo "Checking current dist files sizes..."
find . -name "packages/*/dist/*.js" -type f -exec ls -lh {} \;
Length of output: 150
Script:
#!/bin/bash
# Let's check if there are any dist files and their locations first
fd "dist" --type d
# Then check the build configuration and any size-related discussions
rg -i "minif|size|bundle" --type js --type ts
Length of output: 130
Script:
#!/bin/bash
# Check the tsup configuration file content and any related build files
cat packages/configs/tsup.mjs
rg -l "tsup" --type js --type ts --type json
Length of output: 1725
packages/github/package.json (1)
12-12: LGTM: Consistent dependency and build script changes
The changes align with the PR objective:
- Addition of fix-tsup-cjs to the build pipeline
- Consistent dependency versions across packages
Also applies to: 38-38, 40-40
packages/git/package.json (1)
12-12: LGTM: Consistent with other package changes
The modifications mirror those in other packages, maintaining consistency across the monorepo.
Also applies to: 51-51, 54-54
packages/mono-pub/package.json (3)
27-27: LGTM: Build script enhancement for CJS compatibility
The addition of fix-tsup-cjs to the build pipeline aligns with the PR's objective to fix CommonJS default exports.
62-62: Verify the compatibility and stability of the new dependency versions
The changes look good, but let's verify:
- The new
fix-tsup-cjsdependency's stability - Why
tsupwas pinned to exact version8.3.5
Also applies to: 65-65
✅ Verification successful
Dependencies are consistent and stable across the monorepo
The verification shows:
fix-tsup-cjs@^1.2.0is used consistently across all packages in the monorepo[email protected]is pinned to the same version across all packages, which is also the latest version on npm- The pinned version of tsup (8.3.5) only contains a minor bug fix for
experimentalDtsfunctionality
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify dependency versions and their stability
# Check if fix-tsup-cjs is being used consistently across the monorepo
echo "Checking fix-tsup-cjs usage across packages:"
fd -t f "package.json" -x jq -r 'select(.devDependencies["fix-tsup-cjs"]) | "\(.name): \(.devDependencies["fix-tsup-cjs"])"'
# Check if tsup version is consistent across packages
echo -e "\nChecking tsup version consistency:"
fd -t f "package.json" -x jq -r 'select(.devDependencies.tsup) | "\(.name): \(.devDependencies.tsup)"'
# Check the latest versions on npm
echo -e "\nLatest versions from npm:"
curl -s https://registry.npmjs.org/fix-tsup-cjs | jq -r '.["dist-tags"].latest'
curl -s https://registry.npmjs.org/tsup | jq -r '.["dist-tags"].latest'
# Look for any breaking changes or issues in tsup 8.3.5
echo -e "\nChecking for known issues in tsup 8.3.5:"
gh api repos/egoist/tsup/releases | jq -r '.[] | select(.tag_name=="v8.3.5") | .body'
Length of output: 1419
Line range hint 41-54: Verify the exports configuration works with the new CJS fixes
The exports field looks well-structured with proper CJS/ESM/types paths. However, since we're fixing CJS default exports, let's verify the configuration works as expected.
✅ Verification successful
Exports configuration is correctly structured and actively used
The verification shows that:
- CommonJS requires are properly used in bin scripts and documented in README
- ESM imports are extensively used across the codebase, particularly for types
- No import/require errors were found
- The exports field correctly defines:
- Main entry point with CJS/ESM/types
- Utils subpath with corresponding CJS/ESM/types
- Both CJS and ESM patterns are actively used, confirming the dual module support
The exports configuration aligns well with the actual usage patterns in the codebase and supports the CJS fixes being implemented.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the exports configuration and potential usage
# Check for any CommonJS require statements in the codebase
echo "Checking CommonJS require usage:"
rg "require\(['\"]mono-pub['\"]" -A 2
# Check if there are any import/require issues reported
echo -e "\nChecking for potential import/require issues:"
rg -i "cannot|failed to resolve|not found|error.*import|error.*require" -g "*.log"
# Look for any test files that might be using these imports
echo -e "\nChecking test files using these exports:"
fd -e test.js -e test.ts -e spec.js -e spec.ts -x rg -l "mono-pub"
Length of output: 1353
Script:
#!/bin/bash
# Let's verify the actual exports structure and test files usage patterns
# Check the actual directory structure matches exports paths
echo "Checking dist directory structure:"
fd . packages/mono-pub/dist
# Check for import statements in test files
echo -e "\nChecking import patterns in test files:"
rg "from ['\"](mono-pub|\.\.?/.*)(utils)?['\"]" ./packages/git/src/utils/commits.spec.ts ./packages/commit-analyzer/src/utils.spec.ts ./packages/git/src/utils/tags.spec.ts ./packages/commit-analyzer/src/index.spec.ts
# Check package.json main/module fields for compatibility
echo -e "\nChecking package.json fields:"
cat packages/mono-pub/package.json | grep -A 20 '"exports":'
# Look for any ESM imports of mono-pub
echo -e "\nChecking ESM import usage:"
rg "from ['\"](mono-pub|\.\.?/.*)(utils)?['\"]"
Length of output: 5480
packages/configs/package.json
Outdated
| "tsup": "8.3.5", | ||
| "tsup-fix-cjs-exports": "^1.0.3", |
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.
Inconsistent dependency versions and names across packages
There are two concerns with the dependencies:
- Using
tsup-fix-cjs-exportswhile other packages usefix-tsup-cjs - Using version
^1.0.3while other packages use^1.2.0
This inconsistency could lead to compatibility issues.
Consider aligning with other packages by using:
- "tsup-fix-cjs-exports": "^1.0.3",
+ "fix-tsup-cjs": "^1.2.0",📝 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.
| "tsup": "8.3.5", | |
| "tsup-fix-cjs-exports": "^1.0.3", | |
| "tsup": "8.3.5", | |
| "fix-tsup-cjs": "^1.2.0", |
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.
removed redundant dependency from here
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.
@SavelevMatthew, thanks for removing the redundant dependency!
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
Summary by CodeRabbit
New Features
fix-tsup-cjscommand.fix-tsup-cjsto improve CommonJS output handling.Bug Fixes
tsupto fixed versions across several packages to ensure consistency.Documentation