Add New Config

Summary

This goes over adding a new dendron.yml configuration

Details

Dendron configuration is defined in ../packages/common-all/src/types/configs/dendronConfig.ts (Private)

Steps

  1. Decide on a scope
  1. Decide on a name

  2. Add config description

  • When adding a config key to the new namespace type(s), you also have to add a corresponding entry in the ../packages/common-all/src/constants/configs/dendronConfig.ts (Private)
    • This is an object that holds every possible config key's label and description that will later be used to automatically generate a configuration view.
    • If this step is omitted, Typescript will complain that DendronConfigEntryCollection is missing a key.
  1. Decide on the default
  • As per the configuration conventions, consider adding a sensible default of the newly introduced config key in the appropriate genDefault{namespace}Config method.
    • Each namespace is divided into separate modules here, and the namespace type and default generating methods live in the same module.
    • These default generating methods will be used by the ConfigUtils that are used to get and set configs later, so it is important to define a default here to simplify the process down the line.
  1. Update tests and json schema

    Update Json

    1. Update the json schema Run yarn gen:data at the root of the monorepo
    2. Update snapshots

      Start anchor updating-test-snapshots not found

      ../packages/plugin-core/src/test/suite-integ/SetupWorkspace.test.ts (Private)

  2. Update UI preview for config : This process is currently manual

  • Update the new config in : ..\packages\dendron-plugin-views\src\utils\dendronConfig.ts (Private).
    • the key is the entire nested path of the newly added config. for example: dev.enableSelfContainedVaults
    • add the type and group of the config. For selecting type:
    • if the config has enum, update the type to beselect. eg: workspace.journal.addBehavior
    • if the config value is in key:value pair, update the type to list. eg: workspace.task.prioritySymbols
    • for complicated values of config, update the type to be : object, this will add a edit in dendron.yml link in UI. eg: workspace.vaults

Backlinks