-
Notifications
You must be signed in to change notification settings - Fork 19
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
fix: fix path resolve warning #258
The head ref may contain hidden characters: "256-bug-\u5728-vitevue3-\u9879\u76EE\u4E2D\u4F7F\u7528\u62A5\u9519"
Conversation
WalkthroughThis pull request introduces a series of patches across multiple modules within the Changes
Possibly related PRs
Poem
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: 6
🧹 Outside diff range and nitpick comments (6)
tsconfig.json (1)
26-27
: LGTM! Consider documenting the resolution order.The addition of "packages/*/dist" to the path resolution for
@wangeditor-next/*
modules is a good improvement. It allows TypeScript to resolve modules from bothsrc
anddist
directories, which is beneficial for development and testing of built packages.Consider adding a comment in the
tsconfig.json
file to explain the resolution order (src before dist) to prevent potential confusion for other developers.Example:
"paths": { "@wangeditor-next/*": [ "packages/*/src", // Prioritize source files for development "packages/*/dist" // Fall back to built files if needed ] }packages/list-module/package.json (1)
Line range hint
51-56
: Consider using version ranges for peerDependencies.The current
peerDependencies
section uses exact version numbers, which might be too restrictive and could lead to compatibility issues as the project evolves. Consider using version ranges (e.g., "^1.7.10" instead of "1.7.10") to allow for minor updates and patches.Here's a suggested change:
"peerDependencies": { - "@wangeditor-next/core": "1.7.10", + "@wangeditor-next/core": "^1.7.10", "dom7": "^3.0.0", - "slate": "^0.72.0", + "slate": "^0.72.0", "snabbdom": "^3.1.0" }This change allows for more flexibility in dependency management while still ensuring compatibility.
packages/upload-image-module/package.json (1)
Line range hint
52-59
: Consider using version ranges for peer dependenciesThe
peerDependencies
section currently specifies exact versions for dependencies. It's generally recommended to use version ranges (e.g.,^2.0.3
instead of2.0.3
) for peer dependencies to allow for more flexibility and easier updates.Here's a suggested change:
"peerDependencies": { - "@uppy/core": "^2.0.3", - "@uppy/xhr-upload": "^2.0.3", - "@wangeditor-next/basic-modules": "1.5.9", - "@wangeditor-next/core": "1.7.10", - "dom7": "^3.0.0", - "lodash.foreach": "^4.5.0", - "slate": "^0.72.0", - "snabbdom": "^3.1.0" + "@uppy/core": "^2.0.3", + "@uppy/xhr-upload": "^2.0.3", + "@wangeditor-next/basic-modules": "^1.5.9", + "@wangeditor-next/core": "^1.7.10", + "dom7": "^3.0.0", + "lodash.foreach": "^4.5.0", + "slate": "^0.72.0", + "snabbdom": "^3.1.0" }This change allows for minor updates and patches, which can include bug fixes and non-breaking changes, without requiring updates to this package.json file.
packages/yjs/package.json (1)
Line range hint
1-70
: Consider updating package version and reviewing peerDependencies.While the change is minor, it does affect the package's exports. Consider if this warrants a version bump (e.g., patch version update).
Also, please review the peerDependencies, especially the @wangeditor-next/core version, to ensure it's still compatible with this change.
packages/editor/package.json (2)
Line range hint
15-15
: Consider simplifying thetypes
field pathThe
types
field currently points to "dist/editor/src/index.d.ts". This path seems unusually nested. Typically, the types declaration file would be located directly in thedist
folder.Consider simplifying this to "dist/index.d.ts" if possible, ensuring it matches the actual location of your TypeScript declaration file:
- "types": "dist/editor/src/index.d.ts", + "types": "dist/index.d.ts",Please verify that this change doesn't break type declarations for consumers of your package.
22-22
: Remove unnecessary blank line inexports
fieldThere's an empty line within the
exports
object. While this doesn't affect functionality, removing it would improve the JSON structure's cleanliness.Consider removing this blank line:
"exports": { ".": { "types": "./dist/editor/src/index.d.ts", - "import": "./dist/index.mjs", "require": "./dist/index.js" }, "./dist/css/style.css": "./dist/css/style.css" },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (12)
- .changeset/brown-pots-remain.md (1 hunks)
- packages/basic-modules/package.json (1 hunks)
- packages/code-highlight/package.json (1 hunks)
- packages/core/package.json (1 hunks)
- packages/editor/package.json (1 hunks)
- packages/list-module/package.json (1 hunks)
- packages/table-module/package.json (1 hunks)
- packages/upload-image-module/package.json (1 hunks)
- packages/video-module/package.json (1 hunks)
- packages/yjs-for-react/package.json (1 hunks)
- packages/yjs/package.json (1 hunks)
- tsconfig.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
- .changeset/brown-pots-remain.md
🧰 Additional context used
🔇 Additional comments (10)
packages/video-module/package.json (2)
15-19
: Excellent addition of CSS export!The new export entry for the CSS file is a great improvement. It allows users to directly import the styles associated with the video module, which is in line with modern JavaScript module practices. This change enhances the usability of the package and provides a cleaner way for consumers to include necessary styles.
Line range hint
2-2
: Consider version bump and verify peerDependencies
Given the addition of the new CSS export, it might be appropriate to bump the version number. Please consider if this change warrants a version update according to your versioning strategy.
Verify if the peerDependency on
@wangeditor-next/core
(currently at "1.7.10") needs to be updated. Ensure it's compatible with any recent changes in the core package that might be related to this PR.To help verify the
@wangeditor-next/core
version, you can run the following script:Also applies to: 54-54
packages/code-highlight/package.json (3)
15-15
: LGTM: Improved readabilityThe addition of this empty line enhances the readability of the
exports
object by separating thetypes
field from theimport
andrequire
fields.
18-18
: LGTM: Enhanced structureThe addition of this empty line improves the structure of the
exports
object by clearly separating the main export from the new CSS export.
15-19
: Summary: Improved package exports and readabilityThese changes enhance the
@wangeditor-next/code-highlight
package in two ways:
- Improved readability: The addition of empty lines (15, 18) improves the structure and readability of the
exports
object.- Enhanced functionality: The new CSS export (line 19) allows direct importing of styles, which significantly improves the package's usability.
These updates align the package with modern JavaScript practices and should make it easier for developers to use the code highlighting feature, including its styles.
packages/upload-image-module/package.json (1)
Line range hint
1-59
: Summary of reviewThe changes to this
package.json
file are appropriate and align with the PR objectives. The addition of the CSS export is a positive change that should resolve path resolve warnings and improve module usage.A minor suggestion was made regarding the use of version ranges for peer dependencies, but this is not directly related to the main PR objective and can be addressed in a future update if desired.
Overall, the changes look good and can be approved.
packages/basic-modules/package.json (1)
Line range hint
1-67
: Consider addressing potential inconsistencies in package.json.While reviewing the entire file, I noticed a few points that might need attention:
The
types
field (line 9) points todist/basic-modules/src/index.d.ts
. This path seems unusual as it includes bothdist
andsrc
. Typically, declaration files are in thedist
folder only.In the
exports
field, thetypes
entry (line 15) differs from the maintypes
field. It points to./dist/packages/basic-modules/src/index.d.ts
, which has an extrapackages
in the path.Given that this change adds a new export, consider if the package version (currently 1.5.9) needs to be updated.
Consider applying these changes:
- "types": "dist/basic-modules/src/index.d.ts", + "types": "dist/index.d.ts", "exports": { ".": { - "types": "./dist/packages/basic-modules/src/index.d.ts", + "types": "./dist/index.d.ts",Also, please review if the version number needs to be updated.
Let's verify the correct location of the type declaration file:
#!/bin/bash # Check for the existence of type declaration files echo "Searching for index.d.ts files in the dist directory:" find packages/basic-modules/dist -name "index.d.ts" echo "Checking the content of the found index.d.ts files:" find packages/basic-modules/dist -name "index.d.ts" -exec echo {} \; -exec head -n 5 {} \;packages/yjs/package.json (1)
26-26
: LGTM! Good addition for CSS export.The new export for the CSS file is a positive change. It allows for direct imports of styles, which is a good practice for modular CSS management and aligns with the PR objective of fixing path resolve warnings.
To ensure the CSS file exists, please run the following script:
✅ Verification successful
CSS File Verified Successfully
The CSS file exists at the specified path, confirming that the new export in
package.json
is correctly implemented and aligns with the PR objectives.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of the CSS file # Test: Check if the CSS file exists if fd -p "packages/yjs/dist/css/style.css"; then echo "CSS file exists." else echo "Warning: CSS file not found at the specified path." fiLength of output: 82
packages/core/package.json (1)
19-19
: LGTM! This change enhances package functionality.The addition of the CSS file export is a good improvement. It allows users to directly import the styles, which aligns with modern JavaScript module systems and improves the overall developer experience.
This change also addresses the path resolve warning mentioned in the PR objectives, contributing to the stability of the package.
packages/editor/package.json (1)
26-26
: LGTM: CSS export added correctlyThe new export
"./dist/css/style.css": "./dist/css/style.css"
has been added correctly to theexports
field. This change allows users to import the CSS file directly, which aligns with the PR objective of fixing path resolve warnings.This addition enhances the module's usability by providing a clear way to import the associated styles. It's a good practice for packages that include CSS alongside JavaScript.
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
} | ||
}, | ||
"./dist/css/style.css": "./dist/css/style.css" |
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.
💡 Codebase verification
dist
directory not found
The CSS file ./dist/css/style.css
does not exist at the specified path packages/list-module/dist/css/style.css
. Additionally, the dist
directory is missing.
Please verify that the build process correctly generates the dist
directory and the necessary CSS files.
🔗 Analysis chain
LGTM: CSS file export added correctly.
The addition of "./dist/css/style.css": "./dist/css/style.css"
to the exports
field is correct and aligns with the PR objective of fixing path resolve warnings. This change allows direct imports of the CSS file, which can improve the module's usability.
To ensure the CSS file exists and the path is correct, please run the following script:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the existence of the CSS file and its correct location
# Test: Check if the CSS file exists
if [ -f "packages/list-module/dist/css/style.css" ]; then
echo "CSS file exists at the specified path."
else
echo "Warning: CSS file not found at packages/list-module/dist/css/style.css"
fi
# Test: Check if there are any other CSS files in the dist directory that should be exported
css_files=$(find packages/list-module/dist -name "*.css")
if [ "$(echo "$css_files" | wc -l)" -gt 1 ]; then
echo "Note: Multiple CSS files found in dist directory. Ensure all necessary files are exported:"
echo "$css_files"
fi
Length of output: 363
|
||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
} | ||
}, | ||
"./dist/css/style.css": "./dist/css/style.css" |
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.
💡 Codebase verification
Issue: CSS file does not exist at the specified path.
The verification script indicates that packages/table-module/dist/css/style.css
is missing. Please ensure that the CSS file is generated and correctly placed at this location before adding the export to package.json
.
🔗 Analysis chain
Approve the addition of CSS export with verification.
The addition of the CSS export "./dist/css/style.css": "./dist/css/style.css"
is a positive change that allows users to import the module's styles directly. This aligns with modern JavaScript module practices and can improve the ease of use of the module.
Please run the following script to verify the existence of the CSS file:
Consider updating the module's documentation to reflect this new export option, providing examples of how users can import and use the CSS file.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the existence of the CSS file and its contents
# Test: Check if the CSS file exists
if [ -f "packages/table-module/dist/css/style.css" ]; then
echo "CSS file exists."
# Display the first few lines of the CSS file
head -n 5 "packages/table-module/dist/css/style.css"
else
echo "Error: CSS file does not exist at the specified path."
fi
Length of output: 170
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
} | ||
}, | ||
"./dist/css/style.css": "./dist/css/style.css" |
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.
💡 Codebase verification
Issue Detected: CSS File Not Generated for code-highlight
The dist/css/style.css
file for the code-highlight
package is not being generated because the Rollup configuration does not include CSS processing steps.
Recommended Actions:
- Update
packages/code-highlight/rollup.config.js
to include thepostcss
plugin. This should align it with the shared Rollup configurations that handle CSS processing. - Ensure that the
postcss
configuration correctly extracts the CSS to thedist/css
directory.
🔗 Analysis chain
LGTM: Added CSS export
The addition of the CSS file export is a valuable improvement. It allows users to directly import the styles, enhancing the module's usability and aligning with modern JavaScript practices.
To ensure this change is fully implemented, please verify:
- The CSS file exists at the specified path.
- The build process correctly generates and places the CSS file in the
dist
folder.
You can use the following script to check the file's existence:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if the CSS file exists in the expected location
if [ -f "packages/code-highlight/dist/css/style.css" ]; then
echo "CSS file exists at the expected location."
else
echo "CSS file not found at the expected location."
fi
Length of output: 154
Script:
#!/bin/bash
# Search for all CSS source files in the repository
fd --extension css --type f
Length of output: 177
Script:
#!/bin/bash
# Inspect build scripts for CSS processing steps
rg --ignore-case "css" scripts/
Length of output: 80
Script:
#!/bin/bash
# Search for CSS processing steps in package.json scripts
jq '.scripts | to_entries[] | select(.value | test("css"; "i"))' package.json
Length of output: 79
Script:
#!/bin/bash
# Search for CSS-related dependencies in package.json
jq '.dependencies, .devDependencies | to_entries[] | select(.key | test("css"; "i"))' package.json
Length of output: 247
Script:
#!/bin/bash
# Locate all Rollup configuration files in the repository
fd --extension js --type f -e config.js -e rollup.config.js
Length of output: 769
Script:
#!/bin/bash
# Search for references to 'code-highlight' or CSS processing in Rollup configuration files
fd --extension js --type f -e config.js -e rollup.config.js | xargs rg --ignore-case "code-highlight|postcss|css"
Length of output: 853
Script:
#!/bin/bash
# Display the contents of packages/code-highlight/rollup.config.js
cat packages/code-highlight/rollup.config.js
Length of output: 551
Script:
#!/bin/bash
# Search for 'postcss' or 'cssnano' in packages/code-highlight/rollup.config.js
rg --ignore-case "postcss|cssnano" packages/code-highlight/rollup.config.js
Length of output: 77
|
||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
} | ||
}, | ||
"./dist/css/style.css": "./dist/css/style.css" |
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.
💡 Codebase verification
CSS export missing in packages/yjs/examples/frontend/package.json
The packages/yjs/examples/frontend/package.json
does not include the "./dist/css/style.css": "./dist/css/style.css"
export. To maintain consistency across the monorepo, please add this export to the exports
section.
🔗 Analysis chain
Approve the addition of CSS export
The addition of "./dist/css/style.css": "./dist/css/style.css"
to the exports
section is a positive change. It allows users to directly import the CSS file, which is a good practice for modular CSS and aligns with the PR objective of fixing path resolve warnings.
Let's verify if this change is consistent across other modules in the monorepo:
This will help ensure consistency across the monorepo and identify if any other modules need similar updates.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if other package.json files in the monorepo have similar CSS exports
# Find all package.json files in the packages directory
fd package.json packages -x sh -c '
if grep -q "\"./dist/css/style.css\": \"./dist/css/style.css\"" {}; then
echo "CSS export found in {}"
else
echo "CSS export missing in {}"
fi
'
Length of output: 813
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
} | ||
}, | ||
"./dist/css/style.css": "./dist/css/style.css" |
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.
💡 Codebase verification
CSS file not found at the specified location.
The packages/yjs-for-react/dist/css/style.css
does not exist. Please ensure that the CSS file is correctly generated or update the export path in package.json
accordingly.
🔗 Analysis chain
LGTM! Consider verifying the CSS file existence.
The addition of the CSS file export is a good practice for modular CSS management and aligns with the PR objective of fixing path resolve warnings. This change allows users to import the CSS file directly.
To ensure the CSS file exists at the specified location, you can run the following command:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify the existence of the CSS file
if [ -f "packages/yjs-for-react/dist/css/style.css" ]; then
echo "CSS file exists at the specified location."
else
echo "Warning: CSS file not found at packages/yjs-for-react/dist/css/style.css"
fi
Length of output: 209
Script:
#!/bin/bash
# Search for any style.css files in the repository
fd "style\.css$" --exec ls -l {}
Length of output: 36
Changes Overview
Implementation Approach
Testing Done
Verification Steps
Additional Notes
Checklist
Related Issues
Summary by CodeRabbit
Bug Fixes
New Features
Chores