-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(content-utils): Add support for new CC config file #198
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe changes introduce a new patch for the @inox-tools/content-utils package by adding support for a dedicated content collections configuration file. Additionally, the configuration resolution logic has been updated. The possible configuration filenames now include additional entries, and the approach used in resolveContentPaths has been modified to utilize a new validConfigPaths array with baseResolver. A fallback mechanism now returns the first valid config if none of the candidates are found. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Caller
participant Resolver as Resolver
participant FileSystem as FileSystem
Caller->>Resolver: Call resolveContentPaths()
Resolver->>Resolver: Generate validConfigPaths from possibleConfigs using baseResolver
Resolver->>FileSystem: Check existence of each candidate config file
FileSystem-->>Resolver: Return existence status
alt Config Found
Resolver->>Caller: Return found config file
else No Config Found
Resolver->>Caller: Return first candidate as fallback
end
Poem
✨ Finishing Touches
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 (
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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: 0
🧹 Nitpick comments (1)
packages/content-utils/src/internal/resolver.ts (1)
35-37
: Consider adding a comment to explain the fallback behavior.The logic is correct, but it would be helpful to add a comment explaining why we fallback to the first valid path when no config exists.
const existingConfig = validConfigPaths.find((configPath) => existsSync(configPath)); +// Fallback to the first valid path (content.config.ts) when no config exists +// This ensures consistent behavior and enables type checking in IDEs const configFile = existingConfig ?? validConfigPaths[0];
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.changeset/popular-terms-pump.md
(1 hunks)packages/content-utils/src/internal/resolver.ts
(2 hunks)
🔇 Additional comments (3)
packages/content-utils/src/internal/resolver.ts (2)
7-16
: LGTM! Well-structured configuration paths.The expanded configuration paths follow a consistent pattern and prioritize root-level content config files. The changes align well with the PR objectives.
31-33
: LGTM! Proper path resolution.Using baseResolver ensures all paths are correctly resolved relative to the source directory.
.changeset/popular-terms-pump.md (1)
1-6
: LGTM! Clear and appropriate changeset.The patch version bump and description accurately reflect the changes made.
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.
LGTM!!!
Summary by CodeRabbit