Workspace.Checks.DependenciesVersion (Workspace v0.2.1)

View Source

Checks that the configured dependencies versions match the expected ones

Common use cases

This check can be used in order to ensure common dependencies versions and options across all projects of your mono-repo.

Configuration

  • :deps (non-empty keyword/0) - Defines the required dependencies versions across the workspace. Each key corresponds to the name of an external dependency, and the value should be a keyword list which accepts the following options:

    • :version (String.t/0 or Keyword.t/0) - Required. The required version of the package. This can either be a string indicating hex version numbers or a keyword list for git or path dependencies.

    • :options (keyword/0) - Other options of the dependencies definition that should also match. This is useful, in case you want to ensure for example, that specific dependencies are loaded only in the :dev environment. In order to do this, you have to set the :options to [only: :dev].

      If not set only the version will be checked.

Example

[
  module: Workspace.Checks.DependenciesVersion,
  opts: [
    deps: [
      # checks version and :only and :runtime options
      ex_doc: [
        version: "== 0.28.3",
        options: [only: :dev, runtime: true]
      ],
      # checks only version
      ex_doc: [
        version: "== 0.28.3",
      ],
      # checks a git dependency version
      ex_doc: [
        version: [github: "elixir-lang/ex_doc"]
      ]
    ]
  ]
]