From d1dba01923fdc162ba9be6cbef644cdf8733fc2e Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Fri, 1 Mar 2024 09:00:42 +0100 Subject: [PATCH 1/3] #769 - Fix folder update --- src/commands/Folders.ts | 18 ++++++++++++++++++ src/models/ContentFolder.ts | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/commands/Folders.ts b/src/commands/Folders.ts index 21b3410a..4493374d 100644 --- a/src/commands/Folders.ts +++ b/src/commands/Folders.ts @@ -405,8 +405,13 @@ export class Folders { * @param folders */ public static async update(folders: ContentFolder[]) { + const originalFolders = Settings.get(SETTING_CONTENT_PAGE_FOLDERS) as ContentFolder[]; const wsFolder = Folders.getWorkspaceFolder(); + // Filter out the locale folders + folders = folders.filter((folder) => !folder.locale || folder.locale === folder.defaultLocale); + + // Remove the internal FM properties const folderDetails = folders .map((folder) => { const detail = { @@ -418,6 +423,19 @@ export class Folders { return null; } + if (detail.locale && detail.locale === detail.defaultLocale) { + // Check if the folder was on the original list + const originalFolder = originalFolders.find((f) => f.path === folder.originalPath); + + if (originalFolder && !originalFolder.locales && folder.locales) { + delete detail.locales; + } + + delete detail.localeSourcePath; + delete detail.localeTitle; + } + + delete detail.locale; delete detail.originalPath; return detail; diff --git a/src/models/ContentFolder.ts b/src/models/ContentFolder.ts index 646fe5e0..66bb39d9 100644 --- a/src/models/ContentFolder.ts +++ b/src/models/ContentFolder.ts @@ -17,5 +17,5 @@ export interface ContentFolder { localeTitle?: string; localeSourcePath?: string; defaultLocale?: string; - locales: I18nConfig[]; + locales?: I18nConfig[]; } From 03c2cd31d7f2df59716e7aec5dd2019fc4317d13 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Fri, 1 Mar 2024 09:01:38 +0100 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8aa616b..4f62c853 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## [10.0.2] - 2024-03-01 + +### 🐞 Fixes + +- [#769](https://github.com/estruyf/vscode-front-matter/issues/769): Fix to remove internal properties for content folders + ## [10.0.1] - 2024-02-28 ### 🐞 Fixes From 4c079b3e9d22f6a278ffdf2823a599d5cc3c95d2 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Fri, 1 Mar 2024 09:01:46 +0100 Subject: [PATCH 3/3] 10.0.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a7a7b841..0cc40e9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-front-matter-beta", - "version": "10.0.1", + "version": "10.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vscode-front-matter-beta", - "version": "10.0.1", + "version": "10.0.2", "license": "MIT", "dependencies": { "@radix-ui/react-dropdown-menu": "^2.0.6" diff --git a/package.json b/package.json index 9083c192..78a5510a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Front Matter CMS", "description": "Front Matter is a CMS that runs within Visual Studio Code. It gives you the power and control of a full-blown CMS while also providing you the flexibility and speed of the static site generator of your choice like: Hugo, Jekyll, Docusaurus, NextJs, Gatsby, and many more...", "icon": "assets/frontmatter-teal-128x128.png", - "version": "10.0.1", + "version": "10.0.2", "preview": false, "publisher": "eliostruyf", "galleryBanner": {