-
Notifications
You must be signed in to change notification settings - Fork 173
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: add profile on types npm package #274
Conversation
WalkthroughThis update bumps the package version from 0.0.22 to 0.0.23 and introduces a new "profile" feature. A new entry for the profile schema is added to the generation logic, allowing the system to generate types and Zod schemas for profiles. Corresponding updates include a new TypeScript interface ( Changes
Sequence Diagram(s)sequenceDiagram
participant User as Code Generator
participant Gen as generateTypeAndZod
participant Types as Type Definitions
participant Zod as Zod Schema
User->>Gen: Trigger type and schema generation
Gen->>Types: Look up schema entries (including "profile")
Gen->>Zod: Generate Zod schema for "profile"
Zod-->>Gen: Return ProfileSchema
Gen-->>User: Output generated types and schema including profile definitions
Poem
Tip 🌐 Web search-backed reviews and chat
✨ Finishing Touches
🪧 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: 2
🧹 Nitpick comments (1)
_packages/types/src/zods/Profile.ts (1)
18-22
: Use regex literal and improve color validation.Replace RegExp constructor with a regex literal for better readability and static analysis.
color: z .string() - .regex(new RegExp("^#([a-fA-F0-9]{6})$")) + .regex(/^#[a-fA-F0-9]{6}$/) .describe("RGB color") .optional(),🧰 Tools
🪛 Biome (1.9.4)
[error] 20-20: Use a regular expression literal instead of the RegExp constructor.
Regular expression literals avoid some escaping required in a string literal, and are easier to analyze statically.
Safe fix: Use a literal notation instead.(lint/complexity/useRegexLiterals)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
_packages/types/package.json
(1 hunks)_packages/types/src/generate.ts
(1 hunks)_packages/types/src/types/Profile.ts
(1 hunks)_packages/types/src/types/index.ts
(1 hunks)_packages/types/src/zods/Profile.ts
(1 hunks)_packages/types/src/zods/index.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- _packages/types/src/zods/index.ts
- _packages/types/package.json
🧰 Additional context used
🪛 Biome (1.9.4)
_packages/types/src/zods/Profile.ts
[error] 20-20: Use a regular expression literal instead of the RegExp constructor.
Regular expression literals avoid some escaping required in a string literal, and are easier to analyze statically.
Safe fix: Use a literal notation instead.
(lint/complexity/useRegexLiterals)
[error] 38-38: Use a regular expression literal instead of the RegExp constructor.
Regular expression literals avoid some escaping required in a string literal, and are easier to analyze statically.
Safe fix: Use a literal notation instead.
(lint/complexity/useRegexLiterals)
[error] 42-42: Use a regular expression literal instead of the RegExp constructor.
Regular expression literals avoid some escaping required in a string literal, and are easier to analyze statically.
Safe fix: Use a literal notation instead.
(lint/complexity/useRegexLiterals)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages: registry-initiation-1
🔇 Additional comments (4)
_packages/types/src/types/index.ts (1)
4-4
: LGTM!The export follows the established pattern and correctly exposes the new Profile module.
_packages/types/src/types/Profile.ts (2)
19-20
: Add length validation for summary field.The comment indicates the summary should be "less than 50 characters", but there's no validation enforcing this constraint.
Would you like me to help implement the length validation in the schema?
34-38
: Update Twitter URL validation for X rebranding.The social.twitter field should potentially accept both
twitter.com
andx.com
URLs to account for Twitter's rebranding to X.Would you like me to help update the URL validation pattern?
_packages/types/src/generate.ts (1)
10-10
: LGTM!The additions to
schemata
andschemaTitle
follow the established pattern and correctly integrate the new Profile schema.Also applies to: 17-17
@initia/initia-registry-types
npm packageSummary by CodeRabbit