Compare commits

...

6 Commits

Author SHA1 Message Date
Elio Struyf
6f6015cf83 Merge branch 'main' of github.com:estruyf/vscode-front-matter 2024-03-01 10:33:18 +01:00
Elio Struyf
afd2878428 #769 - Fix settings on install 2024-03-01 10:33:13 +01:00
Elio Struyf
c66deb032c Merge pull request #770 from estruyf/patch-10.0.2
Patch 10.0.2
2024-03-01 10:05:04 +01:00
Elio Struyf
4c079b3e9d 10.0.2 2024-03-01 09:01:46 +01:00
Elio Struyf
03c2cd31d7 Update changelog 2024-03-01 09:01:38 +01:00
Elio Struyf
d1dba01923 #769 - Fix folder update 2024-03-01 09:00:42 +01:00
6 changed files with 55 additions and 5 deletions

View File

@@ -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

4
package-lock.json generated
View File

@@ -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"

View File

@@ -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": {

View File

@@ -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;

View File

@@ -10,7 +10,7 @@ import {
DiagnosticCollection,
languages
} from 'vscode';
import { Folders } from '../commands/Folders';
import { Folders, WORKSPACE_PLACEHOLDER } from '../commands/Folders';
import { Template } from '../commands/Template';
import {
EXTENSION_NAME,
@@ -30,6 +30,7 @@ import { TaxonomyHelper } from './TaxonomyHelper';
import { Cache } from '../commands/Cache';
import * as l10n from '@vscode/l10n';
import { LocalizationKey } from '../localization';
import { parseWinPath } from './parseWinPath';
export class Extension {
private static instance: Extension;
@@ -243,6 +244,31 @@ export class Extension {
}
}
if (major === 10 && minor === 0 && patch < 2) {
let folders = Settings.get<ContentFolder[]>(SETTING_CONTENT_PAGE_FOLDERS) || [];
folders = folders
.filter((f) => !f.locale || f.locale === f.defaultLocale)
.map((f) => {
delete f.locale;
delete f.localeTitle;
if (f.localeSourcePath) {
const wsFolder = Folders.getWorkspaceFolder();
if (wsFolder) {
const localPath = parseWinPath(f.localeSourcePath).replace(
parseWinPath(wsFolder.fsPath),
WORKSPACE_PLACEHOLDER
);
f.path = localPath;
}
delete f.localeSourcePath;
}
return f;
});
await Settings.update(SETTING_CONTENT_PAGE_FOLDERS, folders, true);
}
// The tags and categories settings need to be moved to the database
const tags = Settings.get<string[]>(SETTING_TAXONOMY_TAGS) || [];
const categories = Settings.get<string[]>(SETTING_TAXONOMY_CATEGORIES) || [];

View File

@@ -17,5 +17,5 @@ export interface ContentFolder {
localeTitle?: string;
localeSourcePath?: string;
defaultLocale?: string;
locales: I18nConfig[];
locales?: I18nConfig[];
}