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
- Decide on a scope
- see all Scopes (Private)
- Add the new config to an appropriate namespace of the new
DendronConfig
. - eg. if we were adding the command to the workspace, we would pick add the configuration to ../packages/common-all/src/types/configs/workspace/workspace.ts (Private)
- if the namespace contains also a schema definition, also add the new config there.
- this must be done if it is a required key
- for the future we aim to coalesce these to locations
- Add the new config to an appropriate namespace of the new
-
Decide on a name
- Consult the configuration conventions note for naming
-
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.
- 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.
-
Update tests and json schema
From Modify Dendron ConfigGo to text āUpdate Json
- Update the json schema
Run
yarn gen:data
at the root of the monorepo - Update snapshots
From TestingGo to text ā
Start anchor updating-test-snapshots not found
- Update the json schema
Run
-
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 be
select
. eg:workspace.journal.addBehavior
- if the config value is in
key:value
pair, update the type tolist
. eg:workspace.task.prioritySymbols
- for complicated values of config, update the type to be :
object
, this will add aedit in dendron.yml
link in UI. eg:workspace.vaults
- the key is the entire nested path of the newly added config. for example:
Backlinks