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:
2 files changed
+36
-36
No files matched your search
@@ -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.`);
|
||||
|
||||
Reference in new issue
Block a user