Omlet Docs
Ask or search…
K
Comment on page

Commands & options

Omlet CLI has three main commands: init, analyze, login. Below are the details on available options for each command and when you can use them.

init

This command will take you through a guided process to scan your repo(s) based on your setup. Some of the supported setups include:
  • A single repo that includes both your application and component library
  • A monorepo with multiple packages and your component library
  • Multiple application repos and a separate component library repo
If you need to restart the init setup process, you can delete scans that were created.

-r / --root

Set where Omlet CLI will run the analysis. This option will come in handy if you are running the CLI from a directory that is different from the directory of the project you are trying to scan.
By default, the project root is the current working directory of the terminal. If that directory doesn't contain a package.json file, the CLI will attempt to find the closest package.json up in the directory hierarchy, starting from the current directory to determine the project root.
The CLI will also display an output in the terminal which indicates the root where it is running the scan:
Analyzing the project at <PATH>…

--log-level

Specify the log level for the CLI. Possible values you can pass: error, warn, info, debug, trace

-v / --verbose

By default, it is set as false. Adding this option will give you detailed log output in the CLI.

-h / --help

omlet init -h will provide all the available options you can use to run the analyze command with some explanations.

analyze

This command is used to scan additional repos to detect components and analyze their dependency after you have gone through the initial setup using init.

-i / --include

By default analyze will take the current directory as the root and analyze everything. Supplying a glob pattern to -i will narrow and specify where to scan for components. You can also pass multiple glob patterns:
npx omlet analyze -i 'glob/one' -i 'glob/two'

--ignore

Pass a glob pattern to any directory, file, or component that you would like Omlet CLI to ignore from scanning. You can pass multiple ignore glob patterns:
npx omlet analyze --ignore 'glob/one' --ignore 'glob/two'

-r / --root

Set where Omlet CLI will run the analysis. This option will come in handy if you are running the CLI from a directory that is different from the directory of the project you are trying to scan.
By default, the project root is the current working directory of the terminal. If that directory doesn't contain a package.json, the CLI will attempt to find the closest package.json up in the directory hierarchy starting from the current directory to determine the project root.
The CLI will also display an output in the terminal which indicates the root where it is running the scan:
Analyzing the project at <PATH>…

--log-level

Specify the log level for the CLI. Possible values you can pass: error, warn, info, debug, trace

-v / --verbose

By default, it is set as false. Adding this option will give you detailed log output in the CLI.

--dry-run

Scanned results will only be outputted locally to omlet.out.json. This will allow users to test results before uploading results to the Omlet web app.

-h / --help

omlet analyze -h will provide all the available options you can use to run the analyze command with some explanations.

login

This command is used to authenticate to the CLI and to let it know where to upload the results from a scan.
This flag generates an access token, which can be used to automate CLI runs by adding it to your CI/CD process.
You can generate an access token by running the following:
npx omlet login --print-token
If you are running it outside of your repository, you can run:
npx @omlet/cli login --print-token
Once the token is printed, you can set the access token to an environment variable named OMLET_TOKEN. Omlet CLI will automatically use this specific environment variable.

Glob patterns

Glob patterns are applied against the file path relative to the project's root directory, such as:
  • * matches zero or more characters (excluding path separators).
  • ? matches any single character (excluding path separators).
  • ** recursively matches directories.
For more details, refer to the Pattern in glob documentation.