Skip to main content

Overview

The rev-dep config init command creates a new .rev-dep.config.jsonc configuration file in the current directory with sensible default settings. The command automatically detects whether you’re working in a monorepo or single-package project and generates appropriate rules.

Syntax

rev-dep config init [flags]

Behavior

The command behavior depends on your project structure:
  • Monorepo root: Creates a root rule plus a rule for each discovered workspace package
  • Monorepo workspace package: Creates config with a single rule for the current package only
  • Regular projects: Creates config with a single rule for the root directory

Flags

cwd
string
default:"$PWD"
Working directory where the config file will be created
help
boolean
Display help information for the init command

Examples

Create config in current directory

rev-dep config init

Create config in specific directory

rev-dep config init --cwd ./packages/my-app

Output

The command creates a .rev-dep.config.jsonc file with:
  • configVersion: Current configuration schema version (1.6)
  • $schema: JSON schema URL for IDE autocompletion
  • rules: Array of rule configurations based on your project structure

Default Checks Enabled

For each rule, the following checks are enabled by default:
  • circularImportsDetection: Detects circular dependencies
  • unresolvedImportsDetection: Finds unresolved import statements

Default Checks Disabled

The following checks are disabled by default (you can enable them as needed):
  • orphanFilesDetection
  • unusedNodeModulesDetection
  • missingNodeModulesDetection
  • unusedExportsDetection
  • devDepsUsageOnProdDetection
  • restrictedImportsDetection

Error Handling

The command will fail if:
  • A config file already exists in the directory
  • The directory is not writable
  • JSON marshaling fails

Next Steps

After creating the config file:
  1. Review and adjust the generated rules to match your project structure
  2. Enable additional checks as needed for your use case
  3. Configure entry points (prodEntryPoints and devEntryPoints)
  4. Run rev-dep config run to execute all configured checks
The generated module boundaries config is exemplary. Adjust it to reflect your actual architecture boundaries.
Feed the config file JSON schema to an LLM to get help with advanced configuration options.

Build docs developers (and LLMs) love