Co-authored-by: Peter Bengtsson <peterbe@github.com>
This commit is contained in:
Kevin Heis 2023-11-02 11:17:39 -07:00 коммит произвёл GitHub
Родитель 3ecf4082e3
Коммит 748d1e3e3d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
86 изменённых файлов: 121 добавлений и 111 удалений

Просмотреть файл

@ -5,7 +5,6 @@
contributing/
docs/
node_modules/
script/
tests/
# Folder is cloned during the preview + prod workflows, the assets are merged into other locations for use before the build
docs-early-access/

Просмотреть файл

@ -20,7 +20,7 @@ module.exports = {
"tmp/*",
"!/.*",
"/.next/",
"script/bookmarklets/*",
"src/bookmarklets/*",
"src/open-source/scripts/add-pr-links.js",
"src/open-source/scripts/pr-link-source.js",
"rest-api-description/",

Просмотреть файл

@ -33,7 +33,7 @@ runs:
- name: Run script
if: ${{ inputs.restore-only == '' }}
shell: bash
run: node script/warmup-remotejson.js
run: node src/archives/scripts/warmup-remotejson.js
- name: Cache .remotejson-cache (save)
if: ${{ inputs.restore-only == '' }}

Просмотреть файл

@ -66,7 +66,7 @@ jobs:
- name: Run broken github/github link check
run: |
script/check-github-github-links.js broken_github_github_links.md
src/links/scripts/check-github-github-links.js broken_github_github_links.md
- name: Get title for issue
# If the file 'broken_github_github_links.md' got created,

2
.github/workflows/test.yml поставляемый
Просмотреть файл

@ -104,7 +104,7 @@ jobs:
- name: Check the test fixture data (if applicable)
if: ${{ matrix.name == 'rendering-fixtures' }}
run: ./script/copy-fixture-data.js --check
run: ./src/tests/scripts/copy-fixture-data.js --check
# This keeps our fixture content/data in check
- name: Check the test fixture content (if applicable)

Просмотреть файл

@ -13,10 +13,11 @@ on:
- 'assets/fonts/**'
- 'data/graphql/**'
- 'Dockerfile*'
- 'src/**'
- 'src/*/scripts/**'
- 'src/**.json'
- 'src/workflows/**'
- 'lib/redirects/**'
- 'package*.json'
- 'script/**'
- 'content/actions/deployment/security-hardening-your-deployments/**'
permissions:
@ -55,10 +56,11 @@ jobs:
- 'assets/fonts/**'
- 'data/graphql/**'
- 'Dockerfile*'
- 'src/**'
- 'src/*/scripts/**'
- 'src/**.json'
- 'src/workflows/**'
- 'lib/redirects/**'
- 'package*.json'
- 'scripts/**'
- 'content/actions/deployment/security-hardening-your-deployments/**'
# When there are changes to files we can't accept, leave a comment
@ -75,10 +77,11 @@ jobs:
'assets/fonts/**',
'data/graphql/**',
'Dockerfile*',
'src/**',
'src/*/scripts/**',
'src/**.json',
'src/workflows/**',
'lib/redirects/**',
'package*.json',
'scripts/**',
'content/actions/deployment/security-hardening-your-deployments/**',
]

2
.github/workflows/validate-asset-images.yml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
name: Validate asset images
# **What it does**: Run ./script/validate-asset-images.js on all images in assets/
# **What it does**: Run ./src/assets/scripts/validate-asset-images.js on all images in assets/
# **Why we have it**: To protect from innocent and potentially malicious bad image assets
# **Who does it impact**: Docs content.

4
.gitignore поставляемый
Просмотреть файл

@ -9,7 +9,7 @@ coverage/
/assets/images/early-access
/content/early-access
/data/early-access
/script/dev-toc/static
/src/dev-toc/static
.next
.eslintcache
*.tsbuildinfo
@ -30,7 +30,7 @@ lib/redirects/.redirects-cache*.json
user-code/
# Logs from scripts
script/logs/
*/logs/
external-link-checker-db.json
# Playwright related

Просмотреть файл

@ -1,5 +1,5 @@
data/release-notes/
script/bookmarklets/
src/bookmarklets/
src/open-source/scripts/add-pr-links.js
/.next/

Просмотреть файл

@ -196,7 +196,7 @@ featuredLinks:
### `allowTitleToDifferFromFilename`
- Purpose: Indicates whether a page is allowed to have a title that differs from its filename. Pages with this frontmatter set to `true` will not be flagged in tests or updated by `script/reconcile-ids-with-filenames.js`. Use this value if a file's `title` frontmatter includes Liquid or punctuation that cannot be part of the filename. For example, the article "[About Enterprise Managed Users](https://docs.github.com/en/enterprise-cloud@latest/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-enterprise-managed-users)" uses a Liquid reusable in its title, `'About {% data variables.product.prodname_emus %}'`, which cannot be in the filename, `about-enterprise-managed-users.md`, so the `allowTitleToDifferFromFilename` frontmatter is set to `true`.
- Purpose: Indicates whether a page is allowed to have a title that differs from its filename. Pages with this frontmatter set to `true` will not be flagged in tests or updated by `src/content-render/scripts/reconcile-filenames-with-ids.js`. Use this value if a file's `title` frontmatter includes Liquid or punctuation that cannot be part of the filename. For example, the article "[About Enterprise Managed Users](https://docs.github.com/en/enterprise-cloud@latest/admin/identity-and-access-management/using-enterprise-managed-users-for-iam/about-enterprise-managed-users)" uses a Liquid reusable in its title, `'About {% data variables.product.prodname_emus %}'`, which cannot be in the filename, `about-enterprise-managed-users.md`, so the `allowTitleToDifferFromFilename` frontmatter is set to `true`.
- Type: `Boolean`. Default is `false`.
- Optional.

