From 4ede312204f329eb260a813116a561ae9d6a577d Mon Sep 17 00:00:00 2001 From: Laura Coursen Date: Wed, 2 Feb 2022 14:25:05 -0600 Subject: [PATCH] Add early access docs for GEI-CLI (#24592) --- components/article/ToolPicker.tsx | 13 ++++++++++++- content/README.md | 2 +- contributing/content-markup-reference.md | 18 +++++++++++++++++- lib/frontmatter.js | 2 +- lib/liquid-tags/extended-markdown.js | 2 ++ lib/page.js | 13 ++++++++++--- lib/schema-event.js | 4 +++- 7 files changed, 46 insertions(+), 8 deletions(-) diff --git a/components/article/ToolPicker.tsx b/components/article/ToolPicker.tsx index 315a71e331..d5dc57d2da 100644 --- a/components/article/ToolPicker.tsx +++ b/components/article/ToolPicker.tsx @@ -11,7 +11,16 @@ import { useArticleContext } from 'components/context/ArticleContext' // Nota bene: tool === application // Nota bene: picker === switcher -const supportedTools = ['cli', 'desktop', 'webui', 'curl', 'codespaces', 'vscode'] +const supportedTools = [ + 'cli', + 'desktop', + 'webui', + 'curl', + 'codespaces', + 'vscode', + 'importer_cli', + 'graphql', +] const toolTitles = { webui: 'Web browser', cli: 'GitHub CLI', @@ -19,6 +28,8 @@ const toolTitles = { desktop: 'Desktop', codespaces: 'Codespaces', vscode: 'Visual Studio Code', + importer_cli: 'GitHub Enterprise Importer CLI', + graphql: 'GraphQL API', } as Record // Imperatively modify article content to show only the selected tool diff --git a/content/README.md b/content/README.md index 62b07799c0..1f37f95462 100644 --- a/content/README.md +++ b/content/README.md @@ -228,7 +228,7 @@ defaultPlatform: linux ### `defaultTool` - Purpose: Override the initial tool selection for a page, where tool refers to the application the reader is using to work with GitHub (such as GitHub.com's web UI, the GitHub CLI, or GitHub Desktop) or the GitHub APIs (such as cURL or the GitHub CLI). For more information about the tool selector, see [Markup reference for GitHub Docs](../contributing/content-markup-reference.md#tool-tags). If this frontmatter is omitted, then the tool-specific content matching the GitHub web UI is shown by default. If a user has indicated a tool preference (by clicking on a tool tab), then the user's preference will be applied instead of the default value. -- Type: `String`, one of: `webui`, `cli`, `desktop`, `curl`, `codespaces`, `vscode`. +- Type: `String`, one of: `webui`, `cli`, `desktop`, `curl`, `codespaces`, `vscode`, `importer_cli`, `graphql`. - Optional. ```yaml diff --git a/contributing/content-markup-reference.md b/contributing/content-markup-reference.md index 0f5e0374ad..fc414ee0f5 100644 --- a/contributing/content-markup-reference.md +++ b/contributing/content-markup-reference.md @@ -104,7 +104,7 @@ You can define a default platform in the frontmatter. For more information, see ## Tool tags -We occasionally need to write documentation for different tools (GitHub UI, GitHub CLI, GitHub Desktop, cURL, Codespaces, VS Code). Each tool may require a different set of instructions. We use tool tags to demarcate information for each tool. +We occasionally need to write documentation for different tools (GitHub UI, GitHub CLI, GitHub Desktop, cURL, Codespaces, VS Code, GitHub Enterprise Importer CLI, GraphQL API). Each tool may require a different set of instructions. We use tool tags to demarcate information for each tool. ### Usage @@ -156,6 +156,22 @@ These instructions are pertinent to VS Code users. {% endvscode %} ``` +``` +{% importer_cli %} + +These instructions are pertinent to GitHub Enterprise Importer CLI users. + +{% endimporter_cli %} +``` + +``` +{% graphql %} + +These instructions are pertinent to GraphQL API users. + +{% endgraphql %} +``` + You can define a default tool in the frontmatter. For more information, see the [content README](../content/README.md#defaulttool). ## Reusable and variable strings of text diff --git a/lib/frontmatter.js b/lib/frontmatter.js index 9d99dd8c3a..5f8a673ad6 100644 --- a/lib/frontmatter.js +++ b/lib/frontmatter.js @@ -181,7 +181,7 @@ export const schema = { // Tool-specific content preference defaultTool: { type: 'string', - enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode'], + enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode', 'importer_cli', 'graphql'], }, // Documentation contributed by a third party, such as a GitHub Partner contributor: { diff --git a/lib/liquid-tags/extended-markdown.js b/lib/liquid-tags/extended-markdown.js index ef1f8d5685..507b8b83c2 100644 --- a/lib/liquid-tags/extended-markdown.js +++ b/lib/liquid-tags/extended-markdown.js @@ -8,6 +8,8 @@ export const tags = { curl: '', codespaces: '', vscode: '', + importer_cli: '', + graphql: '', all: '', tip: 'border rounded-1 mb-4 p-3 color-border-accent-emphasis color-bg-accent f5', note: 'border rounded-1 mb-4 p-3 color-border-accent-emphasis color-bg-accent f5', diff --git a/lib/page.js b/lib/page.js index 7d02c58251..5554a43f82 100644 --- a/lib/page.js +++ b/lib/page.js @@ -251,9 +251,16 @@ class Page { this.includesPlatformSpecificContent = this.detectedPlatforms.length > 0 // set flags for webui, cli, etc switcher element - this.detectedTools = ['cli', 'desktop', 'webui', 'curl', 'codespaces', 'vscode'].filter( - (tool) => html.includes(`extended-markdown ${tool}`) || html.includes(`tool-${tool}`) - ) + this.detectedTools = [ + 'cli', + 'desktop', + 'webui', + 'curl', + 'codespaces', + 'vscode', + `importer_cli`, + `graphql`, + ].filter((tool) => html.includes(`extended-markdown ${tool}`) || html.includes(`tool-${tool}`)) this.includesToolSpecificContent = this.detectedTools.length > 0 return html diff --git a/lib/schema-event.js b/lib/schema-event.js index 62d98c9668..4d4e94a624 100644 --- a/lib/schema-event.js +++ b/lib/schema-event.js @@ -146,7 +146,7 @@ const context = { }, application_preference: { type: 'string', - enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode'], + enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode', 'importer_cli', 'graphql'], description: 'The application selected by the user.', }, color_mode_preference: { @@ -447,6 +447,8 @@ const preferenceSchema = { 'curl', 'codespaces', 'vscode', + 'importer_cli', + 'graphql', 'dark', 'light', 'auto',