-
-
Couldn't load subscription status.
- Fork 126
feat(cli): allow to include/exclude plugins when generate #1676
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
WalkthroughWalkthroughThe changes enhance the CLI tool's plugin management capabilities by introducing two new options for specifying which plugins to include or exclude during execution. This allows users to have more control over the plugin execution process, improving the overall flexibility of the code generation workflow. Changes
Assessment against linked issues
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
Outside diff range, codebase verification and nitpick comments (1)
packages/schema/src/cli/plugin-runner.ts (1)
Line range hint
345-401: Method logic approved with a suggestion for improvement.The changes to the
runPluginmethod correctly handle the newwithPluginsandwithoutPluginsoptions. The method checks if the specified plugins are enabled and skips them if not, which is a good practice for managing plugin execution.Static Analysis Hint:
Consider using optional chaining to simplify the checks forwithPluginsandwithoutPlugins.- if (runnerOptions.withPlugins && !runnerOptions.withPlugins.includes(name)) { + if (!runnerOptions.withPlugins?.includes(name)) { - if (runnerOptions.withoutPlugins && runnerOptions.withoutPlugins.includes(name)) { + if (runnerOptions.withoutPlugins?.includes(name)) {Tools
Biome
[error] 357-358: void is confusing inside a union type.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- packages/schema/src/cli/actions/generate.ts (3 hunks)
- packages/schema/src/cli/index.ts (1 hunks)
- packages/schema/src/cli/plugin-runner.ts (7 hunks)
Additional context used
Biome
packages/schema/src/cli/plugin-runner.ts
[error] 396-397: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
Additional comments not posted (3)
packages/schema/src/cli/actions/generate.ts (1)
22-23: Type alteration approved.The addition of
withPluginsandwithoutPluginsto theOptionstype is correctly implemented and aligns with the PR objectives to allow users to specify plugins to include or exclude during execution.packages/schema/src/cli/index.ts (1)
123-124: Command-line options approved.The addition of
--with-pluginsand--without-pluginscommand-line options to thegeneratecommand is correctly implemented. These options enhance user control over the plugin execution process, aligning with the PR objectives.packages/schema/src/cli/plugin-runner.ts (1)
43-44: Type alteration approved.The addition of
withPluginsandwithoutPluginsto thePluginRunnerOptionstype is correctly implemented and aligns with the PR objectives to allow users to specify plugins to include or exclude during runtime.
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 selected for processing (1)
- packages/schema/src/cli/plugin-runner.ts (7 hunks)
Additional context used
Biome
packages/schema/src/cli/plugin-runner.ts
[error] 395-396: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
Additional comments not posted (5)
packages/schema/src/cli/plugin-runner.ts (5)
43-44: Approved: New properties for plugin control.The addition of
withPluginsandwithoutPluginstoPluginRunnerOptionsenhances user control over plugin execution, aligning with the PR objectives.
142-151: Approved: Enhanced plugin execution differentiation.The addition of the
isCorePluginparameter to therunPluginmethod allows for differentiated handling of core versus user plugins, which is a significant enhancement for managing plugin execution.Also applies to: 177-186
205-205: Approved: Optimized inclusion of Prisma core plugin.The refined condition for adding the Prisma core plugin ensures it is only included when necessary, optimizing resource usage and aligning with the PR objectives.
239-240: Approved: Conditional enabling of Zod core plugin.The logic to conditionally enable the Zod core plugin based on the presence of the Enhancer plugin and validation rules ensures efficient use of resources and aligns with the PR objectives.
347-350: Approved: Efficient plugin skipping logic.The implementation in the
runPluginmethod to skip plugins that are not enabled, while logging a warning, is a crucial enhancement that supports the new feature of excluding specific plugins.
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.
Fixes #1654