From 68a37aed197e52fbd20e9388d57f6058f5cf2184 Mon Sep 17 00:00:00 2001 From: Julius Uusinarkaus Date: Mon, 2 Oct 2023 12:37:03 +0300 Subject: [PATCH] filetree: move files into better modules --- main.ts | 12 ++++++------ src/compiler/FrontmatterCompiler.ts | 2 +- src/compiler/GardenPageCompiler.ts | 2 +- src/publisher/PublishStatusManager.ts | 2 +- src/publisher/Publisher.ts | 4 ++-- .../DigitalGardenSiteManager.ts | 2 +- .../RepositoryConnection.ts | 0 .../TemplateManager.ts | 0 src/test/utils.test.ts | 2 +- src/utils/utils.ts | 2 +- src/{ui => views}/DigitalGardenSettingTab.ts | 6 +++--- .../PublicationCenter}/DiffView.svelte | 0 .../PublicationCenter.svelte | 6 +++--- .../PublicationCenter/PublicationCenter.ts} | 18 +++++++++--------- src/{ui => views}/PublishStatusBar.ts | 0 .../SettingsView/GithubSettings.ts | 0 .../SettingsView/RewriteSettings.svelte | 2 +- src/{ui => views}/SettingsView/SettingView.ts | 9 ++++++--- .../SettingsView/addFilterInput.ts | 0 .../UpdateGardenRepositoryModal.ts} | 0 20 files changed, 36 insertions(+), 33 deletions(-) rename src/{publisher => repositoryConnection}/DigitalGardenSiteManager.ts (98%) rename src/{publisher => repositoryConnection}/RepositoryConnection.ts (100%) rename src/{publisher => repositoryConnection}/TemplateManager.ts (100%) rename src/{ui => views}/DigitalGardenSettingTab.ts (88%) rename src/{ui => views/PublicationCenter}/DiffView.svelte (100%) rename src/{ui => views/PublicationCenter}/PublicationCenter.svelte (98%) rename src/{ui/PublishModal.ts => views/PublicationCenter/PublicationCenter.ts} (82%) rename src/{ui => views}/PublishStatusBar.ts (100%) rename src/{ui => views}/SettingsView/GithubSettings.ts (100%) rename src/{ui => views}/SettingsView/RewriteSettings.svelte (98%) rename src/{ui => views}/SettingsView/SettingView.ts (99%) rename src/{ui => views}/SettingsView/addFilterInput.ts (100%) rename src/{ui/SettingsModal.ts => views/UpdateGardenRepositoryModal.ts} (100%) diff --git a/main.ts b/main.ts index 7504a84e..668bfc38 100644 --- a/main.ts +++ b/main.ts @@ -1,13 +1,13 @@ import { Notice, Plugin, Workspace, addIcon } from "obsidian"; import Publisher from "./src/publisher/Publisher"; import DigitalGardenSettings from "./src/models/settings"; -import { PublishStatusBar } from "./src/ui/PublishStatusBar"; +import { PublishStatusBar } from "./src/views/PublishStatusBar"; import { seedling } from "src/ui/suggest/constants"; -import { PublishModal } from "src/ui/PublishModal"; +import { PublicationCenter } from "src/views/PublicationCenter/PublicationCenter"; import PublishStatusManager from "src/publisher/PublishStatusManager"; import ObsidianFrontMatterEngine from "src/publishFile/ObsidianFrontMatterEngine"; -import DigitalGardenSiteManager from "src/publisher/DigitalGardenSiteManager"; -import { DigitalGardenSettingTab } from "./src/ui/DigitalGardenSettingTab"; +import DigitalGardenSiteManager from "src/repositoryConnection/DigitalGardenSiteManager"; +import { DigitalGardenSettingTab } from "./src/views/DigitalGardenSettingTab"; import { generateGardenSnapshot } from "./src/test/snapshot/generateGardenSnapshot"; import dotenv from "dotenv"; import Logger from "js-logger"; @@ -74,7 +74,7 @@ export default class DigitalGarden extends Plugin { settings!: DigitalGardenSettings; appVersion!: string; - publishModal!: PublishModal; + publishModal!: PublicationCenter; async onload() { this.appVersion = this.manifest.version; @@ -506,7 +506,7 @@ export default class DigitalGarden extends Plugin { publisher, ); - this.publishModal = new PublishModal( + this.publishModal = new PublicationCenter( this.app, publishStatusManager, publisher, diff --git a/src/compiler/FrontmatterCompiler.ts b/src/compiler/FrontmatterCompiler.ts index 5fc2495f..607e29ac 100644 --- a/src/compiler/FrontmatterCompiler.ts +++ b/src/compiler/FrontmatterCompiler.ts @@ -7,7 +7,7 @@ import { getRewriteRules, } from "../utils/utils"; import DigitalGardenSettings from "../models/settings"; -import { PathRewriteRules } from "../publisher/DigitalGardenSiteManager"; +import { PathRewriteRules } from "../repositoryConnection/DigitalGardenSiteManager"; import { PublishFile } from "../publishFile/PublishFile"; export type TFrontmatter = Record & { diff --git a/src/compiler/GardenPageCompiler.ts b/src/compiler/GardenPageCompiler.ts index cb9cde86..046a85e9 100644 --- a/src/compiler/GardenPageCompiler.ts +++ b/src/compiler/GardenPageCompiler.ts @@ -7,7 +7,7 @@ import { getLinkpath, } from "obsidian"; import DigitalGardenSettings from "../models/settings"; -import { PathRewriteRule } from "../publisher/DigitalGardenSiteManager"; +import { PathRewriteRule } from "../repositoryConnection/DigitalGardenSiteManager"; import Publisher from "../publisher/Publisher"; import { fixSvgForXmlSerializer, diff --git a/src/publisher/PublishStatusManager.ts b/src/publisher/PublishStatusManager.ts index a3885205..3ca70331 100644 --- a/src/publisher/PublishStatusManager.ts +++ b/src/publisher/PublishStatusManager.ts @@ -1,4 +1,4 @@ -import DigitalGardenSiteManager from "./DigitalGardenSiteManager"; +import DigitalGardenSiteManager from "../repositoryConnection/DigitalGardenSiteManager"; import Publisher from "./Publisher"; import { generateBlobHash } from "../utils/utils"; import { CompiledPublishFile } from "../publishFile/PublishFile"; diff --git a/src/publisher/Publisher.ts b/src/publisher/Publisher.ts index cb8cd02e..8763c15a 100644 --- a/src/publisher/Publisher.ts +++ b/src/publisher/Publisher.ts @@ -5,12 +5,12 @@ import { hasPublishFlag, isPublishFrontmatterValid, } from "../publishFile/Validator"; -import { PathRewriteRules } from "./DigitalGardenSiteManager"; +import { PathRewriteRules } from "../repositoryConnection/DigitalGardenSiteManager"; import DigitalGardenSettings from "../models/settings"; import { Assets, GardenPageCompiler } from "../compiler/GardenPageCompiler"; import { CompiledPublishFile, PublishFile } from "../publishFile/PublishFile"; import Logger from "js-logger"; -import { RepositoryConnection } from "./RepositoryConnection"; +import { RepositoryConnection } from "../repositoryConnection/RepositoryConnection"; export interface MarkedForPublishing { notes: PublishFile[]; diff --git a/src/publisher/DigitalGardenSiteManager.ts b/src/repositoryConnection/DigitalGardenSiteManager.ts similarity index 98% rename from src/publisher/DigitalGardenSiteManager.ts rename to src/repositoryConnection/DigitalGardenSiteManager.ts index 109f90f4..8b944cd0 100644 --- a/src/publisher/DigitalGardenSiteManager.ts +++ b/src/repositoryConnection/DigitalGardenSiteManager.ts @@ -13,7 +13,7 @@ import { } from "./RepositoryConnection"; import Logger from "js-logger"; import { TemplateUpdateChecker } from "./TemplateManager"; -import { NOTE_PATH_BASE, IMAGE_PATH_BASE } from "./Publisher"; +import { NOTE_PATH_BASE, IMAGE_PATH_BASE } from "../publisher/Publisher"; const logger = Logger.get("digital-garden-site-manager"); export interface PathRewriteRule { diff --git a/src/publisher/RepositoryConnection.ts b/src/repositoryConnection/RepositoryConnection.ts similarity index 100% rename from src/publisher/RepositoryConnection.ts rename to src/repositoryConnection/RepositoryConnection.ts diff --git a/src/publisher/TemplateManager.ts b/src/repositoryConnection/TemplateManager.ts similarity index 100% rename from src/publisher/TemplateManager.ts rename to src/repositoryConnection/TemplateManager.ts diff --git a/src/test/utils.test.ts b/src/test/utils.test.ts index 0dcb209b..fd8ac48b 100644 --- a/src/test/utils.test.ts +++ b/src/test/utils.test.ts @@ -4,7 +4,7 @@ import { getRewriteRules, wrapAround, } from "../utils/utils"; -import { PathRewriteRules } from "../publisher/DigitalGardenSiteManager"; +import { PathRewriteRules } from "../repositoryConnection/DigitalGardenSiteManager"; describe("utils", () => { describe("getGardenPathForNote", () => { diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 378a3dd5..1aeeeec2 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,7 +1,7 @@ import { Base64 } from "js-base64"; import slugify from "@sindresorhus/slugify"; import sha1 from "crypto-js/sha1"; -import { PathRewriteRules } from "../publisher/DigitalGardenSiteManager"; +import { PathRewriteRules } from "../repositoryConnection/DigitalGardenSiteManager"; const REWRITE_RULE_DELIMITER = ":"; diff --git a/src/ui/DigitalGardenSettingTab.ts b/src/views/DigitalGardenSettingTab.ts similarity index 88% rename from src/ui/DigitalGardenSettingTab.ts rename to src/views/DigitalGardenSettingTab.ts index cb78758b..8442f33b 100644 --- a/src/ui/DigitalGardenSettingTab.ts +++ b/src/views/DigitalGardenSettingTab.ts @@ -1,10 +1,10 @@ import { PluginSettingTab, App, ButtonComponent } from "obsidian"; import DigitalGarden from "../../main"; -import DigitalGardenSiteManager from "src/publisher/DigitalGardenSiteManager"; +import DigitalGardenSiteManager from "src/repositoryConnection/DigitalGardenSiteManager"; import SettingView from "./SettingsView/SettingView"; -import { UpdateGardenRepositoryModal } from "./SettingsModal"; +import { UpdateGardenRepositoryModal } from "./UpdateGardenRepositoryModal"; import Logger from "js-logger"; -import { TemplateUpdater } from "../publisher/TemplateManager"; +import { TemplateUpdater } from "../repositoryConnection/TemplateManager"; export class DigitalGardenSettingTab extends PluginSettingTab { plugin: DigitalGarden; diff --git a/src/ui/DiffView.svelte b/src/views/PublicationCenter/DiffView.svelte similarity index 100% rename from src/ui/DiffView.svelte rename to src/views/PublicationCenter/DiffView.svelte diff --git a/src/ui/PublicationCenter.svelte b/src/views/PublicationCenter/PublicationCenter.svelte similarity index 98% rename from src/ui/PublicationCenter.svelte rename to src/views/PublicationCenter/PublicationCenter.svelte index 7ddec413..7857deac 100644 --- a/src/ui/PublicationCenter.svelte +++ b/src/views/PublicationCenter/PublicationCenter.svelte @@ -1,14 +1,14 @@