Skip to content

Commit

Permalink
Merge pull request #477 from estruyf/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf authored Dec 8, 2022
2 parents cf2d170 + 4b1d80f commit a12cf70
Show file tree
Hide file tree
Showing 86 changed files with 1,925 additions and 620 deletions.
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Change Log

## [8.2.0] - 2022-12-08 - [Release notes](https://beta.frontmatter.codes/updates/v8.2.0)

### ✨ New features

- [#362](https://github.com/estruyf/vscode-front-matter/issues/362): Support for conditional metadata
- [#412](https://github.com/estruyf/vscode-front-matter/issues/412): Allow `frontmatter.json` to be split in multiple files

### 🎨 Enhancements

- [#360](https://github.com/estruyf/vscode-front-matter/issues/360): Define which content types can be used on your page folders
- [#406](https://github.com/estruyf/vscode-front-matter/issues/406): Added support for single data entries in the data dashboard
- [#428](https://github.com/estruyf/vscode-front-matter/issues/428): Improved UX for inserting images to your content
- [#430](https://github.com/estruyf/vscode-front-matter/issues/430): Support for HEXO its `post_asset_folder` setting (image location)
- [#434](https://github.com/estruyf/vscode-front-matter/issues/434): Webview errors are logged in the extension output
- [#440](https://github.com/estruyf/vscode-front-matter/issues/440): Type to search/filter in the snippets dashboard
- [#447](https://github.com/estruyf/vscode-front-matter/issues/447): Allow to use placeholders on git commit messages
- [#449](https://github.com/estruyf/vscode-front-matter/issues/449): Show `filename` if the `title` is not set
- [#450](https://github.com/estruyf/vscode-front-matter/issues/450): Additional time placeholders added `{{hour12}}`, `{{hour24}}`, `{{ampm}}`, and `{{minute}}`
- [#458](https://github.com/estruyf/vscode-front-matter/issues/458): Ability to configure the file prefix on folder level

### ⚡️ Optimizations

- [#431](https://github.com/estruyf/vscode-front-matter/issues/431): Performance improvements for the content dashboard
- [#448](https://github.com/estruyf/vscode-front-matter/issues/448): Retrieving files fails when content folder name and workspace folder name are the same
- [#455](https://github.com/estruyf/vscode-front-matter/issues/455): Show a description for the SEO section when title nor description is set

### 🐞 Fixes

- Fix field error message color
- [#433](https://github.com/estruyf/vscode-front-matter/issues/433): Fix issue with rendering an incorrect title value on the content dashboard
- [#462](https://github.com/estruyf/vscode-front-matter/issues/462): Fix issue in script error notification
- [#465](https://github.com/estruyf/vscode-front-matter/issues/465): Deleted content does not get added in git when syncing
- [#471](https://github.com/estruyf/vscode-front-matter/issues/471): Fix typo on data dashboard

## [8.1.2] - 2022-10-06

### 🐞 Fixes
Expand Down
4 changes: 2 additions & 2 deletions README.beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,6 @@ You can open showcase issues for the following things:

<p align="center">
<a href="https://visitorbadge.io">
<img src="https://estruyf-github.azurewebsites.net/api/VisitorHit?user=estruyf&repo=vscode-front-matter&countColor=%23F05450&labelColor=%230E131F" height="25px" />
</a>
<img src="https://api.visitorbadge.io/api/VisitorHit?user=estruyf&repo=vscode-front-matter&countColor=%23F05450&labelColor=%230E131F" height="25px" />
</a>
</p>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,6 @@ You can open showcase issues for the following things:

<p align="center">
<a href="https://visitorbadge.io">
<img src="https://estruyf-github.azurewebsites.net/api/VisitorHit?user=estruyf&repo=vscode-front-matter&countColor=%23F05450&labelColor=%230E131F" height="25px" />
<img src="https://api.visitorbadge.io/api/VisitorHit?user=estruyf&repo=vscode-front-matter&countColor=%23F05450&labelColor=%230E131F" height="25px" />
</a>
</p>
2 changes: 0 additions & 2 deletions e2e/src/command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ describe("Initialization testing", function() {

async function notificationExists(workbench: Workbench, text: string): Promise<Notification | undefined> {
const notifications = await (await (new StatusBar()).openNotificationsCenter()).getNotifications(NotificationType.Info);
console.log(`Notifications:`, notifications.length);

for (const notification of notifications) {
const message = await notification.getMessage();
console.log(message)
if (message.indexOf(text) >= 0) {
return notification;
}
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.

84 changes: 79 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "vscode-front-matter-beta",
"displayName": "Front Matter",
"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, Hexo, NextJs, Gatsby, and many more...",
"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": "8.1.2",
"version": "8.2.0",
"preview": false,
"publisher": "eliostruyf",
"galleryBanner": {
Expand Down Expand Up @@ -206,6 +206,17 @@
],
"default": null,
"description": "Defines a custom preview path for the folder."
},
"filePrefix": {
"type": [ "null", "string" ],
"description": "Defines a prefix for the file name."
},
"contentTypes": {
"type": "array",
"description": "Defines which content types can be used for the current location. If not defined, all content types will be available.",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -271,6 +282,10 @@
"type": "string"
}
},
"title": {
"description": "The snippet title.",
"type": "string"
},
"description": {
"description": "The snippet description.",
"type": "string"
Expand Down Expand Up @@ -447,9 +462,9 @@
"scope": "Custom scripts"
},
"frontMatter.dashboard.content.pagination": {
"type": "boolean",
"type": ["boolean", "number"],
"default": true,
"markdownDescription": "Specify if you want to enable/disable pagination for your content. [Check in the docs](https://frontmatter.codes/docs/settings#frontmatter.dashboard.content.pagination)",
"markdownDescription": "Specify if you want to enable/disable pagination for your content. You can define your page number up to 52. Default items per page is `16`. Disabling the pagination can be done by setting it to `false`. [Check in the docs](https://frontmatter.codes/docs/settings#frontmatter.dashboard.content.pagination)",
"scope": "Dashboard"
},
"frontMatter.dashboard.content.cardTags": {
Expand Down Expand Up @@ -550,6 +565,11 @@
"type": "string",
"default": "content",
"description": "If you are using data types, you can specify your type ID."
},
"singleEntry": {
"type": "boolean",
"description": "If you want to use a single entry for your data file.",
"default": false
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -601,6 +621,11 @@
"type": "string",
"default": "content",
"description": "If you are using data types, you can specify your type ID."
},
"singleEntry": {
"type": "boolean",
"description": "If you want to use a single entry for your data files in the folder.",
"default": false
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -1039,6 +1064,50 @@
"type": "boolean",
"default": false,
"description": "Specify if the field is required"
},
"when": {
"type": "object",
"description": "Specify the conditions to show the field",
"properties": {
"fieldRef": {
"type": "string",
"description": "The field ID to use"
},
"operator": {
"type": "string",
"description": "The operator to use",
"enum": [
"eq",
"neq",
"contains",
"notContains",
"startsWith",
"endsWith",
"gt",
"gte",
"lt",
"lte",
"minimum",
"maximum",
"exlusiveMinimum",
"exclusiveMaximum"
]
},
"value": {
"type": [
"string",
"number",
"boolean",
"array"
],
"description": "The value to compare"
},
"caseSensitive": {
"type": "boolean",
"default": true,
"description": "Specify if the comparison is case sensitive. Default: true"
}
}
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -1732,6 +1801,11 @@
"command": "frontMatter.git.sync",
"title": "Sync",
"category": "Front Matter"
},
{
"command": "frontMatter.cache.clear",
"title": "Clear cache",
"category": "Front Matter"
}
],
"menus": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/beta-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const version = packageJson.version.split('.');
packageJson.version = `${version[0]}.${version[1]}.${process.argv[process.argv.length-1].substr(0, 7)}`;
packageJson.preview = true;
packageJson.name = "vscode-front-matter-beta";
packageJson.displayName = `${packageJson.displayName} BETA`;
packageJson.displayName = `${packageJson.displayName} (BETA)`;
packageJson.description = `BETA Version of Front Matter. ${packageJson.description}`;
packageJson.icon = "assets/frontmatter-beta.png";
packageJson.homepage = "https://beta.frontmatter.codes";
Expand Down
8 changes: 7 additions & 1 deletion src/commands/Article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class Article {
Telemetry.send(TelemetryEvent.generateSlug);

const updateFileName = Settings.get(SETTING_SLUG_UPDATE_FILE_NAME) as string;
const filePrefix = Settings.get<string>(SETTING_TEMPLATES_PREFIX);
let filePrefix = Settings.get<string>(SETTING_TEMPLATES_PREFIX);
const editor = vscode.window.activeTextEditor;

if (!editor) {
Expand All @@ -210,6 +210,12 @@ export class Article {
return;
}

// Retrieve the file prefix from the folder
const filePrefixOnFolder = Folders.getFilePrefixBeFilePath(editor.document.uri.fsPath);
if (typeof filePrefixOnFolder !== "undefined") {
filePrefix = filePrefixOnFolder;
}

const contentType = ArticleHelper.getContentType(article.data);
const titleField = "title";
const articleTitle: string = article.data[titleField];
Expand Down
24 changes: 24 additions & 0 deletions src/commands/Cache.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { commands } from "vscode";
import { COMMAND_NAME, ExtensionState } from "../constants";
import { Extension, Notifications } from "../helpers";

export class Cache {

public static async registerCommands() {
const ext = Extension.getInstance();
const subscriptions = ext.subscriptions;

subscriptions.push(
commands.registerCommand(COMMAND_NAME.clearCache, Cache.clear)
);
}

private static async clear() {
const ext = Extension.getInstance();

await ext.setState(ExtensionState.Dashboard.Pages.Cache, undefined, "workspace");
await ext.setState(ExtensionState.Dashboard.Pages.Index, undefined, "workspace");

Notifications.info("Cache cleared");
}
}
7 changes: 4 additions & 3 deletions src/commands/Dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Extension } from '../helpers/Extension';
import { WebviewHelper } from '@estruyf/vscode';
import { DashboardData } from '../models/DashboardData';
import { MediaLibrary } from '../helpers/MediaLibrary';
import { DashboardListener, MediaListener, SettingsListener, TelemetryListener, DataListener, PagesListener, ExtensionListener, SnippetListener, TaxonomyListener } from '../listeners/dashboard';
import { DashboardListener, MediaListener, SettingsListener, TelemetryListener, DataListener, PagesListener, ExtensionListener, SnippetListener, TaxonomyListener, LogListener } from '../listeners/dashboard';
import { MediaListener as PanelMediaListener } from '../listeners/panel'
import { GitListener, ModeListener } from '../listeners/general';

Expand Down Expand Up @@ -130,8 +130,8 @@ export class Dashboard {
await commands.executeCommand('setContext', CONTEXT.isDashboardOpen, false);
});

SettingsHelper.onConfigChange((global?: any) => {
SettingsListener.getSettings();
SettingsHelper.onConfigChange(() => {
SettingsListener.getSettings(true);
});

Dashboard.webview.webview.onDidReceiveMessage(async (msg) => {
Expand All @@ -148,6 +148,7 @@ export class Dashboard {
ModeListener.process(msg);
GitListener.process(msg);
TaxonomyListener.process(msg);
LogListener.process(msg);
});
}

Expand Down
7 changes: 7 additions & 0 deletions src/commands/Diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ViewColumn, workspace } from "vscode";
import ContentProvider from "../providers/ContentProvider";
import { join } from "path";
import { ContentFolder } from "../models";
import { Settings } from "../helpers/SettingsHelper";


export class Diagnostics {
Expand Down Expand Up @@ -38,6 +39,12 @@ ${all}
# Folders to search files
${folderData.join("\n")}
# Complete frontmatter.json config
\`\`\`json
${JSON.stringify(Settings.globalConfig, null, 2)}
\`\`\`
`;

ContentProvider.show(logging, `${projectName} diagnostics`, "markdown", ViewColumn.One);
Expand Down
Loading

0 comments on commit a12cf70

Please sign in to comment.