-
-
Notifications
You must be signed in to change notification settings - Fork 36
feat: new hook context #181
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
WalkthroughThe changes introduce a Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Config
participant Build
User->>Config: prepare(data, context)
Config-->>Build: context with config
Build-->>Config: complete(data, context)
Assessment against linked issues
Poem
Warning Review ran into problemsProblems (1)
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 as PR comments)
Additionally, you can add CodeRabbit Configration 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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- docs/reference/config.md (1 hunks)
- src/build.ts (2 hunks)
- src/types.ts (2 hunks)
Additional comments not posted (8)
docs/reference/config.md (3)
272-272
: Correctly updatedprepare
hook type.The type definition for the
prepare
hook has been correctly updated to include thecontext
parameter.
276-291
: Clear and comprehensive example forprepare
hook.The example usage of the
prepare
hook is clear and demonstrates how to modify data and access the context.
295-295
: Correctly updatedcomplete
hook type.The type definition for the
complete
hook has been correctly updated to include thecontext
parameter.src/types.ts (2)
201-209
: Correctly addedContext
type.The
Context
type has been correctly defined to include theconfig
property.
265-272
: Correctly updatedprepare
andcomplete
functions inUserConfig
interface.The type definitions for the
prepare
andcomplete
functions have been correctly updated to include thecontext
parameter.src/build.ts (3)
137-138
: Correctly createdcontext
object.The
context
object has been correctly created with theconfig
property.
143-143
: Correctly updatedprepare
function call.The
prepare
function call has been correctly updated to include thecontext
parameter.
160-160
: Correctly updatedcomplete
function call.The
complete
function call has been correctly updated to include thecontext
parameter.
prepare
(data: Result<Collections>, context: Context) => Promisable<void | false>
Data prepare hook, executed before write to file. You can apply additional processing to the output data, such as modify them, add missing data, handle relationships, or write them to files. return false to prevent the default output to a file if you wanted.
complete
(data: Result<Collections>, context: Context) => Promisable<void>
Build success hook, executed after the build is complete. You can do anything after the build is complete, such as print some tips or deploy the output files.
close: #161
Summary by CodeRabbit
Documentation
context
parameter forprepare
andcomplete
functions.New Features
context
parameter to theprepare
andcomplete
functions, allowing more context-aware operations within the build process.Refactor
context
parameter for enhanced configurability and functionality.