Skip to content

Commit

Permalink
fix(local-test): fix all files deleting if the test folder is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Jan 13, 2025
1 parent 6d0f770 commit 62efe9b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/GitHub/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ export default class Publisher {
properties.frontmatter.prop
);
if (this.settings.github.dryRun.enable) {
const folderName = this.settings.github.dryRun.folderName
const originalFolderName = this.settings.github.dryRun.folderName.trim().length > 0 ? this.settings.github.dryRun.folderName : "enveloppe";
const folderName = originalFolderName
.replace("{{repo}}", prop.repo)
.replace("{{branch}}", prop.branch)
.replace("{{owner}}", prop.owner);
Expand Down
12 changes: 10 additions & 2 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,24 @@ export class EnveloppeSettingsTab extends PluginSettingTab {
})
);

const defaultFolderName = githubSettings.dryRun.folderName.trim().length > 0 ? githubSettings.dryRun.folderName :"enveloppe";

new Setting(this.settingsPage)
.setName(i18next.t("settings.github.dryRun.folder.title"))
.setDesc(i18next.t("settings.github.dryRun.folder.desc"))
.addText((text) =>
text
.setPlaceholder("enveloppe")
.setValue(githubSettings.dryRun.folderName)
.setValue(defaultFolderName)
.onChange(async (value) => {
githubSettings.dryRun.folderName = value.trim();
await this.plugin.saveSettings();
if (value.trim().length === 0) {
new Notice(i18next.t("settings.github.dryRun.folder.error"));
text.inputEl.addClass("error");
} else {
text.inputEl.removeClass("error");
await this.plugin.saveSettings();
}
})
);

Expand Down
8 changes: 7 additions & 1 deletion src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ span.enveloppe.icons {
border-left: 3px solid var(--color-orange);
padding-left: 5px;
}

.enveloppe input.error,
.enveloppe .error input {
border: 1px solid var(--text-error);
}
Expand All @@ -376,6 +376,12 @@ span.enveloppe.icons {
width: 100%;
}

.enveloppe input.error:active,
.enveloppe input.error:focus {
border: 2px solid var(--text-error);
box-shadow: none !important;
}

.enveloppe .display-none .setting-item-info {
display: none;
}
Expand Down

0 comments on commit 62efe9b

Please sign in to comment.