1
0
mirror of synced 2025-12-30 12:02:01 -05:00

Merge branch 'main' into repo-sync

This commit is contained in:
Octomerger Bot
2022-01-07 18:24:33 -06:00
committed by GitHub
35 changed files with 813 additions and 1106 deletions

View File

@@ -54,13 +54,13 @@ jobs:
run: npm ci --include=optional
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}
- name: Cache lib/redirects/.redirects-cache_en_ja.json
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: lib/redirects/.redirects-cache_en_ja.json
key: ${{ runner.os }}-redirects-cache-${{ hashFiles('.github/workflows/browser-test.yml') }}

View File

@@ -35,7 +35,7 @@ jobs:
- name: npm ci
run: npm ci
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -41,7 +41,7 @@ jobs:
run: script/i18n/homogenize-frontmatter.js
- name: Check in homogenized files
uses: EndBug/add-and-commit@2bdc0a61a03738a1d1bda24d566ad0dbe3083d87
uses: EndBug/add-and-commit@8c12ff729a98cfbcd3fe38b49f55eceb98a5ec02
with:
# The arguments for the `git add` command
add: 'translations'

View File

@@ -55,7 +55,7 @@ jobs:
- name: Create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad
uses: peter-evans/create-pull-request@dcd5fd746d53dd8de555c0f10bca6c35628be47a
env:
# Disable pre-commit hooks; they don't play nicely here
HUSKY: '0'

View File

@@ -63,7 +63,7 @@ jobs:
run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-search-label.js
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -35,7 +35,7 @@ jobs:
run: npm ci
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -35,7 +35,7 @@ jobs:
run: npm ci
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -33,7 +33,7 @@ jobs:
run: npm ci
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -35,7 +35,7 @@ jobs:
run: npm ci
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -46,7 +46,7 @@ jobs:
run: script/rest/update-files.js --decorate-only
- name: Check in the decorated files
uses: EndBug/add-and-commit@2bdc0a61a03738a1d1bda24d566ad0dbe3083d87
uses: EndBug/add-and-commit@8c12ff729a98cfbcd3fe38b49f55eceb98a5ec02
with:
# The arguments for the `git add` command
add: 'lib/rest/static/decorated'

View File

@@ -30,7 +30,7 @@ jobs:
run: npm ci --include=optional
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -55,7 +55,7 @@ jobs:
GIT_BRANCH: main
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -44,7 +44,7 @@ jobs:
- name: Remove script results file
run: rm ./results.md
- name: Create pull request
uses: peter-evans/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad
uses: peter-evans/create-pull-request@dcd5fd746d53dd8de555c0f10bca6c35628be47a
env:
# Disable pre-commit hooks; they don't play nicely here
HUSKY: '0'

View File

@@ -64,7 +64,7 @@ jobs:
run: npm ci
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -82,7 +82,7 @@ jobs:
run: npm ci
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}
@@ -129,7 +129,7 @@ jobs:
# We are not willing to trust the rest (e.g. script/) for the remainder
# of the deployment process.
- name: Upload build artifact
uses: actions/upload-artifact@27121b0bdffd731efa15d66772be8dc71245d074
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2
with:
name: pr_build
path: app.tar

View File

@@ -65,7 +65,7 @@ jobs:
run: npm ci
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -38,7 +38,7 @@ jobs:
run: npm ci
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -56,7 +56,7 @@ jobs:
run: npm ci
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -82,7 +82,7 @@ jobs:
GIT_BRANCH: ${{ github.head_ref || github.ref }}
- name: Cache nextjs build
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}

View File

@@ -48,7 +48,7 @@ jobs:
script/graphql/update-files.js
- name: Create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad
uses: peter-evans/create-pull-request@dcd5fd746d53dd8de555c0f10bca6c35628be47a
env:
# Disable pre-commit hooks; they don't play nicely here
HUSKY: '0'

View File

@@ -5,7 +5,7 @@
# --------------------------------------------------------------------------------
# BASE IMAGE
# --------------------------------------------------------------------------------
FROM node:16.2.0-alpine as base
FROM node:16-alpine as base
RUN apk add --no-cache make g++ git
@@ -22,6 +22,10 @@ COPY package*.json ./
RUN npm ci
# This the appropriate necessary extra for node:16-alpine
# Other options are https://www.npmjs.com/search?q=%40next%2Fswc
RUN npm i @next/swc-linux-x64-musl --no-save
# ---------------
# PROD DEPS
@@ -54,7 +58,7 @@ RUN npm run build
# MAIN IMAGE
# --------------------------------------------------------------------------------
FROM node:16.2.0-alpine as production
FROM node:16-alpine as production
# Let's make our home
WORKDIR /usr/src/docs

View File

