1
0
mirror of synced 2025-12-25 02:17:36 -05:00

Don't remove .feature frontmatter key inside getApplicableVersions() (#24189)

* goofing around to trigger an error

* only call warmServer once

* delete versions when it can be inherited

* fix nasty unit test
This commit is contained in:
Peter Bengtsson
2022-01-10 21:00:19 -05:00
committed by GitHub
parent 4947218cba
commit 78500789e5
6 changed files with 22 additions and 36 deletions

View File

@@ -2,8 +2,6 @@
title: Managing accessibility settings
intro: 'You can disable character key shortcuts on {% data variables.product.prodname_dotcom %} in your accessibility settings.'
versions:
fpt: '*'
ghes: '>=3.4'
feature: keyboard-shortcut-accessibility-setting
---
@@ -17,6 +15,6 @@ All keyboard shortcuts are enabled by default on {% data variables.product.produ
{% data reusables.user_settings.access_settings %}
{% data reusables.user_settings.accessibility_settings %}
1. Select or deselect the **Enable character key shortcuts** checkbox.
1. Select or deselect the **Enable character key shortcuts** checkbox.
![Screenshot of the 'Enable character key shortcuts' checkbox](/assets/images/help/settings/disable-character-key-shortcuts.png)
2. Click **Save**.

View File

@@ -2,8 +2,6 @@
title: GitHub Command Palette
intro: 'Use the command palette in {% data variables.product.product_name %} to navigate, search, and run commands directly from your keyboard.'
versions:
fpt: '*'
ghec: '*'
feature: 'command-palette'
shortTitle: GitHub Command Palette
---
@@ -29,10 +27,10 @@ The ability to run commands directly from your keyboard, without navigating thro
## Opening the {% data variables.product.prodname_command_palette %}
Open the command palette using one of the following keyboard shortcuts:
- Windows and Linux: <kbd>Ctrl</kbd><kbd>k</kbd> or <kbd>Ctrl</kbd><kbd>alt</kbd><kbd>k</kbd>
- Windows and Linux: <kbd>Ctrl</kbd><kbd>k</kbd> or <kbd>Ctrl</kbd><kbd>alt</kbd><kbd>k</kbd>
- Mac: <kbd>⌘</kbd><kbd>k</kbd> or <kbd>⌘</kbd><kbd>option</kbd><kbd>k</kbd>
When you open the command palette, it shows your location at the top left and uses it as the scope for suggestions (for example, the `mashed-avocado` organization).
When you open the command palette, it shows your location at the top left and uses it as the scope for suggestions (for example, the `mashed-avocado` organization).
![Command palette launch](/assets/images/help/command-palette/command-palette-launch.png)
@@ -46,11 +44,11 @@ When you open the command palette, it shows your location at the top left and us
## Navigating with the {% data variables.product.prodname_command_palette %}
You can use the command palette to navigate to any page that you have access to on {% data variables.product.product_name %}.
You can use the command palette to navigate to any page that you have access to on {% data variables.product.product_name %}.
{% data reusables.command-palette.open-palette %}
2. Start typing the path you want to navigate to. The suggestions in the command palette change to match your text.
2. Start typing the path you want to navigate to. The suggestions in the command palette change to match your text.
![Command palette navigation current scope](/assets/images/help/command-palette/command-palette-navigation-current-scope.png)
@@ -64,18 +62,18 @@ You can use the command palette to navigate to any page that you have access to
## Searching with the {% data variables.product.prodname_command_palette %}
You can use the command palette to search for anything on {% data variables.product.product_location %}.
You can use the command palette to search for anything on {% data variables.product.product_location %}.
{% data reusables.command-palette.open-palette %}
{% data reusables.command-palette.change-scope %}
3. Optionally, use keystrokes to find specific types of resource:
3. Optionally, use keystrokes to find specific types of resource:
- <kbd>#</kbd> Search for issues, pull requests, discussions, and projects
- <kbd>!</kbd> Search for projects
- <kbd>@</kbd> Search for users, organizations, and repositories
- <kbd>/</kbd> Search for files within a repository scope
- <kbd>/</kbd> Search for files within a repository scope
![Command palette search files](/assets/images/help/command-palette/command-palette-search-files.png)
@@ -94,7 +92,7 @@ You can use the command palette to search for anything on {% data variables.prod
You can use the {% data variables.product.prodname_command_palette %} to run commands. For example, you can create a new repository or issue, or change your theme. When you run a command, the location for its action is determined by either the underlying page or the scope shown in the command palette.
- Pull request and issue commands always run on the underlying page.
- Higher-level commands, for example, repository commands, run in the scope shown in the command palette.
- Higher-level commands, for example, repository commands, run in the scope shown in the command palette.
For a full list of supported commands, see "[{% data variables.product.prodname_command_palette %} reference](#github-command-palette-reference)."
@@ -198,7 +196,7 @@ These commands are available only when you open the command palette from an issu
|`Convert issue to discussion...`|Convert the current issue into a discussion. For more information, see "[Moderating discussions](/discussions/managing-discussions-for-your-community/moderating-discussions#converting-an-issue-to-a-discussion)."
|`Delete issue...`|Delete the current issue. For more information, see "[Deleting an issue](/issues/tracking-your-work-with-issues/deleting-an-issue)."|
|`Edit issue body`|Open the main body of the issue ready for editing.
|`Edit issue title`|Open the title of the issue ready for editing.
|`Edit issue title`|Open the title of the issue ready for editing.
|`Lock issue`|Limit new comments to users with write access to the repository. For more information, see "[Locking conversations](/communities/moderating-comments-and-conversations/locking-conversations)."
|`Pin`/`unpin issue`|Change whether or not the issue is shown in the pinned issues section for the repository. For more information, see "[Pinning an issue to your repository](/issues/tracking-your-work-with-issues/pinning-an-issue-to-your-repository)."|
|`Subscribe`/`unscubscribe`|Opt in or out of notifications for changes to this issue. For more information, see "[About notifications](/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/about-notifications)."

View File

@@ -54,9 +54,6 @@ function getApplicableVersions(frontmatterVersions, filepath) {
{}
)
// We will be evaluating feature versions separately, so we can remove this.
delete frontmatterVersions.feature
// Get available versions for frontmatter and for feature versions.
const foundFeatureVersions = evaluateVersions(featureVersions)
const foundFrontmatterVersions = evaluateVersions(frontmatterVersions)

View File

@@ -45,6 +45,7 @@ async function warmServer() {
redirects,
unversionedTree,
siteTree,
pageList,
}
}

View File

@@ -16,8 +16,7 @@ import chalk from 'chalk'
import shortVersions from '../middleware/contextualizers/short-versions.js'
import contextualize from '../middleware/context.js'
import { languageKeys } from '../lib/languages.js'
import { loadPages, loadPageMap, loadUnversionedTree } from '../lib/page-data.js'
import loadRedirects from '../lib/redirects/precompile.js'
import warmServer from '../lib/warm-server.js'
import renderContent from '../lib/render-content/index.js'
import { deprecated } from '../lib/enterprise-server-releases.js'
@@ -74,21 +73,16 @@ main(program.opts(), program.args)
async function main(opts, files) {
const { random, language, filter, exit, debug, max, verbose } = opts
debug && console.time('loadUnversionedTree')
const unversionedTree = await loadUnversionedTree()
debug && console.timeEnd('loadUnversionedTree')
debug && console.time('loadPages')
const pageList = await loadPages(unversionedTree)
debug && console.timeEnd('loadPages')
debug && console.time('loadPageMap')
const pageMap = await loadPageMap(pageList)
debug && console.timeEnd('loadPageMap')
debug && console.time('loadRedirects')
const redirects = await loadRedirects(pageList)
debug && console.timeEnd('loadRedirects')
// Note! The reason we're using `warmServer()` in this script,
// even though there's no server involved, is because
// the `contextualize()` function calls it.
// And because warmServer() is actually idempotent, meaning it's
// cheap to call it more than once, it would be expensive to call it
// twice unnecessarily.
// If we'd manually do the same operations that `warmServer()` does
// here (e.g. `loadPageMap()`), we'd end up having to do it all over
// again, the next time `contextualize()` is called.
const { redirects, pages: pageMap, pageList } = await warmServer()
const languages = language || []
console.assert(Array.isArray(languages), `${languages} is not an array`)

View File

@@ -666,8 +666,6 @@ describe('Page class', () => {
expect(page.versions.fpt).toBe('*')
expect(page.versions.ghes).toBe('>2.21')
expect(page.versions.ghae).toBeUndefined()
// The `feature` prop gets deleted by lib/get-applicable-versions, so it's undefined.
expect(page.versions.feature).toBeUndefined()
// Test the resolved versioning, where GHES releases specified in frontmatter and in
// feature versions are combined (i.e., one doesn't overwrite the other).