Omlet Docs
Ask or search…
K
Comment on page

CLI configuration for scans

You might need to define a configuration file in your repository:
  • If you have alias setup in your bundler configuration.
  • If your design system library is published as an npm package and is utilized as an external dependency.
To do this, you can create a .omletrc.js file at the root of your repository and define the corresponding properties.
The configuration for the CLI can also be placed in other locations. You can check the Config file documentation for more details.

Mapping aliases in the config

If you have alias set up in a tsconfig file or a bundler such as Webpack, Vite, or Babel, Omlet may have trouble resolving import paths from aliases out of the box. Omlet can resolve them if you define these aliases in the config file.
If you have a tsconfig file already, you can simply point to it using the tsconfigPath field:
.omletrc.js
1
{
2
...
3
"tsconfigPath": "tsconfig.frontend.json"
4
}
If you have alias setup in a bundler, you can define mapping between your aliases and paths in the aliases field:
.omletrc.js
1
{
2
...
3
"aliases": {
4
"@components/*": ["src/components/*"],
5
"@icons": ["src/icons/index.tsx"]
6
}
7
}

Resolving imports from external packages

If your design system library is used in your application repositories as an external package, you can define the exports property to tell the CLI where the entry points of a package correspond in the source code. Such as:
.omletrc.js
1
{
2
"exports": {
3
".": "src/index.ts"
4
}
5
}
You can check the Config file documentation to learn more about the exports property.

Defining package-specific configuration for monorepos

If your project is a monorepo with multiple packages, you can define package-specific configuration using the "workspaces" field. Such as:
.omletrc.js
1
{
2
"workspaces": {
3
"@acme/design-system": {
4
"exports": {
5
".": "./src/index.ts",
6
}
7
}
8
}
9
}
You can check the Config file documentation to learn more about the workspaces property.