Skip to content

Commit

Permalink
filetree: move files into better modules
Browse files Browse the repository at this point in the history
  • Loading branch information
julesvirallinen committed Oct 2, 2023
1 parent c6699f5 commit 68a37ae
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 33 deletions.
12 changes: 6 additions & 6 deletions main.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -506,7 +506,7 @@ export default class DigitalGarden extends Plugin {
publisher,
);

this.publishModal = new PublishModal(
this.publishModal = new PublicationCenter(
this.app,
publishStatusManager,
publisher,
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/FrontmatterCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown> & {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/GardenPageCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/publisher/PublishStatusManager.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
4 changes: 2 additions & 2 deletions src/publisher/Publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getRewriteRules,
wrapAround,
} from "../utils/utils";
import { PathRewriteRules } from "../publisher/DigitalGardenSiteManager";
import { PathRewriteRules } from "../repositoryConnection/DigitalGardenSiteManager";

describe("utils", () => {
describe("getGardenPathForNote", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -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 = ":";

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts">
import { getIcon } from "obsidian";
import TreeNode from "../models/TreeNode";
import TreeNode from "../../models/TreeNode";
import {
IPublishStatusManager,
PublishStatus,
} from "../publisher/PublishStatusManager";
} from "../../publisher/PublishStatusManager";
import TreeView from "src/ui/TreeView/TreeView.svelte";
import { onMount } from "svelte";
import Publisher from "src/publisher/Publisher";
import Icon from "./Icon.svelte";
import Icon from "../../ui/Icon.svelte";
import { CompiledPublishFile } from "src/publishFile/PublishFile";
export let publishStatusManager: IPublishStatusManager;
export let publisher: Publisher;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { type App, Modal, getIcon, Vault, TFile } from "obsidian";
import Publisher from "../publisher/Publisher";
import PublishStatusManager from "../publisher/PublishStatusManager";
import DigitalGardenSettings from "../models/settings";
import PublicationCenter from "./PublicationCenter.svelte";
import DigitalGardenSettings from "../../models/settings";
import { PublishFile } from "../../publishFile/PublishFile";
import DigitalGardenSiteManager from "../../repositoryConnection/DigitalGardenSiteManager";
import PublishStatusManager from "../../publisher/PublishStatusManager";
import Publisher from "../../publisher/Publisher";
import PublicationCenterSvelte from "./PublicationCenter.svelte";
import DiffView from "./DiffView.svelte";
import DigitalGardenSiteManager from "src/publisher/DigitalGardenSiteManager";
import * as Diff from "diff";
import { PublishFile } from "../publishFile/PublishFile";

export class PublishModal {
export class PublicationCenter {
modal: Modal;
settings: DigitalGardenSettings;
publishStatusManager: PublishStatusManager;
publisher: Publisher;
siteManager: DigitalGardenSiteManager;
vault: Vault;

publicationCenterUi!: PublicationCenter;
publicationCenterUi!: PublicationCenterSvelte;

constructor(
app: App,
Expand Down Expand Up @@ -102,7 +102,7 @@ export class PublishModal {
this.modal.onOpen = () => {
this.modal.contentEl.empty();

this.publicationCenterUi = new PublicationCenter({
this.publicationCenterUi = new PublicationCenterSvelte({
target: this.modal.contentEl,
props: {
publishStatusManager: this.publishStatusManager,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { getGardenPathForNote, getRewriteRules } from "../../utils/utils";
import DigitalGardenSettings from "../../models/settings";
import { Change, diffLines } from "diff";
import LineDiff from "../LineDiff.svelte";
import LineDiff from "../../ui/LineDiff.svelte";
export let publisher: Publisher;
export let settings: DigitalGardenSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ import {
Setting,
TFile,
} from "obsidian";
import DigitalGardenSiteManager from "src/publisher/DigitalGardenSiteManager";
import DigitalGardenSiteManager from "src/repositoryConnection/DigitalGardenSiteManager";

import DigitalGardenSettings from "../../models/settings";
import Publisher from "../../publisher/Publisher";
import { arrayBufferToBase64 } from "../../utils/utils";
import { SvgFileSuggest } from "../suggest/file-suggest";
import { SvgFileSuggest } from "../../ui/suggest/file-suggest";
import { addFilterInput } from "./addFilterInput";
import { GithubSettings } from "./GithubSettings";
import RewriteSettings from "./RewriteSettings.svelte";
import { hasUpdates, TemplateUpdater } from "../../publisher/TemplateManager";
import {
hasUpdates,
TemplateUpdater,
} from "../../repositoryConnection/TemplateManager";
import Logger from "js-logger";

interface IObsidianTheme {
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 68a37ae

Please sign in to comment.