Beta schema

This commit is contained in:
Elio Struyf
2021-09-20 09:35:43 +02:00
parent d2161ff46c
commit b2e661d9e3
3 changed files with 14 additions and 4 deletions
+5 -2
View File
@@ -4,10 +4,13 @@ const path = require('path');
const pkgJson = require('../../package.json');
if (pkgJson?.contributes?.configuration) {
const idUrl = process.env.VERCEL_ENV === "preview" ? "https://beta.frontmatter.codes/frontmatter.schema.json" : "https://frontmatter.codes/frontmatter.schema.json";
const schema = {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://frontmatter.codes/frontmatter.schema.json",
...pkgJson.contributes.configuration
"$id": idUrl,
...pkgJson.contributes.configuration,
"title": "Front Matter - Team Settings"
}
fs.writeFileSync(path.join(path.resolve('.'), '/public/frontmatter.schema.json'), JSON.stringify(schema, null, 2));
+7 -1
View File
@@ -455,7 +455,13 @@ export class Dashboard {
* @param msg
*/
private static postWebviewMessage(msg: { command: DashboardCommand, data?: any }) {
Dashboard.webview?.webview.postMessage(msg);
if (Dashboard.isDisposed) {
return;
}
if (Dashboard.webview) {
Dashboard.webview?.webview.postMessage(msg);
}
}
/**
+2 -1
View File
@@ -5,13 +5,14 @@ import { SETTING_TAXONOMY_TAGS, SETTING_TAXONOMY_CATEGORIES, CONFIG_KEY } from '
import { Folders } from '../commands/Folders';
import { join, basename } from 'path';
import { existsSync, readFileSync, writeFileSync } from 'fs';
import { Extension } from './Extension';
export class Settings {
private static config: vscode.WorkspaceConfiguration;
private static globalFile = "frontmatter.json";
private static globalConfig: any;
private static initialConfig = {
"$schema": "https://frontmatter.codes/frontmatter.schema.json"
"$schema": `https://${Extension.getInstance().isBetaVersion() ? `beta.` : ``}frontmatter.codes/frontmatter.schema.json`
};
public static init() {