Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1ea9769
spike: draft implementation of consolidated configs
hikchoi Sep 6, 2021
52dc0f0
chore: add docstrings
hikchoi Sep 6, 2021
afabae2
chore: clean up and add more docstrings
hikchoi Sep 6, 2021
5884377
chore: refactor common types
hikchoi Sep 9, 2021
34ed614
chore: add new scratch config
hikchoi Sep 9, 2021
5fab3e1
chore: add new insert note index configs
hikchoi Sep 9, 2021
8ccc860
chore: change generic type for DendronConfigEntry
hikchoi Sep 9, 2021
8c95505
chore: respect optional when generating defaults
hikchoi Sep 9, 2021
8acc3d5
chore: add new random note config
hikchoi Sep 9, 2021
a9df10a
chore: add more top level namespaces
hikchoi Sep 9, 2021
f5e1e75
chore: add namespace for insert note
hikchoi Sep 9, 2021
142fac0
chore: bunch more stuff
hikchoi Sep 9, 2021
9c41819
chore: add remaining workspace configs
hikchoi Sep 10, 2021
6780bea
chore: add graph configs
hikchoi Sep 10, 2021
c5c22be
chore: add rest of publishing configs
hikchoi Sep 10, 2021
aca742d
chore: add global configs
hikchoi Sep 10, 2021
67b1e6e
chore: add dev configs
hikchoi Sep 10, 2021
72e099b
chore: add preview configs
hikchoi Sep 10, 2021
3d06a31
chore: add dev configs to top level
hikchoi Sep 10, 2021
864561d
chore: define generic type for config entry collection
hikchoi Sep 10, 2021
5012ab1
chore: clean up commands namespace
hikchoi Sep 13, 2021
e0cae85
chore: narrow down collection type definition
hikchoi Sep 13, 2021
a20e8f8
chore: clean up workspace namespace
hikchoi Sep 13, 2021
33653b1
chore: clean up global namespace
hikchoi Sep 13, 2021
fc180be
chore: clean up dev namespace
hikchoi Sep 13, 2021
dfa32ff
chore: clean up preview namespace
hikchoi Sep 13, 2021
1fa756f
chore: clean up publishing namespace
hikchoi Sep 13, 2021
69bc20b
chore: more cleanup
hikchoi Sep 13, 2021
51900ef
chore: more and more cleanup
hikchoi Sep 13, 2021
cbc92c4
chore: fix wording, add omitted configs
hikchoi Sep 13, 2021
517facc
chore: add missing config entries in workspace
hikchoi Sep 14, 2021
b574dda
chore: conform to naming convention, various fixes
hikchoi Sep 14, 2021
dc13a17
chore: remove enableCaching config
hikchoi Sep 16, 2021
2ada327
chore: renaming and deletions
hikchoi Sep 16, 2021
609873b
chore: reduce generic type boilerplate
hikchoi Sep 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions packages/common-all/src/constants/configs/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {
DendronConfigEntry,
VaultSyncModeEnum,
} from "../../types/configs/base";

export const VAULT_SYNC_MODES: Record<
VaultSyncModeEnum,
DendronConfigEntry<string>
> = {
[VaultSyncModeEnum.skip]: {
value: VaultSyncModeEnum.skip,
label: "Skip",
desc: "Skip entirely. You must manage the repository manually.",
},
[VaultSyncModeEnum.noPush]: {
value: VaultSyncModeEnum.noPush,
label: "No Push",
desc: "Commit any changes and pull updates, but don't push. You can watch the repository and make local changes without sharing them back",
},
[VaultSyncModeEnum.noCommit]: {
value: VaultSyncModeEnum.noCommit,
label: "No Commit",
desc: "Pull and push updates if the workspace is clean, but don't commit. You manually commit your local changes, but automatically share them once you committed.",
},
[VaultSyncModeEnum.sync]: {
value: VaultSyncModeEnum.sync,
label: "Sync",
desc: "Commit changes, and pull and push updates. Treats workspace vaults like regular vaults.",
},
};
170 changes: 170 additions & 0 deletions packages/common-all/src/constants/configs/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
import {
DendronConfigEntry,
DendronConfigEntryCollection,
} from "../../types/configs/base";
import { DendronCommandConfig } from "../../types/configs/commands/commands";
import {
LookupConfig,
NoteLookupConfig,
LookupSelectionModeEnum,
} from "../../types/configs/commands/lookup";
import { RandomNoteConfig } from "../../types/configs/commands/randomNote";
import { InsertNoteConfig } from "../../types/configs/commands/insertNote";
import {
InsertNoteLinkConfig,
InsertNoteLinkAliasModeEnum,
} from "../../types/configs/commands/insertNoteLink";
import { InsertNoteIndexConfig } from "../../types/configs/commands/insertNoteIndex";

/**
* Lookup
*/

