feat: add template marketplace infrastructure and JSON templates

This commit is contained in:
Aleix Soler 2026-03-18 15:04:12 +01:00
parent 07c8b8d4df
commit 3b8efa9977
6 changed files with 267 additions and 0 deletions

View file

@ -0,0 +1,32 @@
import fs from 'fs';
import path from 'path';
const templatesDir = './templates';
const outputFile = './constants/predefinedTemplates.ts';
const files = fs.readdirSync(templatesDir);
const templates = [];
files.forEach(file => {
if (file.endsWith('.json')) {
const filePath = path.join(templatesDir, file);
const content = JSON.parse(fs.readFileSync(filePath, 'utf8'));
templates.push(content);
}
});
const content = `import { StatusTemplate } from "types/pluginSettings";
/**
* Predefined status templates generated from the templates directory
*/
export const PREDEFINED_TEMPLATES: StatusTemplate[] = ${JSON.stringify(templates, null, '\t')};
/**
* Default template IDs that should be enabled by default
*/
export const DEFAULT_ENABLED_TEMPLATES = ["colorful"];
`;
fs.writeFileSync(outputFile, content);
console.log(`Generated ${outputFile} with ${templates.length} templates.`);

49
templates/academic.json Normal file
View file

@ -0,0 +1,49 @@
{
"id": "academic",
"name": "Academic research",
"description": "Status workflow for academic research and writing",
"statuses": [
{
"name": "research",
"icon": "🔍",
"color": "#2196F3",
"templateId": "academic"
},
{
"name": "outline",
"icon": "📑",
"color": "#9E9E9E",
"templateId": "academic"
},
{
"name": "draft",
"icon": "✏️",
"color": "#FFC107",
"templateId": "academic"
},
{
"name": "review",
"icon": "🔬",
"color": "#9C27B0",
"templateId": "academic"
},
{
"name": "revision",
"icon": "📝",
"color": "#FF5722",
"templateId": "academic"
},
{
"name": "final",
"icon": "📚",
"color": "#4CAF50",
"templateId": "academic"
},
{
"name": "published",
"icon": "🎓",
"color": "#795548",
"templateId": "academic"
}
]
}

61
templates/colorful.json Normal file
View file

@ -0,0 +1,61 @@
{
"id": "colorful",
"name": "Colorful workflow",
"description": "A colorful set of workflow statuses with descriptive icons",
"statuses": [
{
"name": "idea",
"icon": "💡",
"color": "#FFEB3B",
"templateId": "colorful"
},
{
"name": "draft",
"icon": "📝",
"color": "#E0E0E0",
"templateId": "colorful"
},
{
"name": "inProgress",
"icon": "🔧",
"color": "#FFC107",
"templateId": "colorful"
},
{
"name": "editing",
"icon": "🖊️",
"color": "#2196F3",
"templateId": "colorful"
},
{
"name": "pending",
"icon": "⏳",
"color": "#9C27B0",
"templateId": "colorful"
},
{
"name": "onHold",
"icon": "⏸",
"color": "#9E9E9E",
"templateId": "colorful"
},
{
"name": "needsUpdate",
"icon": "🔄",
"color": "#FF5722",
"templateId": "colorful"
},
{
"name": "completed",
"icon": "✅",
"color": "#4CAF50",
"templateId": "colorful"
},
{
"name": "archived",
"icon": "📦",
"color": "#795548",
"templateId": "colorful"
}
]
}

View file

@ -0,0 +1,39 @@
{
"id": "creative-writing",
"name": "Creative Writing",
"description": "Workflow for novelists and creative writers",
"author": "Obsidian Community",
"github": "https://github.com/obsidian-community",
"statuses": [
{
"name": "idea",
"icon": "🧠",
"color": "#FFD700",
"templateId": "creative-writing"
},
{
"name": "outline",
"icon": "🗺️",
"color": "#87CEEB",
"templateId": "creative-writing"
},
{
"name": "first-draft",
"icon": "✍️",
"color": "#FFA07A",
"templateId": "creative-writing"
},
{
"name": "revision",
"icon": "🔍",
"color": "#DA70D6",
"templateId": "creative-writing"
},
{
"name": "final-polish",
"icon": "✨",
"color": "#32CD32",
"templateId": "creative-writing"
}
]
}

31
templates/minimal.json Normal file
View file

@ -0,0 +1,31 @@
{
"id": "minimal",
"name": "Minimal workflow",
"description": "A simplified set of essential workflow statuses",
"statuses": [
{
"name": "todo",
"icon": "📌",
"color": "#F44336",
"templateId": "minimal"
},
{
"name": "inProgress",
"icon": "⚙️",
"color": "#2196F3",
"templateId": "minimal"
},
{
"name": "review",
"icon": "👀",
"color": "#9C27B0",
"templateId": "minimal"
},
{
"name": "done",
"icon": "✓",
"color": "#4CAF50",
"templateId": "minimal"
}
]
}

55
templates/project.json Normal file
View file

@ -0,0 +1,55 @@
{
"id": "project",
"name": "Project management",
"description": "Status workflow for project management and tracking",
"statuses": [
{
"name": "planning",
"icon": "🗓️",
"color": "#9E9E9E",
"templateId": "project"
},
{
"name": "backlog",
"icon": "📋",
"color": "#E0E0E0",
"templateId": "project"
},
{
"name": "ready",
"icon": "🚦",
"color": "#8BC34A",
"templateId": "project"
},
{
"name": "inDevelopment",
"icon": "👨‍💻",
"color": "#2196F3",
"templateId": "project"
},
{
"name": "testing",
"icon": "🧪",
"color": "#9C27B0",
"templateId": "project"
},
{
"name": "review",
"icon": "👁️",
"color": "#FFC107",
"templateId": "project"
},
{
"name": "approved",
"icon": "👍",
"color": "#4CAF50",
"templateId": "project"
},
{
"name": "live",
"icon": "🚀",
"color": "#3F51B5",
"templateId": "project"
}
]
}