-
Notifications
You must be signed in to change notification settings - Fork 2
fix: support alauda-ru preset #67
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
🦋 Changeset detectedLatest commit: c6eed21 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis change introduces support for a new Algolia preset, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant getCommonConfig
participant AlgoliaOptions
User->>getCommonConfig: Call with algolia = 'alauda-ru'
getCommonConfig->>AlgoliaOptions: Select ALAUDA_RU_ALGOLIA_OPTIONS
getCommonConfig-->>User: Return config with alauda-ru Algolia options
Possibly related PRs
Suggested labels
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 (
|
Signed-off-by: JounQin <admin@1stg.me>
commit: |
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.
Pull Request Overview
This PR adds support for an “alauda-ru” Algolia preset in the CLI configuration.
- Introduce a new
ALAUDA_RU_ALGOLIA_OPTIONSconstant with appId, apiKey, and indexName - Extend the
algoliaoption type to include'alauda-ru' - Update the option selection logic to handle the new preset
Comments suppressed due to low confidence (2)
src/cli/load-config.ts:107
- New 'alauda-ru' preset lacks corresponding tests to verify it’s applied correctly. Add unit or integration tests covering this configuration path.
const ALAUDA_RU_ALGOLIA_OPTIONS: AlgoliaOptions = {
src/cli/load-config.ts:147
- The new 'alauda-ru' value isn’t reflected in CLI help or README. Update the documentation to include this preset option.
algolia?: boolean | 'alauda' | 'alauda-ru'
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
♻️ Duplicate comments (1)
src/cli/load-config.ts (1)
107-111:⚠️ Potential issueHardcoded API credentials present a security risk.
The new
ALAUDA_RU_ALGOLIA_OPTIONSconfiguration contains hardcoded API credentials, similar to the existing configuration. This exposes sensitive credentials in the codebase.Consider sourcing these values from environment variables or a secure configuration system:
-const ALAUDA_RU_ALGOLIA_OPTIONS: AlgoliaOptions = { - appId: 'GBNIJIGQ50', - apiKey: '786fa6da36fe76777d688387c0520c5b', - indexName: 'docs_alauda_io_gbnijigq50_pages', -} +const ALAUDA_RU_ALGOLIA_OPTIONS: AlgoliaOptions = { + appId: process.env.ALAUDA_RU_ALGOLIA_APP_ID || 'GBNIJIGQ50', + apiKey: process.env.ALAUDA_RU_ALGOLIA_API_KEY || '786fa6da36fe76777d688387c0520c5b', + indexName: process.env.ALAUDA_RU_ALGOLIA_INDEX_NAME || 'docs_alauda_io_gbnijigq50_pages', +}
🧹 Nitpick comments (1)
src/cli/load-config.ts (1)
226-228: Verify logical operator precedence in algoliaOptions assignment.The conditional logic appears correct, but the operator precedence could be clearer. The
&&operator has higher precedence than||, which may affect readability.Consider using explicit parentheses or restructuring for better clarity:
-const algoliaOptions = - ((algolia && config.algolia) ?? - (algolia === 'alauda' - ? ALAUDA_ALGOLIA_OPTIONS - : algolia === 'alauda-ru' && ALAUDA_RU_ALGOLIA_OPTIONS)) || - null +const algoliaOptions = + (algolia && config.algolia) ?? + (algolia === 'alauda' + ? ALAUDA_ALGOLIA_OPTIONS + : algolia === 'alauda-ru' + ? ALAUDA_RU_ALGOLIA_OPTIONS + : null) || + null
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.changeset/slow-moles-relax.md(1 hunks)src/cli/load-config.ts(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/cli/load-config.ts (1)
src/types.ts (1)
AlgoliaOptions(46-50)
🔇 Additional comments (2)
src/cli/load-config.ts (1)
147-147: LGTM - Type extension is correct.The algolia parameter type correctly extends to include the new 'alauda-ru' preset option.
.changeset/slow-moles-relax.md (1)
1-6: LGTM - Changeset correctly documents the change.The changeset properly specifies a patch update for
@alauda/doomwith an appropriate commit message that matches the PR objective.
Summary by CodeRabbit
New Features
alauda-rupreset in Algolia configuration options.Chores