refactor: migrate embeddedTemplates.ts to use PathUtils and vault.adapter

- Replace fs operations with vault.adapter methods
- Update constructor to require App parameter
- Make all methods async for vault.adapter compatibility
- Update PluginLifecycle.ts to match new async API
- Remove direct fs/path module dependencies
- Build and lint pass successfully

Safety commit 16/16 - Path migration complete!
This commit is contained in:
Jarvis committed 2025-09-25 12:39:54 +02:00
1 parent b6f64d1cf7
commit 0ff5b4a1b8
2 files changed
+36 -36

No files matched your search

+3 -3
View File
@@ -28,11 +28,11 @@ export class PluginLifecycle {
// Initialize embedded template manager
const vaultPath = this.pathUtils.getVaultPath();
const pluginDir = this.pathUtils.joinPath(vaultPath, this.pathUtils.getPluginDir(this.plugin.manifest));
this.plugin.embeddedTemplateManager = new EmbeddedTemplateManager(pluginDir);
this.plugin.embeddedTemplateManager = new EmbeddedTemplateManager(pluginDir, this.plugin.app);
// Extract any missing templates from embedded data
try {
const extractionResult = this.plugin.embeddedTemplateManager.extractAllMissingTemplates();
const extractionResult = await this.plugin.embeddedTemplateManager.extractAllMissingTemplates();
if (extractionResult.failed.length > 0) {
console.warn(`Failed to extract ${extractionResult.failed.length} templates:`, extractionResult.failed);
ExportErrorHandler.showTemplateError(`Failed to extract some templates. Plugin may not work correctly.`);