/**
* Selection mode entries
*/
const SELECTION_MODES: Record<
LookupSelectionModeEnum,
DendronConfigEntry<string>
> = {
[LookupSelectionModeEnum.extract]: {
value: LookupSelectionModeEnum.extract,
label: "Extract Selection",
desc: "Extract selection of active editor and use it as body of new note.",
},
[LookupSelectionModeEnum.link]: {
value: LookupSelectionModeEnum.link,
label: "Selection to Link",
desc: "Use selection of active editor for the basename of the lookup value.",
},
[LookupSelectionModeEnum.none]: {
value: LookupSelectionModeEnum.none,
label: "None",
desc: "Do not set selection mode",
},
};

/**
* Note lookup entry collection
*/
const NOTE: DendronConfigEntryCollection<NoteLookupConfig> = {
selectionMode: SELECTION_MODES,
confirmVaultOnCreate: {
label: "Confirm Vault on Create.",
desc: "Prompt for vault selection when creating new note.",
},
};

/**
* Lookup entry collection
*/
const LOOKUP: DendronConfigEntryCollection<LookupConfig> = {
note: NOTE,
};

/**
* Random note
*/

/**
* Random note entries
*/
const RANDOM_NOTE: DendronConfigEntryCollection<RandomNoteConfig> = {
include: {
label: "Hierarchies to Include",
desc: "Hierarchies to include when opening a random note",
},
exclude: {
label: "hierarchies to Exclude",
desc: "Hierarchies not to include when opening a random note",
},
};

/**
* Insert note
*/

/**
* Insert note entries
*/
const INSERT_NOTE: DendronConfigEntryCollection<InsertNoteConfig> = {
initialValue: {
label: "Initial Value",
desc: "Initial value that will be filled when prompted.",
},
};

/**
* Insert note link
*/

/**
* Insert note link alias mode entries
*/
const ALIAS_MODES: Record<
InsertNoteLinkAliasModeEnum,
DendronConfigEntry<string>
> = {
[InsertNoteLinkAliasModeEnum.snippet]: {
value: InsertNoteLinkAliasModeEnum.snippet,
label: "Snippet Mode",
desc: "Insert note link as snippet string",
},
[InsertNoteLinkAliasModeEnum.selection]: {
value: InsertNoteLinkAliasModeEnum.selection,
label: "Selection Mode",
desc: "Extract selection and use as link alias",
},
[InsertNoteLinkAliasModeEnum.title]: {
value: InsertNoteLinkAliasModeEnum.title,
label: "Title Mode",
desc: "Use linked note's title as link alias",
},
[InsertNoteLinkAliasModeEnum.prompt]: {
value: InsertNoteLinkAliasModeEnum.prompt,
label: "Prompt Mode",
desc: "Prompt for input to be used as link alias",
},
[InsertNoteLinkAliasModeEnum.none]: {
value: InsertNoteLinkAliasModeEnum.none,
label: "No Alias Mode",
desc: "Do not add link alias",
},
};

/**
* Insert note link entries
*/
const INSERT_NOTE_LINK: DendronConfigEntryCollection<InsertNoteLinkConfig> = {
aliasMode: ALIAS_MODES,
enableMultiSelect: {
label: "Enable Multi-select",
desc: "Enable multi-select when inserting note links",
},
};

/**
* Insert note index
*/

/**
* Insert note index entries
*/
export const INSERT_NOTE_INDEX: DendronConfigEntryCollection<InsertNoteIndexConfig> =
{
enableMarker: {
label: `Enable Marker`,
desc: `Insert note index between autogenerated markers`,
},
};

/**
* Command entry collection
*/
export const COMMANDS: DendronConfigEntryCollection<DendronCommandConfig> = {
lookup: LOOKUP,
randomNote: RANDOM_NOTE,
insertNote: INSERT_NOTE,
insertNoteLink: INSERT_NOTE_LINK,
insertNoteIndex: INSERT_NOTE_INDEX,
};
17 changes: 17 additions & 0 deletions packages/common-all/src/constants/configs/dendronConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { DendronConfigEntryCollection } from "../../types/configs/base";
import { DendronConfig } from "../../types/configs/dendronConfig";
import { GLOBAL } from "./global";
import { COMMANDS } from "./commands";
import { WORKSPACE } from "./workspace";
import { PREVIEW } from "./preview";
import { PUBLISHING } from "./publishing";
import { DEV } from "./dev";

export const DENDRON_CONFIG: DendronConfigEntryCollection<DendronConfig> = {
global: GLOBAL,
commands: COMMANDS,
workspace: WORKSPACE,
preview: PREVIEW,
publishing: PUBLISHING,
dev: DEV,
};
29 changes: 29 additions & 0 deletions packages/common-all/src/constants/configs/dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { DendronConfigEntryCollection } from "../../types/configs/base";
import { DendronDevConfig } from "../../types/configs/dev/dev";