Просмотреть файл

@ -67,7 +67,7 @@ If you would like to read more about debugging and troubleshooting the {% data v
### Using browser shortcuts
The [`script/bookmarklets`](https://github.com/github/docs/tree/main/script/bookmarklets) directory in the {% data variables.product.prodname_docs %} repository contains browser shortcuts that can help with reviewing {% data variables.product.company_short %} documentation. For more information, see the directory's [`README`](https://github.com/github/docs/tree/main/script/bookmarklets/README.md).
The [`src/bookmarklets`](https://github.com/github/docs/tree/main/src/bookmarklets) directory in the {% data variables.product.prodname_docs %} repository contains browser shortcuts that can help with reviewing {% data variables.product.company_short %} documentation. For more information, see the directory's [`README`](https://github.com/github/docs/tree/main/src/bookmarklets/README.md).
### Enabling different languages

Просмотреть файл

@ -34,7 +34,7 @@ git push
## Troubleshooting local server problems
If you are running `script/server` and get a `Cannot find module` error, try the following command before restarting the server.
If you are running `npm start` and get a `Cannot find module` error, try the following command before restarting the server.
```shell
npm install
@ -52,7 +52,7 @@ npm install
If you are having trouble with the staging server, you should see more information about the error in your browser or on the command line if you run the site locally. Check out your branch locally and use the following command to launch the local server.
```shell
script/server
npm start
```
When the server is running, navigate to the problematic article on `https://localhost:4000` in your browser. The staging server will just show an "Oops" error, but the local server should show a stack trace for debugging.

Просмотреть файл

@ -188,7 +188,7 @@ featuredLinks:
### `allowTitleToDifferFromFilename`
- Purpose: Indicates whether a page is allowed to have a title that differs from its filename. For example, `content/rest/reference/orgs.md` has a title of `Organizations` instead of `Orgs`. Pages with this frontmatter set to `true` will not be flagged in tests or updated by `script/reconcile-ids-with-filenames.js`.
- Purpose: Indicates whether a page is allowed to have a title that differs from its filename. For example, `content/rest/reference/orgs.md` has a title of `Organizations` instead of `Orgs`. Pages with this frontmatter set to `true` will not be flagged in tests or updated by `src/content-render/scripts/reconcile-filenames-with-ids.js`.
- Type: `Boolean`. Default is `false`.
- Optional.
@ -225,7 +225,7 @@ defaultTool: cli
### `learningTracks`
- Purpose: Render a list of learning tracks on a product's sub-landing page.
- type: `String`. This should reference learning tracks' names defined in [`data/learning-tracks/*.yml`](https://github.com/github/docs/tree/main/data/learning-tracks).
- Type: `String`. This should reference learning tracks' names defined in [`data/learning-tracks/*.yml`](https://github.com/github/docs/tree/main/data/learning-tracks).
- Optional
{% note %}

Просмотреть файл

@ -38,7 +38,7 @@ In a matter of minutes, you will be ready to edit, preview and test your changes
### Using browser shortcuts
The [`script/bookmarklets`](../script/bookmarklets) directory contains some browser shortcuts that can help with reviewing GitHub documentation. See [`script/bookmarklets/README.md`](../script/bookmarklets/README.md) for details.
The [`src/bookmarklets`](../src/bookmarklets) directory contains some browser shortcuts that can help with reviewing GitHub documentation. See [`src/bookmarklets/README.md`](../src/bookmarklets/README.md) for details.
### Enabling different languages

Просмотреть файл

@ -27,35 +27,35 @@ If a staging deployment is pending for more than 5-10min, try the following:
2. If that doesn't work, trigger a new staging deployment by pushing an empty commit on the command line:
```
$ git commit --allow-empty -m 'empty commit to redeploy staging'
git commit --allow-empty -m 'empty commit to redeploy staging'
```
### CI stalled or stuck
:yellow_heart: If tests are stuck yellow for more than an hour, rerun CI by pushing an empty commit on the command line:
```
$ git commit --allow-empty -m 'empty commit to rerun CI'
git commit --allow-empty -m 'empty commit to rerun CI'
```
### Can't run the site locally
If you are running `script/server` and get a `Cannot find module` error, try:
If you are running `npm start` and get a `Cannot find module` error, try:
```
$ npm install
npm install
```
If that doesn't fix it, try:
```
$ rm -rf node_modules
$ npm install
rm -rf node_modules
npm install
```
### Failed staging deployment
Check out the branch and run the site locally:
```
$ script/server
npm start
```
Go to https://localhost:4000
@ -77,7 +77,7 @@ make sure single quotes are properly escaped in the frontmatter. Also, check the
Check out the branch and run the site locally:
```
$ script/server
npm start
```
Go to whatever page is 500ing on staging on your local server: https://localhost:4000/page-with-error

Просмотреть файл

@ -16,6 +16,4 @@ Here's some information that might be helpful while working on a Docs PR:
- [Liquid](/contributing/liquid-helpers.md) - We use liquid helpers to create different versions of our content.
- [Scripts](/script/README.md) - The scripts directory is the home for all of the scripts you can run locally.
- [Tests](/tests/README.md) - We use tests to ensure content will render correctly on the site. Tests run automatically in your PR, and sometimes it's also helpful to run them locally.

Просмотреть файл

@ -25,6 +25,6 @@ export default {
testPathIgnorePatterns: ['node_modules/', 'vendor/', 'tests/fixtures/', 'tests/helpers/'],
testMatch: ['**/tests/**/*.js'],
testLocationInResults: isActions,
globalSetup: './script/start-server-for-jest.js',
globalTeardown: './script/kill-server-for-jest.js',
globalSetup: './src/tests/scripts/start-server-for-jest.js',
globalTeardown: './src/tests/scripts/kill-server-for-jest.js',
}

Просмотреть файл

@ -11,7 +11,7 @@ import {
} from '../lib/path-utils.js'
import productNames from '../lib/product-names.js'
import warmServer from '../lib/warm-server.js'
import searchVersions from '../src/search/lib/versions.js'
import searchVersions from '#src/search/lib/versions.js'
import nonEnterpriseDefaultVersion from '#src/versions/lib/non-enterprise-default-version.js'
import { getDataByLanguage, getUIDataMerged } from '../lib/get-data.js'

Просмотреть файл

@ -25,15 +25,16 @@
"lint": "eslint '**/*.{js,mjs,ts,tsx}'",
"lint-content": "node src/content-linter/scripts/lint-content.js",
"lint-translation": "cross-env NODE_OPTIONS=--experimental-vm-modules jest src/content-linter/tests/lint-files.js",
"move-content": "node src/content-render/scripts/move-content.js",
"openapi-docs": "node src/rest/docs.js",
"playwright-test": "playwright test --project=\"Google Chrome\"",
"prepare": "husky install",
"prettier": "prettier -w \"**/*.{ts,tsx,js,mjs,scss,yml,yaml}\"",
"prettier-check": "prettier -c \"**/*.{ts,tsx,js,mjs,scss,yml,yaml}\"",
"prevent-pushes-to-main": "node script/prevent-pushes-to-main.js",
"prevent-pushes-to-main": "node src/workflows/prevent-pushes-to-main.js",
"rest-dev": "node src/rest/scripts/update-files.js",
"show-action-deps": "echo 'Action Dependencies:' && rg '^[\\s|-]*(uses:.*)$' .github -I -N --no-heading -r '$1$2' | sort | uniq | cut -c 7-",
"prestart": "node script/cmp-files.js package-lock.json .installed.package-lock.json || npm install && cp package-lock.json .installed.package-lock.json",
"prestart": "node src/workflows/cmp-files.js package-lock.json .installed.package-lock.json || npm install && cp package-lock.json .installed.package-lock.json",
"start": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon server.js",
"start-all-languages": "cross-env NODE_ENV=development nodemon server.js",
"start-for-playwright": "cross-env ROOT=tests/fixtures TRANSLATIONS_FIXTURE_ROOT=tests/fixtures/translations ENABLED_LANGUAGES=en,ja NODE_ENV=test node server.js",

Просмотреть файл

@ -21,7 +21,7 @@
import { program } from 'commander'
import semver from 'semver'
import getRemoteJSON from '../middleware/get-remote-json.js'
import getRemoteJSON from '../../../middleware/get-remote-json.js'
import {
deprecated,
firstReleaseStoredInBlobStorage,

Просмотреть файл

@ -13,7 +13,7 @@
// Example use:
//
// export GITHUB_TOKEN=github_pat_11AAAG.....
// ./script/deleted-assets-pr-comment.js github docs-internal main 4a0b0f2
// ./src/assets/scripts/deleted-assets-pr-comment.js github docs-internal main 4a0b0f2
//
// [end-readme]

Просмотреть файл

@ -12,7 +12,7 @@ import path from 'path'
import { program } from 'commander'
import walk from 'walk-sync'
import walkFiles from '../../../script/helpers/walk-files.js'
import walkFiles from '#src/workflows/walk-files.js'
import languages from '#src/languages/lib/languages.js'
const EXCEPTIONS = new Set([

Просмотреть файл

@ -14,7 +14,7 @@ import { readFile, writeFile } from 'fs/promises'
import { mkdirp } from 'mkdirp'
import path from 'path'
import { getContents, getCommitSha } from '../../../script/helpers/git-utils.js'
import { getContents, getCommitSha } from '#src/workflows/git-utils.js'
if (!process.env.GITHUB_TOKEN) {
throw new Error('GITHUB_TOKEN environment variable must be set to run this script')

Просмотреть файл

@ -15,25 +15,25 @@ Clicking the bookmark will then execute the JavaScript.
## "View in development" toggle
[`script/bookmarklets/view-in-development.js`](./view-in-development.js)
[`src/bookmarklets/view-in-development.js`](./view-in-development.js)
When you're looking at a page on docs.github.com or a preview server at preview.ghdocs.com, clicking this bookmarklet will load the same path you're viewing but on your local server running at localhost:4000.
## "View in production" toggle
[`script/bookmarklets/view-in-production.js`](./view-in-production.js)
[`src/bookmarklets/view-in-production.js`](./view-in-production.js)
When you're looking at a page on a preview server at preview.ghdocs.com or your local server running at localhost:4000, clicking this bookmarklet will load the same path you're viewing but on the live documentation site at docs.github.com.
## Open a docs article in VS Code
[`script/bookmarklets/open-in-vscode.js`](./open-in-vscode.js)
[`src/bookmarklets/open-in-vscode.js`](./open-in-vscode.js)
When you're looking at a page on either docs.github.com, preview.ghdocs.com, or localhost:4000, clicking this bookmarklet will open the source Markdown file from your local checkout in VS Code.
The installation requires a few steps:
1. Copy the contents of [`script/bookmarklets/open-in-vscode.js`](./open-in-vscode.js).
1. Copy the contents of [`src/bookmarklets/open-in-vscode.js`](./open-in-vscode.js).
1. Browse to https://chriszarate.github.io/bookmarkleter/ and paste the code into the box.
1. Find the path of **your local checkout** of the docs repo you want to open files from (for example, `/Users/<USERNAME>/repos/docs`).
1. Paste the path in place of where it says `REPLACE_ME` in line 1 (make sure to leave the single quotes around it).
@ -42,8 +42,8 @@ The installation requires a few steps:
## Add preview links to PRs
[`script/bookmarklets/add-pr-links.js`](./add-pr-links.js)
[`src/bookmarklets/add-pr-links.js`](./add-pr-links.js)
This bookmarklet modifies the `Files changed` page of a GitHub pull request that has a current staging deployment. For each Markdown file in the diff view, it adds links to the preview deployment of the file for each version: `FPT / GHEC / GHES / AE`. (Some of these may redirect to another version or 404 if that version of the page doesn't exist.)
Note: readable JavaScript source lives in `script/bookmarklets/pr-link-source.js`. The bookmarklet code was generated via https://chriszarate.github.io/bookmarkleter.
Note: readable JavaScript source lives in `src/bookmarklets/pr-link-source.js`. The bookmarklet code was generated via https://chriszarate.github.io/bookmarkleter.

Просмотреть файл

@ -5,7 +5,7 @@
//
// Usage:
//
// script/markdownlint-disable.js no-generic-link-text
// src/content-linter/scripts/disable-rules.js no-generic-link-text
import fs from 'fs'
import { spawn } from 'child_process'

Просмотреть файл

@ -9,7 +9,7 @@ import { applyFixes } from 'markdownlint-rule-helpers'
import boxen from 'boxen'
import ora from 'ora'
import walkFiles from '../../../script/helpers/walk-files.js'
import walkFiles from '#src/workflows/walk-files.js'
import { allConfig, allRules, customRules } from '../lib/helpers/get-rules.js'
import { customConfig, githubDocsFrontmatterConfig } from '../style/github-docs.js'
import { defaultConfig } from '../lib/default-markdownlint-options.js'

Просмотреть файл

@ -4,9 +4,9 @@ import { program } from 'commander'
import fs from 'fs'
import coreLib from '@actions/core'
import github from '../../../script/helpers/github.js'
import { getEnvInputs } from '../../../src/workflows/get-env-inputs.js'
import { createReportIssue, linkReports } from '../../../src/workflows/issue-report.js'
import github from '#src/workflows/github.js'
import { getEnvInputs } from '#src/workflows/get-env-inputs.js'
import { createReportIssue, linkReports } from '#src/workflows/issue-report.js'
// [start-readme]
//

Просмотреть файл

@ -223,7 +223,7 @@ describe('category pages', () => {
indexShortTitle ? ` or shortTitle "${indexShortTitle}"` : ' (no shortTitle)'
}`
const newCategoryDirPath = path.join(path.dirname(categoryDirPath), expectedSlugs.at(-1))
customMessage += `\nTo resolve this consider running:\n ./script/move-content.js ${categoryDirPath} ${newCategoryDirPath}\n`
customMessage += `\nTo resolve this consider running:\n ./src/content-render/scripts/move-content.js ${categoryDirPath} ${newCategoryDirPath}\n`
// Check if the directory name matches the expected slug
expect(expectedSlugs.includes(categoryDirName), customMessage).toBeTruthy()
})

Просмотреть файл

@ -11,9 +11,9 @@ import path from 'path'
import { mkdirp } from 'mkdirp'
import { program } from 'commander'
import { execSync } from 'child_process'
import frontmatter from '../lib/read-frontmatter.js'
import addRedirectToFrontmatter from '../src/redirects/scripts/helpers/add-redirect-to-frontmatter.js'
import walkFiles from './helpers/walk-files.js'
import frontmatter from '../../../lib/read-frontmatter.js'
import addRedirectToFrontmatter from '#src/redirects/scripts/helpers/add-redirect-to-frontmatter.js'
import walkFiles from '#src/workflows/walk-files.js'
const contentFiles = walkFiles('content', '.md')
const contentDir = path.posix.join(process.cwd(), 'content')

Просмотреть файл

@ -6,16 +6,16 @@
//
// By default, the `move-content.js` script will commit the changes it makes. If you don't want the script to run any git commands for you, run it with the `--no-git` flag. Note: In most cases it will be easier and safer to let the script run the git commands for you, since git can get confused when a file is both renamed and edited.
//
// To learn more about the script, you can run `script/move-content.js --help`.
// To learn more about the script, you can run `npm run move-content --help`.
//
// To run the script for a file:
// - `script/move-content.js PATH/TO/CURRENT-FILE.md PATH/TO/DESIRED-FILE-LOCATION-OR-NAME.md`
// - `npm run move-content PATH/TO/CURRENT-FILE.md PATH/TO/DESIRED-FILE-LOCATION-OR-NAME.md`
//
// To run the script for a folder:
// - `script/move-content.js PATH/TO/CURRENT-FOLDER PATH/TO/DESIRED-FOLDER-LOCATION-OR-NAME`
// - `npm run move-content PATH/TO/CURRENT-FOLDER PATH/TO/DESIRED-FOLDER-LOCATION-OR-NAME`
//
// To undo the script, run the same command that you used to run the script, but add an `--undo` flag:
// - `script/move-content.js --undo PATH/TO/OLD PATH/TO/NEW`
// - `npm run move-content --undo PATH/TO/OLD PATH/TO/NEW`
//
// [end-readme]
@ -28,8 +28,8 @@ import chalk from 'chalk'
import walk from 'walk-sync'
import yaml from 'js-yaml'
import fm from '../lib/frontmatter.js'
import readFrontmatter from '../lib/read-frontmatter.js'
import fm from '../../../lib/frontmatter.js'
import readFrontmatter from '../../../lib/read-frontmatter.js'
const CONTENT_ROOT = path.resolve('content')
const DATA_ROOT = path.resolve('data')

Просмотреть файл

@ -16,10 +16,10 @@ import chalk from 'chalk'
import GithubSlugger from 'github-slugger'
import { decode } from 'html-entities'
import frontmatter from '../lib/read-frontmatter.js'
import frontmatter from '../../../lib/read-frontmatter.js'
import { renderContent } from '#src/content-render/index.js'
import { allVersions } from '#src/versions/lib/all-versions.js'
import { ROOT } from '../lib/constants.js'
import { ROOT } from '../../../lib/constants.js'
const slugger = new GithubSlugger()
@ -86,7 +86,9 @@ async function main() {
console.log(chalk.dim('Run the following commands to rename them:'))
for (const { oldRelativePath, newRelativePath } of shouldRename) {
console.log(`./script/move-content.js ${oldRelativePath} ${newRelativePath}`)
console.log(
`./src/content-render/scripts/move-content.js ${oldRelativePath} ${newRelativePath}`,
)
}
} else {
console.log(chalk.green('No categories need to be renamed! 🎉'))

Просмотреть файл

@ -14,9 +14,9 @@ import path from 'path'
import walk from 'walk-sync'
import GithubSlugger from 'github-slugger'
import { decode } from 'html-entities'
import frontmatter from '../lib/read-frontmatter.js'
import frontmatter from '../../../lib/read-frontmatter.js'
import { execSync } from 'child_process'
import addRedirectToFrontmatter from '../src/redirects/scripts/helpers/add-redirect-to-frontmatter.js'
import addRedirectToFrontmatter from '#src/redirects/scripts/helpers/add-redirect-to-frontmatter.js'
const slugger = new GithubSlugger()

Просмотреть файл

@ -6,7 +6,7 @@ import { execSync } from 'child_process'
import { renderLiquid } from '#src/content-render/liquid/index.js'
import shortVersionsMiddleware from '#src/versions/middleware/short-versions.js'
const { loadPages } = await import('../lib/page-data.js')
const { loadPages } = await import('../../../lib/page-data.js')
const { allVersions } = await import('#src/versions/lib/all-versions.js')
const contentCopilotDir = path.join(process.cwd(), 'content-copilot')

3
src/dev-toc/README.md Normal file
Просмотреть файл

@ -0,0 +1,3 @@
# Developer table of contents
This directory generates a full table of contents for the docs.github.com site.

Просмотреть файл

@ -9,10 +9,10 @@ import { allVersionKeys } from '#src/versions/lib/all-versions.js'
import { liquid } from '#src/content-render/index.js'
import contextualize from '../../middleware/context.js'
const layoutFilename = path.posix.join(process.cwd(), 'script/dev-toc/layout.html')
const layoutFilename = path.posix.join(process.cwd(), 'src/dev-toc/layout.html')
const layout = fs.readFileSync(layoutFilename, 'utf8')
const staticDirName = 'script/dev-toc/static'
const staticDirName = 'src/dev-toc/static'
const staticDir = path.posix.join(process.cwd(), staticDirName)
if (!fs.existsSync(staticDir)) fs.mkdirSync(staticDir)
@ -67,7 +67,7 @@ async function main() {
// Add any defaultOpenSections to the context.
req.context.defaultOpenSections = defaultOpenSections
// Parse the layout in script/dev-toc/layout.html with the context we created above.
// Parse the layout in src/dev-toc/layout.html with the context we created above.
const outputHtml = await liquid.parseAndRender(layout, Object.assign({}, req.context))
// Write a static file for each version.

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -20,7 +20,7 @@ fi
pushd .. > /dev/null
if [ ! -d "docs-early-access" ]; then
echo "A 'docs-early-access' directory does not exist! Run script/early-access/clone-locally first."
echo "A 'docs-early-access' directory does not exist! Run src/early-access/scripts/clone-locally first."
popd > /dev/null
exit 0
fi

Просмотреть файл

@ -15,7 +15,7 @@ import { execFileSync } from 'child_process'
import frontmatter from '../../../lib/read-frontmatter.js'
import patterns from '../../../lib/patterns.js'
import addRedirectToFrontmatter from '#src/redirects/scripts/helpers/add-redirect-to-frontmatter.js'
import walkFiles from '../../../script/helpers/walk-files.js'
import walkFiles from '#src/workflows/walk-files.js'
const contentFiles = walkFiles('content', '.md', { includeEarlyAccess: true })
const contentDir = path.posix.join(process.cwd(), 'content')
@ -133,7 +133,7 @@ execFileSync('src/links/scripts/update-internal-links.js')
console.log(`
Done! Did the following:
- Moved content/${oldPathId} files to content/${newPathId}
- Ran script/early-access/update-data-and-images-paths.js
- Ran ./src/early-access/scripts/update-data-and-images-paths.js
- Added redirects to the moved files
- Updated children frontmatter entries in index.md files
- Ran ./src/links/scripts/update-internal-links.js

Просмотреть файл

@ -10,7 +10,7 @@
import fs from 'fs'
import path from 'path'
import { program } from 'commander'
import walkFiles from '../../../script/helpers/walk-files.js'
import walkFiles from '#src/workflows/walk-files.js'
import { escapeRegExp } from 'lodash-es'
import patterns from '../../../lib/patterns.js'

Просмотреть файл

@ -32,7 +32,7 @@ If you aren't comfortable going through the steps alone, sync up with a docs eng
```
src/ghes-releases/scripts/release-banner.js --action create --version <PLAN@RELEASE>
script/copy-fixture-data.js // This updates the fixtures to match the updated data/variables/release_candidate.yml file
src/tests/scripts/copy-fixture-data.js // This updates the fixtures to match the updated data/variables/release_candidate.yml file
```
- [ ] Create a PR with the above changes. This PR is used to track all docs changes and smoke tests associated with the release. For example https://github.com/github/docs-internal/pull/22286.
@ -74,7 +74,7 @@ This file should be automatically updated, but you can also run `src/ghes-releas
- [ ] Add any required smoke tests to the opening post in the megabranch PR.
Usually, we should smoke test any new GHES admin guides, any large features landing in this GHES version for the first time, and the REST and GraphQL API references.
- [ ] A few days before shipping, check for broken links. Run `script/check-english-links.js` in a local copy of the megabranch.
- [ ] A few days before shipping, check for broken links. Run `/src/links/scripts/rendered-content-link-checker-cli.js` in a local copy of the megabranch.
- [ ] [Freeze the repos](https://github.com/github/docs-content/blob/main/docs-content-docs/docs-content-workflows/freezing.md) at least 1-2 days before the release, and post an announcement in Slack so everybody knows. It's helpful to freeze the repos before doing the OpenAPI merges to avoid changes to the megabranch while preparing and deploying.
- [ ] Alert the Neon Squad (formally docs-ecosystem team) 1-2 days before the release to deploy to `github/github`. A PR should already be open in `github/github` to change the OpenAPI schema config `published` to `true` in `app/api/description/config/releases/ghes-<NEXT RELEASE NUMBER>.yaml`. They will need to:
- [ ] Get the required approval from `@github/ecosystem-api-reviewers` then deploy the PR to dotcom. This process generally takes 30-90 minutes.

Просмотреть файл

@ -1,6 +1,6 @@
import { Tokenizer } from 'liquidjs'
import { getLiquidConditionalsWithContent } from '../../../script/helpers/get-liquid-conditionals.js'
import { getLiquidConditionalsWithContent } from './get-liquid-conditionals.js'
import getVersionBlocks from './get-version-blocks.js'
import { allVersions } from '#src/versions/lib/all-versions.js'
import supportedOperators from '#src/content-render/liquid/ifversion-supported-operators.js'

Просмотреть файл

@ -14,7 +14,7 @@ import frontmatter from '../../../lib/read-frontmatter.js'
import removeLiquidStatements from './remove-liquid-statements.js'
import removeDeprecatedFrontmatter from './remove-deprecated-frontmatter.js'
import { all, getNextReleaseNumber } from '#src/versions/lib/enterprise-server-releases.js'
import walkFiles from '../../../script/helpers/walk-files.js'
import walkFiles from '#src/workflows/walk-files.js'
program
.description(

Просмотреть файл

@ -11,7 +11,7 @@ import { fileURLToPath } from 'url'
import path from 'path'
import fs from 'fs/promises'
import { getContents } from '../../../script/helpers/git-utils.js'
import { getContents } from '#src/workflows/git-utils.js'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const enterpriseDatesFile = path.join(__dirname, '../lib/enterprise-dates.json')

Просмотреть файл

@ -7,7 +7,7 @@ import path from 'path'
import { slug } from 'github-slugger'
import yaml from 'js-yaml'
import { getContents } from '../../../script/helpers/git-utils.js'
import { getContents } from '#src/workflows/git-utils.js'
import permissionSchema from './permission-list-schema.js'
import enabledSchema from './enabled-list-schema.js'
import { validateData } from '../../rest/scripts/utils/validate-data.js'

Просмотреть файл

@ -4,7 +4,7 @@ import path from 'path'
import { mkdirp } from 'mkdirp'
import yaml from 'js-yaml'
import { execSync } from 'child_process'
import { getContents, listMatchingRefs } from '../../../script/helpers/git-utils.js'
import { getContents, listMatchingRefs } from '#src/workflows/git-utils.js'
import { allVersions } from '#src/versions/lib/all-versions.js'
import processPreviews from './utils/process-previews.js'
import processUpcomingChanges from './utils/process-upcoming-changes.js'

Просмотреть файл

@ -61,7 +61,7 @@ console.warn = console.error = (...args) => {
// Weird import syntax, but forces it to load after process.env... changes
const { languageKeys } = await import('#src/languages/lib/languages.js')
const { loadPages, loadPageMap } = await import('../../../lib/page-data.js')
const { precompileRedirects } = await import('../../../src/redirects/lib/precompile.js')
const { precompileRedirects } = await import('#src/redirects/lib/precompile.js')
const { allVersions, allVersionKeys } = await import('#src/versions/lib/all-versions.js')
const { getProductStringFromPath } = await import('../../../lib/path-utils.js')

Просмотреть файл

@ -3,7 +3,7 @@
import { languageKeys } from '#src/languages/lib/languages.js'
import { makeLanguageSurrogateKey } from '../../../middleware/set-fastly-surrogate-key.js'
import purgeEdgeCache from '../../../script/deployment/purge-edge-cache.js'
import purgeEdgeCache from '#src/workflows/purge-edge-cache.js'
/**
* In simple terms, this script sends purge commands for...

Просмотреть файл

@ -1,6 +1,6 @@
/**
* This file exports a mix of strings and of regexes. Linkinator relies
* on this in `script/check-english-links.js` when we encounter external
* on this in `src/links/scripts/rendered-content-link-checker-cli.js` when we encounter external
* links that we *specifically ignore*. That means, that URLs or patterns
* mentioned in this file might appear within our content but we don't
* bother checking that they actually work.

Просмотреть файл

@ -7,7 +7,7 @@ import fs from 'fs'
import path from 'path'
import chalk from 'chalk'
import github from './github.js'
import github from '#src/workflows/github.js'
// Directs core logging to console
export function getCoreInject(debug) {

Просмотреть файл

@ -17,7 +17,7 @@ import fs from 'fs/promises'
import got, { RequestError } from 'got'
import { program } from 'commander'
import { getContents, getPathsWithMatchingStrings } from './helpers/git-utils.js'
import { getContents, getPathsWithMatchingStrings } from '#src/workflows/git-utils.js'
if (!process.env.GITHUB_TOKEN) {
throw new Error('Error! You must have a GITHUB_TOKEN set in an .env file to run this script.')

Просмотреть файл

@ -11,12 +11,9 @@ import fs from 'fs'
import path from 'path'
import { program, Option, InvalidArgumentError } from 'commander'
import renderedContentLinkChecker from '#src/links/scripts/rendered-content-link-checker.js'
import {
getCoreInject,
getUploadArtifactInject,
} from '../../../script/helpers/action-injections.js'
import { getCoreInject, getUploadArtifactInject } from '#src/links/scripts/action-injections.js'
import { allVersions } from '#src/versions/lib/all-versions.js'
import github from '../../../script/helpers/github.js'
import github from '#src/workflows/github.js'
const STATIC_PREFIXES = {
assets: path.resolve('assets'),

Просмотреть файл

@ -17,13 +17,13 @@ import warmServer from '../../../lib/warm-server.js'
import { liquid } from '#src/content-render/index.js'
import { deprecated } from '#src/versions/lib/enterprise-server-releases.js'
import excludedLinks from '#src/links/lib/excluded-links.js'
import { getEnvInputs, boolEnvVar } from '../../../src/workflows/get-env-inputs.js'
import { getEnvInputs, boolEnvVar } from '#src/workflows/get-env-inputs.js'
import { debugTimeEnd, debugTimeStart } from './debug-time-taken.js'
import { uploadArtifact as uploadArtifactLib } from './upload-artifact.js'
import github from '../../../script/helpers/github.js'
import { getActionContext } from '../../../src/workflows/action-context.js'
import github from '#src/workflows/github.js'
import { getActionContext } from '#src/workflows/action-context.js'
import { createMinimalProcessor } from '#src/content-render/unified/processor.js'
import { createReportIssue, linkReports } from '../../../src/workflows/issue-report.js'
import { createReportIssue, linkReports } from '#src/workflows/issue-report.js'
const STATIC_PREFIXES = {
assets: path.resolve('assets'),

Просмотреть файл

@ -18,7 +18,7 @@ import yaml from 'js-yaml'
import { updateInternalLinks } from '#src/links/lib/update-internal-links.js'
import frontmatter from '../../../lib/read-frontmatter.js'
import walkFiles from '../../../script/helpers/walk-files.js'
import walkFiles from '#src/workflows/walk-files.js'
program
.description('Update internal links in content files')

Просмотреть файл

@ -15,7 +15,7 @@ import { allVersions, getDocsVersion } from '#src/versions/lib/all-versions.js'
import { REST_DATA_DIR, REST_SCHEMA_FILENAME } from '../lib/index.js'
import { nonAutomatedRestPaths } from '../lib/config.js'
import { deprecated } from '#src/versions/lib/enterprise-server-releases.js'
import walkFiles from '../../../script/helpers/walk-files.js'
import walkFiles from '#src/workflows/walk-files.js'
export async function getDiffOpenAPIContentRest() {
const contentFiles = getAutomatedMarkdownFiles('content/rest')

Просмотреть файл

@ -85,7 +85,7 @@ Why do we need this? For our daily shipping needs, it's tolerable that search up
- [components/lib/search.ts](components/lib/search.ts) - The browser-side code that enables search.
- [lib/search/client.js](lib/search/client.js) - A thin wrapper around the Node.js module for interacting with the search API.
- [lib/search/search-index.js](lib/search/search-index.js) - A class for generating structured search data from repository content and syncing it. This class has built-in validation to ensure that all records are valid before they're uploaded. This class also takes care of removing deprecated records, and compares existing remote records with the latest local records to avoid uploading records that haven't changed.
- [script/sync-search-indices.js](script/sync-search-indices.js) - The script used by the Actions workflow to update search indices. This can also be [run in the development environment](#development).
- [src/search/scripts/sync-search-indices.js](src/search/scripts/sync-search-indices.js) - The script used by the Actions workflow to update search indices. This can also be [run in the development environment](#development).
- [tests/content/search.js](tests/content/search.js) - Tests!
## Indices

Просмотреть файл

@ -8,7 +8,7 @@ import { HTTPError } from 'got'
import parsePageSectionsIntoRecords from './parse-page-sections-into-records.js'
import getPopularPages from './popular-pages.js'
import languages from '#src/languages/lib/languages.js'
import domwaiter from '../../../script/domwaiter.js'
import domwaiter from './domwaiter.js'
const pageMarker = chalk.green('|')
const recordMarker = chalk.grey('.')

Просмотреть файл

Просмотреть файл

@ -15,7 +15,7 @@ import { program, Option, InvalidArgumentError } from 'commander'
import chalk from 'chalk'
import dotenv from 'dotenv'
import { retryOnErrorTest } from '../../../script/helpers/retry-on-error-test.js'
import { retryOnErrorTest } from './retry-on-error-test.js'
import { languageKeys } from '#src/languages/lib/languages.js'
import { allVersions } from '#src/versions/lib/all-versions.js'

5
src/tests/README.md Normal file
Просмотреть файл

@ -0,0 +1,5 @@
# Tests
This directory contains utilities to support our automated testing efforts.
**This directory should not include test suites.** Please use the best subject folder available.

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,6 +1,6 @@
#!/usr/bin/env node
import { main } from '../start-server.js'
import { main } from '../../../start-server.js'
import { PORT, START_JEST_SERVER, isServerHealthy, isPortRunning } from './server-for-jest.js'

Просмотреть файл

@ -38,7 +38,7 @@ async function run() {
const milestone = process.argv[2]
if (!acceptedMilestones.includes(milestone)) {
console.log("Please specify either 'release' or 'deprecation'\n")
console.log('Example: script/open-enterprise-issue.js release')
console.log('Example: src/versions/scripts/create-enterprise-issue.js release')
process.exit(1)
}

Просмотреть файл

@ -1,3 +1,5 @@
# Workflows
This directory contains workflow scripts that cannot otherwise be in other subject folders.
This directory does not contain a `scripts/` folder, as every file in here would belong in `scripts/`.

Просмотреть файл

Просмотреть файл

@ -18,7 +18,7 @@
//
// export GITHUB_TOKEN=github_pat_11AAAG.....
// export APP_URL=https://docs.github.com
// ./script/content-changes-table-comment.js github docs-internal main 4a0b0f2
// ./src/workflows/content-changes-table-comment.js github docs-internal main 4a0b0f2
//
// [end-readme]

Просмотреть файл

@ -3,7 +3,7 @@
import * as github from '@actions/github'
import core from '@actions/core'
import { getContents } from '../../script/helpers/git-utils.js'
import { getContents } from './git-utils.js'
import parse from '../../lib/read-frontmatter.js'
import getApplicableVersions from '#src/versions/lib/get-applicable-versions.js'
import nonEnterpriseDefaultVersion from '#src/versions/lib/non-enterprise-default-version.js'

Просмотреть файл

@ -3,7 +3,7 @@ import got from 'got'
import { setOutput } from '@actions/core'
import github from '../../script/helpers/github.js'
import github from './github.js'
import { getActionContext } from './action-context.js'
async function main() {

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,6 +1,6 @@
#!/usr/bin/env node
import { SURROGATE_ENUMS } from '../../middleware/set-fastly-surrogate-key.js'
import purgeEdgeCache from '../../script/deployment/purge-edge-cache.js'
import purgeEdgeCache from './purge-edge-cache.js'
// This will purge every response that *contains*
// `process.env.FASTLY_SURROGATE_KEY || SURROGATE_ENUMS.DEFAULT`.

Просмотреть файл

Просмотреть файл

@ -26,7 +26,7 @@ Once you've followed the development instructions above, you can run the entire
test suite locally:
```shell
script/test # or `npm test`
npm test
```
### Watching all the tests

2
tests/fixtures/README.md поставляемый
Просмотреть файл

@ -73,7 +73,7 @@ There's a script you can always run that makes sure all and any of these
files are up to do:
```shell
./script/copy-fixture-data.js
./src/tests/scripts/copy-fixture-data.js
```
It's safe to run any time. And it might be necessary to run so that

Просмотреть файл

@ -8,7 +8,7 @@ import enterpriseServerReleases, {
} from '#src/versions/lib/enterprise-server-releases.js'
import Page from '../../lib/page.js'
import { get, head } from '../helpers/e2etest.js'
import versionSatisfiesRange from '../../src/versions/lib/version-satisfies-range.js'
import versionSatisfiesRange from '#src/versions/lib/version-satisfies-range.js'
const __dirname = path.dirname(fileURLToPath(import.meta.url))

Просмотреть файл

@ -103,7 +103,7 @@ describe('pages module', () => {
nonMatches.length === 1 ? 'file' : 'files'
} that do not match their slugified titles.\n
${nonMatches.join('\n')}\n
To fix, run script/reconcile-filenames-with-ids.js\n\n`
To fix, run src/content-render/scripts/reconcile-filenames-with-ids.js\n\n`
expect(nonMatches.length, message).toBe(0)
})