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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor: update purge commands in index.ts
Mara-Li committed May 12, 2024
commit b05f02fca5163a5f7b9e827a2ddec7f040bd1113
6 changes: 3 additions & 3 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createLinkCallback, createLinkOnActiveFile } from "./create_link";
import { deleteCommands, purgeNotesRemoteCallback } from "./purge";
import { purgeCallback,purgeForRepo } from "./purge";
import { checkRepositoryValidityCallback, repositoryValidityActiveFile } from "./repository_validity";
import { refreshAllSets, refreshOpenedSet } from "./set";
import { uploadAllNotes, uploadAllNotesCallback } from "./share/all_notes";
@@ -11,8 +11,8 @@ export {
checkRepositoryValidityCallback,
createLinkCallback,
createLinkOnActiveFile,
deleteCommands,
purgeNotesRemoteCallback,
purgeForRepo as deleteCommands,
purgeCallback as purgeNotesRemoteCallback,
refreshAllSets,
refreshOpenedSet,
repositoryValidityActiveFile,
10 changes: 5 additions & 5 deletions src/commands/purge.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ import { frontmatterSettingsRepository,getProperties } from "../utils/parse_fron
* @param {string} branchName - The branch name to delete the file
* @return {Promise<Command>}
*/
export async function purgeNotesRemoteCallback(plugin: GithubPublisher, repo: Repository | null, branchName: string): Promise<Command> {
export async function purgeCallback(plugin: GithubPublisher, repo: Repository | null, branchName: string): Promise<Command> {
Mara-Li marked this conversation as resolved.
Show resolved Hide resolved
const id = repo ? `delete-clean-K${repo.smartKey}` : "delete-clean";
let name = i18next.t("commands.publisherDeleteClean");
const common = i18next.t("common.repository");
@@ -35,7 +35,7 @@ export async function purgeNotesRemoteCallback(plugin: GithubPublisher, repo: Re
convert: frontmatterSettingsRepository(plugin, repo)
};
const publisher = await plugin.reloadOctokit(repo?.smartKey);
await purgeNotesRemote(
await purge(
publisher,
branchName,
monoRepo
@@ -51,7 +51,7 @@ export async function purgeNotesRemoteCallback(plugin: GithubPublisher, repo: Re
* @param {MonoRepoProperties} monoRepo - The repo where to delete the files
* @returns {Promise<void>}
*/
export async function purgeNotesRemote(
async function purge(
PublisherManager: GithubBranch,
branchName: string,
monoRepo: MonoRepoProperties,
@@ -87,15 +87,15 @@ export async function purgeNotesRemote(
* @param {string} branchName
* @return {Promise<void>}
*/
export async function deleteCommands(plugin : GithubPublisher, repo: Repository | null, branchName: string): Promise<void> {
export async function purgeForRepo(plugin : GithubPublisher, repo: Repository | null, branchName: string): Promise<void> {
const prop = getProperties(plugin, repo, null, true);
const publisher = await plugin.reloadOctokit(repo?.smartKey);
const mono: MonoRepoProperties = {
frontmatter: Array.isArray(prop) ? prop[0] : prop,
repository: repo,
convert: frontmatterSettingsRepository(plugin, repo)
};
await purgeNotesRemote(
await purge(
publisher,
branchName,
mono