export const DEV: DendronConfigEntryCollection<DendronDevConfig> = {
nextServerUrl: {
label: "Next Server URL",
desc: "Custom URL for the nextjs server.",
},
nextStaticRoot: {
label: "Next Static Root",
desc: "Root directory for the static assets of the nextjs server.",
},
engineServerPort: {
label: "Engine Server Port",
desc: "What port to use for the engine server. Defaults to creating on startup.",
},
enableWebUI: {
label: "Enable web UI",
desc: "Enable experimental web ui. Defaults to false.",
},
enableLinkCandidates: {
label: "Enable Link Candidates",
desc: "Enable displaying and indexing link candidates. Defaults to false.",
},
enablePreviewV2: {
label: "Enable Preview V2",
desc: "Use preview V2 as the default preview.",
},
};
89 changes: 89 additions & 0 deletions packages/common-all/src/constants/configs/global.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { TopLevelDendronConfig } from "../../types/configs/dendronConfig";
import {
DendronConfigEntry,
DendronConfigEntryCollection,
} from "../../types/configs/base";
import { DendronGlobalConfig } from "../../types/configs/global/global";

export const ENABLE_MERMAID = (
namespace: TopLevelDendronConfig
): DendronConfigEntry => {
return {
label: `Enable Mermaid (${namespace})`,
desc: `Enable the use of mermaid for rendering diagrams. (${namespace})`,
};
};

export const ENABLE_NUNJUCKS = (
namespace: TopLevelDendronConfig
): DendronConfigEntry => {
return {
label: `Enable Nunjucks (${namespace})`,
desc: `Enable the use of nunjucks templates in the note body. (${namespace})`,
};
};

export const ENABLE_PRETTY_REFS = (
namespace: TopLevelDendronConfig
): DendronConfigEntry => {
return {
label: `Enable Pretty Refs (${namespace})`,
desc: `Enable rendering note references as pretty refs. (${namespace})`,
};
};

export const ENABLE_KATEX = (
namespace: TopLevelDendronConfig
): DendronConfigEntry => {
return {
label: `Enable Katex (${namespace})`,
desc: `Enable the use of katex for rendering math. (${namespace})`,
};
};

export const ENABLE_FM_TITLE = (
namespace: TopLevelDendronConfig
): DendronConfigEntry => {
return {
label: `Enable Frontmatter Title (${namespace})`,
desc: `Insert frontmatter title of note to the body (${namespace})`,
};
};

export const ENABLE_HIERARCHY_DISPLAY = (
namespace: TopLevelDendronConfig
): DendronConfigEntry => {
return {
label: `Enable Hierarchy Display (${namespace})`,
desc: `Enable rendering of children link block at the end of the note. (${namespace})`,
};
};

export const HIERARCHY_DISPLAY_TITLE = (
namespace: TopLevelDendronConfig
): DendronConfigEntry => {
return {
label: `Hierarhcy Display Title ${namespace}`,
desc: `Title to display for the children links block. ${namespace}`,
};
};

export const ENABLE_NOTE_TITLE_FOR_LINK = (
namespace: TopLevelDendronConfig
): DendronConfigEntry => {
return {
label: `Enable Note Title for Links (${namespace})`,
desc: `Enable rendering of naked links as the title of the note. (${namespace})`,
};
};

export const GLOBAL: DendronConfigEntryCollection<DendronGlobalConfig> = {
enableFMTitle: ENABLE_FM_TITLE("global"), // TODO: split implementation to respect non-global config
enableHierarchyDisplay: ENABLE_HIERARCHY_DISPLAY("global"), // TODO: split
hierarchyDisplayTitle: HIERARCHY_DISPLAY_TITLE("global"), //TODO: split
enableNoteTitleForLink: ENABLE_NOTE_TITLE_FOR_LINK("global"), // TODO: split
enableMermaid: ENABLE_MERMAID("global"),
enableNunjucks: ENABLE_NUNJUCKS("global"),
enablePrettyRefs: ENABLE_PRETTY_REFS("global"),
enableKatex: ENABLE_KATEX("global"),
};
23 changes: 23 additions & 0 deletions packages/common-all/src/constants/configs/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { DendronConfigEntryCollection } from "../../types/configs/base";
import { DendronPreviewConfig } from "../../types/configs/preview/preview";
import {
ENABLE_HIERARCHY_DISPLAY,
HIERARCHY_DISPLAY_TITLE,
ENABLE_FM_TITLE,
ENABLE_NOTE_TITLE_FOR_LINK,
ENABLE_MERMAID,
ENABLE_NUNJUCKS,
ENABLE_KATEX,
ENABLE_PRETTY_REFS,
} from "./global";

export const PREVIEW: DendronConfigEntryCollection<DendronPreviewConfig> = {
enableFMTitle: ENABLE_FM_TITLE("preview"), // TODO: split
enableHierarchyDisplay: ENABLE_HIERARCHY_DISPLAY("preview"), // TODO: split
hierarchyDisplayTitle: HIERARCHY_DISPLAY_TITLE("preview"), // TODO: split
enableNoteTitleForLink: ENABLE_NOTE_TITLE_FOR_LINK("preview"), // TODO: split
enableMermaid: ENABLE_MERMAID("preview"),
enableNunjucks: ENABLE_NUNJUCKS("preview"),
enablePrettyRefs: ENABLE_PRETTY_REFS("preview"),
enableKatex: ENABLE_KATEX("preview"),
};
Loading