Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: refactor commands files, relative imports and import paths #345

Merged
merged 19 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/@types/i18next.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resources } from "../i18n/i18next";
import { resources } from "src/i18n/i18next";

declare module "i18next" {
interface CustomTypeOptions {
Expand Down
13 changes: 6 additions & 7 deletions src/GitHub/branch.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {
Properties,
} from "@interfaces/main";
import { Octokit } from "@octokit/core";
import i18next from "i18next";
import {Notice } from "obsidian";

import {
Properties,
} from "../interfaces/main";
import GithubPublisher from "../main";
import { logs, notif } from "../utils";
import { FilesManagement } from "./files";
import { FilesManagement } from "src/GitHub/files";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more detailed logging in newBranch to provide better insights into the branch creation process.


Improve error handling in newBranchOnRepo by providing more specific messages based on the error type.


Improve error handling in pullRequestOnRepo to specifically address potential GitHub API errors for more robust operation.


Add more detailed logging in mergePullRequestOnRepo to provide better insights into the merging process.

import GithubPublisher from "src/main";
import { logs, notif } from "src/utils";


export class GithubBranch extends FilesManagement {
Expand Down
19 changes: 9 additions & 10 deletions src/GitHub/delete.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { Octokit } from "@octokit/core";
import i18next from "i18next";
import { Base64 } from "js-base64";
import { MetadataCache, normalizePath, Notice, parseYaml, TAbstractFile, TFile, TFolder, Vault } from "obsidian";

import {
Deleted,
FIND_REGEX,
Expand All @@ -11,11 +6,15 @@ import {
GithubRepo,
MonoRepoProperties,
Properties,
} from "../interfaces";
import { logs, notif, trimObject} from "../utils";
import {isAttachment, verifyRateLimitAPI} from "../utils/data_validation_test";
import { frontmatterSettingsRepository } from "../utils/parse_frontmatter";
import { FilesManagement } from "./files";
} from "@interfaces";
import { Octokit } from "@octokit/core";
import i18next from "i18next";
import { Base64 } from "js-base64";
import { MetadataCache, normalizePath, Notice, parseYaml, TAbstractFile, TFile, TFolder, Vault } from "obsidian";
import { FilesManagement } from "src/GitHub/files";
import { logs, notif, trimObject} from "src/utils";
import {isAttachment, verifyRateLimitAPI} from "src/utils/data_validation_test";
import { frontmatterSettingsRepository } from "src/utils/parse_frontmatter";

/**
* Delete file from github, based on a list of file in the original vault
Expand Down
27 changes: 13 additions & 14 deletions src/GitHub/files.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import { Octokit } from "@octokit/core";
import { EmbedCache, LinkCache, TFile, TFolder} from "obsidian";
import { getAPI, Link } from "obsidian-dataview";

import {
getImagePath,
getReceiptFolder,
} from "../conversion/file_path";
import {
ConvertedLink,
GithubRepo,
LinkedNotes,
Properties,
PropertiesConversion,
Repository,
} from "../interfaces/main";
import GithubPublisher from "../main";
import {logs} from "../utils";
import { isAttachment, isShared } from "../utils/data_validation_test";
import { frontmatterFromFile, getFrontmatterSettings, getProperties } from "../utils/parse_frontmatter";
import Publisher from "./upload";
} from "@interfaces/main";
import { Octokit } from "@octokit/core";
import { EmbedCache, LinkCache, TFile, TFolder} from "obsidian";
import { getAPI, Link } from "obsidian-dataview";
import {
getImagePath,
getReceiptFolder,
} from "src/conversion/file_path";
import Publisher from "src/GitHub/upload";
import GithubPublisher from "src/main";
import {logs} from "src/utils";
import { isAttachment, isShared } from "src/utils/data_validation_test";
import { frontmatterFromFile, getFrontmatterSettings, getProperties } from "src/utils/parse_frontmatter";

export class FilesManagement extends Publisher {

Expand Down
43 changes: 21 additions & 22 deletions src/GitHub/upload.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import {
Deleted,
GitHubPublisherSettings,
MetadataExtractor, MonoProperties,
MonoRepoProperties,
MultiProperties,
MultiRepoProperties,
Properties, UploadedFiles,
} from "@interfaces";
import { LOADING_ICON } from "@interfaces/icons";
import { Octokit } from "@octokit/core";
import i18next from "i18next";
import { Base64 } from "js-base64";
Expand All @@ -11,42 +21,31 @@ import {
TFolder,
Vault,
} from "obsidian";
import merge from "ts-deepmerge";

import { mainConverting } from "../conversion";
import { convertToHTMLSVG } from "../conversion/compiler/excalidraw";
import { mainConverting } from "src/conversion";
import { convertToHTMLSVG } from "src/conversion/compiler/excalidraw";
import {
getImagePath,
getReceiptFolder,
} from "../conversion/file_path";
import {
Deleted,
GitHubPublisherSettings,
MetadataExtractor, MonoProperties,
MonoRepoProperties,
MultiProperties,
MultiRepoProperties,
Properties, UploadedFiles,
} from "../interfaces";
import GithubPublisher from "../main";
} from "src/conversion/file_path";
import { deleteFromGithub } from "src/GitHub/delete";
import { FilesManagement } from "src/GitHub/files";
import GithubPublisher from "src/main";
import {
logs,
noticeMobile,
notif,
notifError,
} from "../utils";
} from "src/utils";
import {
checkEmptyConfiguration,
checkIfRepoIsInAnother,
forcePushAttachment,
isAttachment,
isShared,
} from "../utils/data_validation_test";
import { LOADING_ICON } from "../utils/icons";
import { frontmatterFromFile, frontmatterSettingsRepository, getFrontmatterSettings, getProperties } from "../utils/parse_frontmatter";
import { ShareStatusBar } from "../utils/status_bar";
import { deleteFromGithub } from "./delete";
import { FilesManagement } from "./files";
} from "src/utils/data_validation_test";
import { frontmatterFromFile, frontmatterSettingsRepository, getFrontmatterSettings, getProperties } from "src/utils/parse_frontmatter";
import { ShareStatusBar } from "src/utils/status_bar";
import merge from "ts-deepmerge";
Mara-Li marked this conversation as resolved.
Show resolved Hide resolved

/** Class to manage the branch
* @extends FilesManagement
Expand Down
Loading
Loading