Config Options
This page lists and describes all of the config’s options. No option is required.
framework
Which front-end framework to generate the components for.
Type: Any value of the Framework
enum or any string.
Default: greatly depends on your project structure.
typescript
Whether to generate Typescript files and code.
Type: boolean.
Default: true
if the CLI manages to find a tsconfig.json
file, false
otherwise.
typescriptOptions
Typescript-related options. Relevant only when Typescript is used.
typescriptOptions.propDeclaration
Whether to declare a component’s props as an interface
, as a type
or not at all (null
).
Type: "interface"
, "type"
or null
.
Default: interface
if the Typescript is used (by automatic detection or explicitly), false
otherwise.
styling
Which styling solution to generate.
Type: Any value of the Styling
enum, any string, or undefined
.
Default: undefined
.
styleFileOptions
Options related to the generated style file. Relevant only when such a file is to be generated (in terms of built-in styling solutions,
this means one of Styling.CSS
, Styling.SCSS
, Styling.STYLED_COMPONENTS
).
styleFileOptions.extension
Which extension to give the generated style file, if one is generated.
In most cases, this field is determined automatically by Agrippa, and there’s no need to set it.
Type: string
.
Default: depends on styling
’s value.
styleFileOptions.module
Whether to generate CSS/SCSS files as modules or not. Relevant only for projects using CSS and SCSS.
Type: boolean
.
Default: true
.
componentOptions
Component declaration file options.
componentOptions.exportType
Whether to export the component as a named export or a default export. For more information about exports, consult the MDN docs.
Type: named
or default
.
Default: named
.
componentOptions.declaration
Whether to declare the component as a const
with an arrow function, or as a function
declaration.
// with declaration="const"
const Component = (props) => {
// ...
}
// with declaration="function"
function Component(props) {
// ...
}
Type: const
or function
.
Default: const
.
reactOptions
React-related options. Only relevant when using React or React Native.
reactOptions.importReact
Whether to import React at the top of the component.
This should be set to true
for older React versions, which don’t use the new JSX transform.
Type: boolean
.
Default: false
.
baseDir
Path to a base directory under which all components should be generated (not necessarily as direct children).
Roughly equivalent to Typescript’s rootDir
in that sense.
Type: string
(a path).
Default: the current working directory.
allowOutsideBase
By default, Agrippa does not allow components to be generated outside baseDir
(if it’s set, of course). allowOutsideBase
overrides this behvaior.
Type: boolean
.
Default: false
.
overwrite
By default, Agrippa prevents the generation of a component over an existing components, to prevent a loss of code. --overwrite
tells Agrippa to replace existing files, if any are found.
Type: boolean
.
Default: false
.
lookForUpdates
When Agrippa is run, it pings the NPM registry and checks whether a newer version exists.
If it finds one, a message is printed to the user. Setting this option to false
disables this behaviour.
We recommend having this turned on.
Type: boolean
.
Default: true
.
reportTelemetry
When Agrippa is run, it sends anonymous telemetry to Agrippa’s statistics service.
Setting this option to false
disables this behaviour.
Privacy is an important matter to me personally, and so I’m urged to emphasize that Agrippa only sends basic information about how you use it, completely anonymously. The purpose of this is to allow us to gain basic insights of how people use Agrippa.
You can find the relevant source code in TelemetryPlugin.ts
.
Type: boolean
.
Default: false
.
debug
The debug flag makes Agrippa print out additional debug information. It’s very useful when debugging.
It can, and most often will, be passed as a CLI flag instead of being set in the config.
Type: boolean
.
Default: false
.