Omlet Docs
BlogChangelogAsk the CommunityContact Sales
  • Get started
    • What is Omlet?
    • CLI & Dashboard
  • Omlet for VS Code
  • CLI & Dashboard
    • CLI
      • Your first scan
      • Set up your dashbard
      • Future scans
      • Ensure data accuracy
      • Config file
        • Exports configuration
        • Mapping aliases
        • Excluding certain components & files
        • Tutorial: Config file
      • Custom component properties
        • CLI hooks
        • Tutorial 1: Team/code owner usage
        • Tutorial 2: Package version tracking
        • Other example scripts
      • Set up regular scans
      • CLI commands
        • init
        • analyze
        • login
    • Analytics
      • Popular charts
      • Create custom charts
      • Save charts to dashboard
      • Share charts and dashboards with your team
      • Download chart data
    • Components
      • Search and filter components
      • Component tags
      • Dependency Tree
      • Props tracking
    • Workspace & Account
      • Invite team members
      • Renaming projects
      • Update your email address
      • Access your billing details & invoices
  • Security
    • Security in Omlet
    • Data collection
  • Help
    • Pricing
    • FAQs
      • How detection works?
      • Monorepo support
      • How to delete scans?
      • Omlet vs. React Scanner
      • Working with multiple workspaces
    • Troubleshooting
      • Debugging CLI issues
      • Some components aren't detected
      • API failed or timeout
      • Are you behind a proxy?
      • Troubleshooting Git errors
Powered by GitBook
On this page
  • Option 1: Config file
  • Option 2: Command line arguments
  1. CLI & Dashboard
  2. CLI
  3. Config file

Excluding certain components & files

Need to exclude certain components and files from scans?

Omlet CLI ignores certain files while scanning, such as node modules, Storybook stories, and test files. Here are the patterns ignored in scans by default:

  • **/node_modules/**

  • **/*.d.ts

  • **/stories/**/*

  • **/.storybook/**/*

  • **/*.stories.{jsx,tsx,js,ts}

  • **/*.{spec,test}.{jsx,tsx,js,ts}

  • **/{__test__,tests}/**/*.{jsx,tsx,js,ts}

You can define custom file names and glob patterns to ignore from scans or limit the CLI to scan certain directories and glob patterns. There are two different options you can choose to exclude components and files from scans.

Option 1: Config file

One way of ignoring certain components is to define them in the configuration file. To do this, you can create a .omletrc file in the root directory of your repository. The CLI will automatically detect this file and apply your configuration.

Your config file can have alternative names and locations. Check the Config file page to learn more.

Once the config file is created, you can define the ignore property with an array of filenames or glob patterns that should be excluded from the scan.

.omletrc
{
  "ignore": ["**/test_folder/**", "**/another_test_folder/**"]
}

If you need to narrow and specify where the CLI will look for components, you can define the include property with an array of filenames or glob patterns.

.omletrc
{
  "include": ["glob/one", "glob/two"]
}

The paths and patterns are resolved relative to the root project path, where the -r parameter points to—or to the current working directory if -r is not provided to the CLI.

Option 2: Command line arguments

Alternatively, you can add the --ignore option to the analyze command while scanning your repositories.

npx omlet analyze --ignore 'glob/one'
yarn omlet analyze --ignore 'glob/one'
pnpm exec omlet analyze --ignore 'glob/one'

If you need to ignore multiple directories, you can pass multiple glob patterns to the CLI.

npx omlet analyze --ignore 'glob/one' --ignore 'glob/two'
yarn omlet analyze --ignore 'glob/one' --ignore 'glob/two'
pnpm exec omlet analyze --ignore 'glob/one' --ignore 'glob/two'

Similar to the config file, you can use -i / --include option in the analyze command to include only specific components, files, or directories.

npx omlet analyze -i 'glob/one' -i 'glob/two'
yarn omlet analyze -i 'glob/one' -i 'glob/two'
pnpm exec omlet analyze -i 'glob/one' -i 'glob/two'

If the ignore or include properties are provided both as a command-line argument and defined in the config file, the corresponding values in the config file will be ignored.

PreviousMapping aliasesNextTutorial: Config file

Last updated 1 year ago