@@ -51,3 +51,7 @@
.selectWording {
margin: 0.64rem 0.5rem 0 0;
}
.versionSearchContainer {
overflow: hidden;
}

View File

@@ -206,7 +206,7 @@ export function Search({
)
const SearchInput = (
<div data-testid="search" aria-hidden="true">
<div data-testid="search">
<div className="position-relative z-2">
<form role="search" className="width-full d-flex" noValidate onSubmit={onFormSubmit}>
<label className="text-normal width-full">
@@ -347,23 +347,6 @@ function ShowSearchResults({
}, [selectedVersion])
if (results) {
if (results.length === 0) {
// When there results, but exactly 0, it matters if this is the overlay or not.
if (isHeaderSearch) {
return (
<div className="mt-5 px-6">
{isLoading ? <span>{t('loading')}...</span> : <span>{t('no_results')}.</span>}
</div>
)
} else {
return (
<p data-testid="no-search-results" className="d-block mt-4">
{t('no_results')}.
</p>
)
}
}
const ActionListResults = (
<div
data-testid="search-results"
@@ -373,7 +356,7 @@ function ShowSearchResults({
isHeaderSearch && 'overflow-auto'
)}
>
<div className="mt-4 pb-4 width-full border-bottom">
<div className={cx(styles.versionSearchContainer, 'mt-4 pb-4 width-full border-bottom')}>
<p className={cx(styles.searchWording, 'f6 ml-4 d-inline-block')}>
You're searching the <strong>{searchVersion}</strong> version.
</p>
@@ -389,8 +372,16 @@ function ShowSearchResults({
</div>
{/* We might have results AND isLoading. For example, the user typed
a first word, and is now typing more. */}
<p className="d-block ml-4 mt-4">
{isLoading ? <span>{t('loading')}...</span> : <span>&nbsp;</span>}
{isLoading && (
<p className="d-block ml-4 mt-4">
<span>{t('loading')}...</span>
</p>
)}
<h1 className="ml-4 f2 mt-4">
{t('search_results_for')}: {query}
</h1>
<p className="ml-4 mb-4 text-normal f5">
{t('matches_displayed')}: {results.length === 0 ? t('no_results') : results.length}
</p>
<ActionList
@@ -421,8 +412,8 @@ function ShowSearchResults({
score: {score.toFixed(4)} popularity: {popularity.toFixed(4)}
</small>
)}
<div
className={cx('mt-2 d-block f4 text-semibold')}
<h2
className={cx('mt-2 text-normal f3 d-block')}
dangerouslySetInnerHTML={{
__html: title,
}}
@@ -433,7 +424,7 @@ function ShowSearchResults({
dangerouslySetInnerHTML={{ __html: content }}
/>
<div
className={'d-block mt-2 opacity-60 text-small'}
className={'d-block mt-2 opacity-70 text-small'}
dangerouslySetInnerHTML={
breadcrumbs.length === 0
? { __html: `${title}`.replace(/<\/?[^>]+(>|$)|(\/)/g, '') }

View File

@@ -14,7 +14,7 @@ export const Contribution = () => {
<div className="f5 contribution">
<h2 className="f4 mb-3">{t`title`}</h2>
<p className="max-w-xs color-fg-muted mb-3">{t`body`}</p>
<a className="btn" href={contributionHref}>
<a className="btn color-border-accent-emphasis" href={contributionHref}>
<GitPullRequestIcon size="small" className="octicon mr-1" />
{t`button`}
</a>

View File

@@ -17,6 +17,7 @@ export const Survey = () => {
const { asPath } = useRouter()
const { t } = useTranslation('survey')
const [state, setState] = useState<ViewState>(ViewState.START)
const [isEmailError, setIsEmailError] = useState(false)
const formRef = useRef<HTMLFormElement>(null)
useEffect(() => {
@@ -33,10 +34,24 @@ export const Survey = () => {
}
}
function handleEmailInputChange() {
const emailRegex = /[^@\s.][^@\s]*@\[?[a-z0-9.-]+\]?/i
const surveyEmail = getFormData()?.get('survey-email')?.toString()
if (surveyEmail?.length === 0 || surveyEmail?.match(emailRegex)) {
setIsEmailError(false)
} else {
setIsEmailError(true)
}
}
function submit(evt: React.FormEvent) {
evt.preventDefault()
trackEvent(getFormData())
setState(ViewState.END)
if (!isEmailError) {
setState(ViewState.END)
setIsEmailError(false)
}
}
function getFormData() {
@@ -64,7 +79,10 @@ export const Survey = () => {
checked={state === ViewState.YES}
/>
<label
className={cx('btn mr-1', state === ViewState.YES && 'color-bg-accent-emphasis')}
className={cx(
'btn mr-1 color-border-accent-emphasis',
state === ViewState.YES && 'color-bg-accent-emphasis'
)}
htmlFor="survey-yes"
>
<ThumbsupIcon size={16} className={state === ViewState.YES ? '' : 'color-fg-muted'} />
@@ -80,7 +98,10 @@ export const Survey = () => {
checked={state === ViewState.NO}
/>
<label
className={cx('btn', state === ViewState.NO && 'color-bg-danger-emphasis')}
className={cx(
'btn color-border-accent-emphasis',
state === ViewState.NO && 'color-bg-danger-emphasis'
)}
htmlFor="survey-no"
>
<ThumbsdownIcon size={16} className={state === ViewState.NO ? '' : 'color-fg-muted'} />
@@ -104,7 +125,7 @@ export const Survey = () => {
id="survey-comment"
></textarea>
</p>
<p>
<div className={cx('form-group', isEmailError ? 'warn' : '')}>
<label className="d-block mb-1 f6" htmlFor="survey-email">
{t`email_label`}
<span className="text-normal color-fg-muted float-right ml-1">{t`optional`}</span>
@@ -115,18 +136,33 @@ export const Survey = () => {
name="survey-email"
id="survey-email"
placeholder={t`email_placeholder`}
onChange={handleEmailInputChange}
aria-invalid={isEmailError}
{...(isEmailError ? { 'aria-describedby': 'email-input-validation' } : {})}
/>
<span className="f6 color-fg-muted">{t`not_support`}</span>
</p>
{isEmailError && (
<p className="note warning" id="email-input-validation">
{t`email_validation`}
</p>
)}
</div>
<span className="f6 color-fg-muted">{t`not_support`}</span>
<div className="d-flex flex-justify-end flex-items-center mt-3">
<button
type="button"
className="btn btn-sm btn-invisible mr-3"
onClick={() => setState(ViewState.START)}
onClick={() => {
setState(ViewState.START)
setIsEmailError(false)
}}
>
Cancel
</button>
<button type="submit" className="btn btn-sm">
<button
disabled={isEmailError}
type="submit"
className="btn btn-sm color-border-accent-emphasis"
>
{t`send`}
</button>
</div>

View File

@@ -28,39 +28,43 @@ export const Breadcrumbs = () => {
className={cx('f5 breadcrumbs', styles.breadcrumbs)}
aria-label="Breadcrumb"
>
{Object.values(breadcrumbs).map((breadcrumb, i, arr) => {
if (!breadcrumb) {
return null
}
const title = `${breadcrumb.title}`
return [
!breadcrumb.href ? (
<span data-testid="breadcrumb-title" key={title} title={title} className="px-2">
{breadcrumb.title}
</span>
) : (
<Link
key={title}
data-testid="breadcrumb-link"
href={breadcrumb.href}
title={title}
className={cx(
'pr-3',
// Always show first and last, show middle on XL size
i === 0 || i === arr.length - 1 ? 'd-inline-block' : 'd-none d-xl-inline-block',
pathWithLocale === breadcrumb.href && 'color-fg-muted'
)}
>
{breadcrumb.title}
{i !== arr.length - 1 ? (
<span className="color-fg-muted pl-3" key={`${i}-slash`}>
/
</span>
) : null}
</Link>
),
]
})}
<ul>
{Object.values(breadcrumbs).map((breadcrumb, i, arr) => {
if (!breadcrumb) {
return null
}
const title = `${breadcrumb.title}`
return [
!breadcrumb.href ? (
<span data-testid="breadcrumb-title" key={title} title={title} className="px-2">
{breadcrumb.title}
</span>
) : (
<li className="d-inline-block">
<Link
key={title}
data-testid="breadcrumb-link"
href={breadcrumb.href}
title={title}
className={cx(
'pr-3',
// Always show first and last, show middle on XL size
i === 0 || i === arr.length - 1 ? 'd-inline-block' : 'd-none d-xl-inline-block',
pathWithLocale === breadcrumb.href && 'color-fg-muted'
)}
>
{breadcrumb.title}
{i !== arr.length - 1 ? (
<span className="color-fg-muted pl-3" key={`${i}-slash`}>
/
</span>
) : null}
</Link>
</li>
),
]
})}
</ul>
</nav>
)
}

View File

@@ -37,7 +37,7 @@ export const ScrollButton = ({ className, ariaLabel }: ScrollButtonPropsT) => {
<div className={cx(className, 'transition-200', show ? 'opacity-100' : 'opacity-0')}>
<button
onClick={onClick}
className="color-bg-default color-fg-on-emphasis border-0 d-inline-block mr-2 f6"
className="color-bg-default color-fg-default border-0 d-inline-block mr-2 f6"
>
{t('scroll_to_top')}
</button>

View File

@@ -32,7 +32,9 @@ search:
placeholder: Search topics, products...
loading: Loading
no_results: No results found
search_results_for: Search results for
no_content: No content
matches_displayed: Matches displayed
homepage:
explore_by_product: Explore by product
version_picker: Version
@@ -66,6 +68,7 @@ survey:
required: Required
email_placeholder: email@example.com
email_label: If we can contact you with more questions, please enter your email address
email_validation: Please enter a valid email address
send: Send
feedback: Thank you! We received your feedback.
not_support: If you need a reply, please contact support instead.

View File

@@ -89,10 +89,10 @@
<tbody>
{%- for childParam in childParamsGroup.params -%}
<tr>
<td class="opacity-60">
<td class="opacity-70">
<code>{{ childParam.name }}</code> ({{ childParam.type }})
</td>
<td class="opacity-60">{{ childParam.description }}</td>
<td class="opacity-70">{{ childParam.description }}</td>
</tr>
{%- endfor -%}
</tbody>

View File

@@ -1,9 +1,16 @@
import next from 'next'
// This import is necessary, as of Jan 2022 to avoid a segmentation fault.
// Next is suppose to automatically pick up the `next.config.js` file
// but if you don't specify it to the `next()` constructor you currently
// get a seg fault.
// Possibly relevant: https://github.com/vercel/next.js/issues/33008
import conf from '../next.config.js'
const { NODE_ENV } = process.env
const isDevelopment = NODE_ENV === 'development'
export const nextApp = next({ dev: isDevelopment })
export const nextApp = next({ dev: isDevelopment, conf })
export const nextHandleRequest = nextApp.getRequestHandler()
await nextApp.prepare()

1
next-env.d.ts vendored
View File

@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited

1663
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@
"@github/failbot": "0.8.0",
"@hapi/accept": "^5.0.2",
"@primer/components": "^32.1.0",
"@primer/css": "^18.2.0",
"@primer/css": "^19.1.1",
"@primer/octicons": "^16.1.1",
"@primer/octicons-react": "^16.2.0",
"@react-aria/ssr": "^3.1.0",
@@ -58,7 +58,7 @@
"mdast-util-from-markdown": "^1.2.0",
"mdast-util-to-string": "^3.1.0",
"morgan": "^1.10.0",
"next": "^11.1.3",
"next": "12.0.7",
"node-fetch": "^3.1.0",
"parse5": "^6.0.1",
"port-used": "^2.0.8",
@@ -72,7 +72,7 @@
"rehype-autolink-headings": "^6.1.0",
"rehype-highlight": "^5.0.0",
"rehype-raw": "^6.1.1",
"rehype-slug": "^5.0.0",
"rehype-slug": "^5.0.1",
"rehype-stringify": "^9.0.2",
"remark-code-extra": "^1.0.1",
"remark-gemoji-to-emoji": "^1.1.0",
@@ -87,7 +87,7 @@
"slash": "^4.0.0",
"strip-html-comments": "^1.0.0",
"styled-components": "^5.3.3",
"swr": "1.1.0",
"swr": "1.1.2",
"throng": "^5.0.0",
"ts-dedent": "^2.2.0",
"unified": "^10.1.0",
@@ -153,7 +153,7 @@
"jest": "^27.4.3",
"jest-github-actions-reporter": "^1.0.3",
"jest-slow-test-reporter": "^1.0.0",
"linkinator": "^2.16.2",
"linkinator": "^3.0.3",
"lint-staged": "^12.1.2",
"make-promises-safe": "^5.1.0",
"minimatch": "^3.0.4",

View File

@@ -13,7 +13,7 @@
import { fileURLToPath } from 'url'
import path from 'path'
import fs from 'fs'
import linkinator from 'linkinator'
import { LinkChecker } from 'linkinator'
import program from 'commander'
import { pull, uniq } from 'lodash-es'
import rimraf from 'rimraf'
@@ -24,7 +24,7 @@ import excludedLinks from '../lib/excluded-links.js'
import libLanguages from '../lib/languages.js'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const checker = new linkinator.LinkChecker()
const checker = new LinkChecker()
const root = 'https://docs.github.com'
const englishRoot = `${root}/en`

View File

@@ -11,10 +11,10 @@
//
// [end-readme]
import linkinator from 'linkinator'
import { LinkChecker } from 'linkinator'
import { deprecated, latest } from '../lib/enterprise-server-releases.js'
const checker = new linkinator.LinkChecker()
const checker = new LinkChecker()
const englishRoot = 'http://localhost:4002/en'
const allowedVersions = ['dotcom', 'enterprise-cloud', 'enterprise-server', 'github-ae']