Skip to main content

Configuration ๐Ÿ”ฎโ€‹

Clawject using cosmiconfig to load configuration from different sources. Example file names are:

  • .clawjectrc
  • .clawjectrc.json
  • .clawjectrc.js
  • .clawjectrc.ts
  • .config/clawjectrc
  • .config/clawjectrc.json
  • .config/clawjectrc.js
  • .config/clawjectrc.ts
  • clawject.config.js
  • clawject.config.ts
  • package.json with a clawject property
note

If you're using @clawject/language-service - you may need to restart typescript language service after editing configuration file.

Configuration schemaโ€‹

Configuration schema is:

interface ClawjectConfig {
unsafeTSVersion?: boolean; // Default: false
mode?: 'development' | 'production'; // Default: check docs for default value
typeSystem?: 'nominal' | 'structural'; // Default: 'nominal'
beans?: {
defaultExternal?: boolean; // Default: true
},
imports?: {
defaultExternal?: boolean; // Default: true
}
}

unsafeTSVersionโ€‹

Allows using TypeScript version not officially supported by this version of Clawject.

  • When true, Clawject will not check your TypeScript version.
  • When false, Clawject will check your TypeScript version to ensure it's officially compatible with the versions supported by Clawject.

Default value is false.

modeโ€‹

Allows choosing between development and production modes. Development mode is created for development purposes, it emits more clawject metadata to support watch mode of compilers. When development mode is on - Clawject can emit some full file paths.

If mode is not defined in configuration file - mode is determined by the NODE_ENV environment variable.

  • If not set or set to anything other than development, the mode will be production.
  • If set to development, the mode will be development.

If mode is defined in configuration file - environment variable NODE_ENV will be ignored.

typeSystemโ€‹

Allows choosing between nominal and structural type system.

  • When nominal, Clawject will use a nominal type system to distinguish between beans and imports.
  • When structural, Clawject will use a structural type system (default for typescript) to distinguish between beans and imports.

Default value is nominal.

beans.defaultExternalโ€‹

  • When true, all beans are considered external, if not explicitly marked as internal.
  • When false, all beans are considered internal, if not explicitly marked as external.

Default value is true.

tip

Read more about @Internal and @External.

imports.defaultExternalโ€‹

  • When true, all imported configurations are considered external, if not explicitly marked as internal.
  • When false, all imported configurations are considered internal, if not explicitly marked as external.

Default value is true.

tip

Read more about @Internal and @External.