Skip to content

Commit

Permalink
Merge pull request #770 from estruyf/patch-10.0.2
Browse files Browse the repository at this point in the history
Patch 10.0.2
  • Loading branch information
estruyf authored Mar 1, 2024
2 parents 286ac4a + 4c079b3 commit c66deb0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions src/commands/Folders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/models/ContentFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export interface ContentFolder {
localeTitle?: string;
localeSourcePath?: string;
defaultLocale?: string;
locales: I18nConfig[];
locales?: I18nConfig[];
}

0 comments on commit c66deb0

Please sign in to comment.