chore: Add isDefault to examples

This commit is contained in:
Sidharth Vinod
2025-04-03 17:10:33 +05:30
parent 865c453547
commit 0c759d0075
22 changed files with 29 additions and 0 deletions

View File

@@ -68,6 +68,14 @@ export const addDiagramDefinition = ({ id, ...definition }: DetectorRecord) => {
if (diagramDefinitions[id]) {
log.warn(`Detector with key ${id} already exists. Overwriting.`);
}
if (
definition.examples &&
definition.examples.filter(({ isDefault }) => isDefault).length !== 1
) {
throw new Error(
`Diagram with key ${id} must have exactly one default example. Set isDefault to true for one example.`
);
}
diagramDefinitions[id] = definition;
log.debug(`Detector with key ${id} added${definition.loader ? ' with loader' : ''}`);
};

View File

@@ -23,6 +23,7 @@ const architecture: ExternalDiagramDefinition = {
description: 'Visualize system architecture and components',
examples: [
{
isDefault: true,
code: `architecture-beta
group api(cloud)[API]

View File

@@ -19,6 +19,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Create block-based visualizations with beta styling',
examples: [
{
isDefault: true,
code: `block-beta
columns 1
db(("DB"))

View File

@@ -24,6 +24,7 @@ const plugin: ExternalDiagramDefinition = {
'Visualize software architecture using the C4 model (Context, Container, Component, Code)',
examples: [
{
isDefault: true,
code: `C4Context
title System Context diagram for Internet Banking System
Enterprise_Boundary(b0, "BankBoundary0") {

View File

@@ -28,6 +28,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize class structures and relationships in object-oriented programming',
examples: [
{
isDefault: true,
code: `classDiagram
Animal <|-- Duck
Animal <|-- Fish

View File

@@ -23,6 +23,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize database schemas and relationships between entities',
examples: [
{
isDefault: true,
code: `erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ ORDER_ITEM : contains

View File

@@ -35,6 +35,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize flowcharts and directed graphs',
examples: [
{
isDefault: true,
code: `flowchart TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}

View File

@@ -23,6 +23,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize project schedules and timelines',
examples: [
{
isDefault: true,
code: `gantt
title A Gantt Diagram
dateFormat YYYY-MM-DD

View File

@@ -20,6 +20,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize Git repository history and branch relationships',
examples: [
{
isDefault: true,
code: `gitGraph
commit
branch develop

View File

@@ -22,6 +22,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize work items in a Kanban board',
examples: [
{
isDefault: true,
code: `---
config:
kanban:

View File

@@ -22,6 +22,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize ideas and concepts in a tree-like structure',
examples: [
{
isDefault: true,
code: `mindmap
root((mindmap))
Origins

View File

@@ -23,6 +23,7 @@ export const packet: ExternalDiagramDefinition = {
description: 'Visualize packet data and network traffic',
examples: [
{
isDefault: true,
code: `---
title: "TCP Packet"
---

View File

@@ -23,6 +23,7 @@ export const pie: ExternalDiagramDefinition = {
description: 'Visualize data as proportional segments of a circle',
examples: [
{
isDefault: true,
code: `pie title Pets adopted by volunteers
"Dogs" : 386
"Cats" : 85

View File

@@ -23,6 +23,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize items in a 2x2 matrix based on two variables',
examples: [
{
isDefault: true,
code: `quadrantChart
title Reach and engagement of campaigns
x-axis Low Reach --> High Reach

View File

@@ -23,6 +23,7 @@ export const radar: ExternalDiagramDefinition = {
description: 'Visualize data in a radial format',
examples: [
{
isDefault: true,
code: `---
title: "Grades"
---

View File

@@ -23,6 +23,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize system requirements and their relationships',
examples: [
{
isDefault: true,
code: `requirementDiagram
requirement test_req {

View File

@@ -19,6 +19,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize flow quantities between different stages or processes',
examples: [
{
isDefault: true,
code: `---
config:
sankey:

View File

@@ -23,6 +23,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize interactions between objects over time',
examples: [
{
isDefault: true,
code: `sequenceDiagram
Alice->>+John: Hello John, how are you?
Alice->>+John: John, can you hear me?

View File

@@ -29,6 +29,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize state transitions and behaviors of a system',
examples: [
{
isDefault: true,
code: `stateDiagram-v2
[*] --> Still
Still --> [*]

View File

@@ -23,6 +23,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize events and milestones in chronological order',
examples: [
{
isDefault: true,
code: `timeline
title History of Social Media Platform
2002 : LinkedIn

View File

@@ -23,6 +23,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Visualize user interactions and experiences with a system',
examples: [
{
isDefault: true,
code: `journey
title My working day
section Go to work

View File

@@ -23,6 +23,7 @@ const plugin: ExternalDiagramDefinition = {
description: 'Create scatter plots and line charts with customizable axes',
examples: [
{
isDefault: true,
code: `xychart-beta
title "Sales Revenue"
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]