From 3b8efa99779af79eb23d2409d092392bce33c50a Mon Sep 17 00:00:00 2001 From: Aleix Soler Date: Wed, 18 Mar 2026 15:04:12 +0100 Subject: [PATCH] feat: add template marketplace infrastructure and JSON templates --- scripts/generate-templates.mjs | 32 +++++++++++++++++ templates/academic.json | 49 ++++++++++++++++++++++++++ templates/colorful.json | 61 +++++++++++++++++++++++++++++++++ templates/creative-writing.json | 39 +++++++++++++++++++++ templates/minimal.json | 31 +++++++++++++++++ templates/project.json | 55 +++++++++++++++++++++++++++++ 6 files changed, 267 insertions(+) create mode 100644 scripts/generate-templates.mjs create mode 100644 templates/academic.json create mode 100644 templates/colorful.json create mode 100644 templates/creative-writing.json create mode 100644 templates/minimal.json create mode 100644 templates/project.json diff --git a/scripts/generate-templates.mjs b/scripts/generate-templates.mjs new file mode 100644 index 0000000..758bca9 --- /dev/null +++ b/scripts/generate-templates.mjs @@ -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.`); diff --git a/templates/academic.json b/templates/academic.json new file mode 100644 index 0000000..fb46483 --- /dev/null +++ b/templates/academic.json @@ -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" + } + ] +} diff --git a/templates/colorful.json b/templates/colorful.json new file mode 100644 index 0000000..15955ea --- /dev/null +++ b/templates/colorful.json @@ -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" + } + ] +} diff --git a/templates/creative-writing.json b/templates/creative-writing.json new file mode 100644 index 0000000..eca6bf4 --- /dev/null +++ b/templates/creative-writing.json @@ -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" + } + ] +} diff --git a/templates/minimal.json b/templates/minimal.json new file mode 100644 index 0000000..cb8e8ca --- /dev/null +++ b/templates/minimal.json @@ -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" + } + ] +} diff --git a/templates/project.json b/templates/project.json new file mode 100644 index 0000000..43a5304 --- /dev/null +++ b/templates/project.json @@ -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" + } + ] +}