diff --git a/docs/components/Page/CTA.tsx b/docs/components/Page/CTA.tsx index fa115778..393b6612 100644 --- a/docs/components/Page/CTA.tsx +++ b/docs/components/Page/CTA.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import { useTranslation } from 'react-i18next'; import { Extension } from '../../constants/extension'; +import { isProduction } from '../../helpers/isProduction'; export interface ICTAProps {} @@ -23,8 +24,8 @@ export const CTA: React.FunctionComponent = (props: React.PropsWithCh
- - {strings(`cta_button_primary`)} + + {isProduction ? strings(`cta_button_primary`) : strings(`cta_button_beta_primary`)} {strings(`cta_button_secondary`)} diff --git a/docs/constants/extension.ts b/docs/constants/extension.ts index 86f87952..587f90c3 100644 --- a/docs/constants/extension.ts +++ b/docs/constants/extension.ts @@ -7,8 +7,10 @@ export const Extension = { issueLink: "https://github.com/estruyf/vscode-front-matter/issues", sponsorLink: "https://github.com/sponsors/estruyf", extensionLink: "https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter", + extensionBetaLink: "https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter-beta", reviewLink: "https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter&ssr=false#review-details", installLink: "vscode:extension/eliostruyf.vscode-front-matter", + installBetaLink: "vscode:extension/eliostruyf.vscode-front-matter-beta", showcaseLink: "https://github.com/estruyf/vscode-front-matter/issues/new?assignees=&labels=&template=showcase.md&title=Showcase%3A+", featureLink: "https://github.com/estruyf/vscode-front-matter/issues/new?assignees=&labels=&template=feature_request.md&title=Enhancement%3A+" } \ No newline at end of file diff --git a/docs/content/docs/getting-started.md b/docs/content/docs/getting-started.md index 3e2e12d9..e3788693 100644 --- a/docs/content/docs/getting-started.md +++ b/docs/content/docs/getting-started.md @@ -11,12 +11,22 @@ weight: 2 To get you started, you first need to install the extension in Visual Studio Code. +## Installation + You can get the extension via: - The VS Code marketplace: [VS Code Marketplace - Front Matter](https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter). - The extension CLI: `ext install eliostruyf.vscode-front-matter` - Or by clicking on the following link: open extension in VS Code +### Beta version + +If you have the courage to test out the beta features, we made available a beta version as well. You can install this via: + +- The VS Code marketplace: [VS Code Marketplace - Front Matter BETA](https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter-beta). +- The extension CLI: `ext install eliostruyf.vscode-front-matter-beta` +- Or by clicking on the following link: open extension in VS Code + ## Welcome screen Once installed, Front Matter will open the **welcome screen** the first time Visual Studio Code gets reloaded. diff --git a/docs/helpers/isProduction.ts b/docs/helpers/isProduction.ts new file mode 100644 index 00000000..c04ae2bb --- /dev/null +++ b/docs/helpers/isProduction.ts @@ -0,0 +1,3 @@ + + +export const isProduction = process.env.NODE_ENV === 'production'; \ No newline at end of file diff --git a/docs/locale/en.ts b/docs/locale/en.ts index ba708595..069aae94 100644 --- a/docs/locale/en.ts +++ b/docs/locale/en.ts @@ -7,6 +7,7 @@ export const strings = { cta_title_sr: " that helps managing your static sites and Markdown based sites. Supports Hugo, Jekyll, Docusaurus, NextJs, Gatsby, and more.", cta_description: "Why leave your editor if it can give you all power to manage your static sites? Front Matter is a headless CMS that lets you create, edit, and preview your Markdown based content straight within Visual Studio Code.", cta_button_primary: "Get the extension", + cta_button_beta_primary: "Get the BETA extension", cta_button_secondary: "Read our docs", // Generators diff --git a/src/constants/Extension.ts b/src/constants/Extension.ts index 3fbb60cb..21a6e1ba 100644 --- a/src/constants/Extension.ts +++ b/src/constants/Extension.ts @@ -1,6 +1,7 @@ const extensionName = "frontMatter"; export const EXTENSION_ID = 'eliostruyf.vscode-front-matter'; +export const EXTENSION_BETA_ID = 'eliostruyf.vscode-front-matter-beta'; export const EXTENSION_STATE_VERSION = 'frontMatter:Version'; export const EXTENSION_STATE_PAGES_VIEW = 'frontMatter:Pages:ViewType'; diff --git a/src/extension.ts b/src/extension.ts index 8a96076d..822af9bd 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -5,12 +5,14 @@ import { Folders } from './commands/Folders'; import { Preview } from './commands/Preview'; import { Project } from './commands/Project'; import { Template } from './commands/Template'; -import { COMMAND_NAME } from './constants/Extension'; +import { COMMAND_NAME, EXTENSION_BETA_ID, EXTENSION_ID } from './constants/Extension'; import { TaxonomyType } from './models'; import { MarkdownFoldingProvider } from './providers/MarkdownFoldingProvider'; import { TagType } from './viewpanel/TagType'; import { ExplorerView } from './webview/ExplorerView'; import { Extension } from './helpers/Extension'; +import { basename } from 'path'; +import { Notifications } from './helpers/Notifications'; let frontMatterStatusBar: vscode.StatusBarItem; let statusDebouncer: { (fnc: any, time: number): void; }; @@ -19,7 +21,18 @@ let collection: vscode.DiagnosticCollection; const mdSelector: vscode.DocumentSelector = { language: 'markdown', scheme: 'file' }; -export async function activate({ subscriptions, extensionUri, extensionPath, globalState }: vscode.ExtensionContext) { +export async function activate({ subscriptions, extensionUri, extensionPath, globalState, globalStorageUri }: vscode.ExtensionContext) { + + // Check if Front Matter is extension is installed + if (basename(globalStorageUri.fsPath) === EXTENSION_BETA_ID) { + const mainVersion = vscode.extensions.getExtension(EXTENSION_ID); + + if (!mainVersion) { + Notifications.error(`Front Matter BETA cannot be used while the main version is installed. Please ensure that you have only over version installed.`); + return undefined; + } + } + const extension = Extension.getInstance(globalState, extensionUri); extension.migrateSettings()