hooks.json
Configuration for your project.
The hooks.json file holds configuration for your project.
We use it to understand how your project is set up and how to generate components customized for your project.
Note: The hooks.json file is optional and only required if you're using
the CLI to add components to your project. If you're using the copy and
paste method, you don't need this file.
You can create a hooks.json file in your project by running the following command:
npx scriptkavi-hooks@latest initSee the CLI section for more information.
$schema
You can see the JSON Schema for hooks.json here.
{
"$schema": "https://hooks.scriptkavi.com/schema.json"
}codestyle
The coding style for your hooks. This defines whether your hooks are react based or pure javascript. This cannot be changed after initialization.
{
"codestyle": "react-hook"
}tsx
Choose between TypeScript or JavaScript hooks.
Setting this option to false allows hooks to be added as JavaScript with the .js file extension.
{
"tsx": `true` | `false`
}aliases
The CLI uses these values and the paths config from your tsconfig.json or jsconfig.json file to place generated hooks in the correct location.
Path aliases have to be set up in your tsconfig.json or jsconfig.json file.
Important: If you're using the src directory, make sure it is included
under paths in your tsconfig.json or jsconfig.json file.
aliases.utils
Import alias for your utility functions.
{
"aliases": {
"utils": "@/lib/utils"
}
}aliases.hooks
Import alias for your hooks.
{
"aliases": {
"hooks": "@/hooks"
}
}