Skip to content

Commit 748d1e3

Browse files
heiskrpeterbe
andauthored
Move files out of script/ (#45454)
Co-authored-by: Peter Bengtsson <[email protected]>
1 parent 3ecf408 commit 748d1e3

File tree

86 files changed

+121
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+121
-111
lines changed

.dockerignore

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
contributing/
66
docs/
77
node_modules/
8-
script/
98
tests/
109
# Folder is cloned during the preview + prod workflows, the assets are merged into other locations for use before the build
1110
docs-early-access/

.eslintrc.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
"tmp/*",
2121
"!/.*",
2222
"/.next/",
23-
"script/bookmarklets/*",
23+
"src/bookmarklets/*",
2424
"src/open-source/scripts/add-pr-links.js",
2525
"src/open-source/scripts/pr-link-source.js",
2626
"rest-api-description/",

.github/actions/warmup-remotejson-cache/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ runs:
3333
- name: Run script
3434
if: ${{ inputs.restore-only == '' }}
3535
shell: bash
36-
run: node script/warmup-remotejson.js
36+
run: node src/archives/scripts/warmup-remotejson.js
3737

3838
- name: Cache .remotejson-cache (save)
3939
if: ${{ inputs.restore-only == '' }}

.github/workflows/check-broken-links-github-github.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
6767
- name: Run broken github/github link check
6868
run: |
69-
script/check-github-github-links.js broken_github_github_links.md
69+
src/links/scripts/check-github-github-links.js broken_github_github_links.md
7070
7171
- name: Get title for issue
7272
# If the file 'broken_github_github_links.md' got created,

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104

105105
- name: Check the test fixture data (if applicable)
106106
if: ${{ matrix.name == 'rendering-fixtures' }}
107-
run: ./script/copy-fixture-data.js --check
107+
run: ./src/tests/scripts/copy-fixture-data.js --check
108108

109109
# This keeps our fixture content/data in check
110110
- name: Check the test fixture content (if applicable)

.github/workflows/triage-unallowed-contributions.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ on:
1313
- 'assets/fonts/**'
1414
- 'data/graphql/**'
1515
- 'Dockerfile*'
16-
- 'src/**'
16+
- 'src/*/scripts/**'
17+
- 'src/**.json'
18+
- 'src/workflows/**'
1719
- 'lib/redirects/**'
1820
- 'package*.json'
19-
- 'script/**'
2021
- 'content/actions/deployment/security-hardening-your-deployments/**'
2122

2223
permissions:
@@ -55,10 +56,11 @@ jobs:
5556
- 'assets/fonts/**'
5657
- 'data/graphql/**'
5758
- 'Dockerfile*'
58-
- 'src/**'
59+
- 'src/*/scripts/**'
60+
- 'src/**.json'
61+
- 'src/workflows/**'
5962
- 'lib/redirects/**'
6063
- 'package*.json'
61-
- 'scripts/**'
6264
- 'content/actions/deployment/security-hardening-your-deployments/**'
6365
6466
# When there are changes to files we can't accept, leave a comment
@@ -75,10 +77,11 @@ jobs:
7577
'assets/fonts/**',
7678
'data/graphql/**',
7779
'Dockerfile*',
78-
'src/**',
80+
'src/*/scripts/**',
81+
'src/**.json',
82+
'src/workflows/**',
7983
'lib/redirects/**',
8084
'package*.json',
81-
'scripts/**',
8285
'content/actions/deployment/security-hardening-your-deployments/**',
8386
]
8487

.github/workflows/validate-asset-images.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Validate asset images
22

3-
# **What it does**: Run ./script/validate-asset-images.js on all images in assets/
3+
# **What it does**: Run ./src/assets/scripts/validate-asset-images.js on all images in assets/
44
# **Why we have it**: To protect from innocent and potentially malicious bad image assets
55
# **Who does it impact**: Docs content.
66

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ coverage/
99
/assets/images/early-access
1010
/content/early-access
1111
/data/early-access
12-
/script/dev-toc/static
12+
/src/dev-toc/static
1313
.next
1414
.eslintcache
1515
*.tsbuildinfo
@@ -30,7 +30,7 @@ lib/redirects/.redirects-cache*.json
3030
user-code/
3131

3232
# Logs from scripts
33-
script/logs/
33+
*/logs/
3434
external-link-checker-db.json
3535

3636
# Playwright related

.prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
data/release-notes/
2-
script/bookmarklets/
2+
src/bookmarklets/
33
src/open-source/scripts/add-pr-links.js
44
/.next/
55

content/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ featuredLinks:
196196

197197
### `allowTitleToDifferFromFilename`
198198

199-
- 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`.
199+
- 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`.
200200
- Type: `Boolean`. Default is `false`.
201201
- Optional.
202202

content/contributing/setting-up-your-environment-to-work-on-github-docs/creating-a-local-environment.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ If you would like to read more about debugging and troubleshooting the {% data v
6767

6868
### Using browser shortcuts
6969

70-
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).
70+
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).
7171

7272
### Enabling different languages
7373

content/contributing/setting-up-your-environment-to-work-on-github-docs/troubleshooting-your-environment.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ git push
3434

3535
## Troubleshooting local server problems
3636

37-
If you are running `script/server` and get a `Cannot find module` error, try the following command before restarting the server.
37+
If you are running `npm start` and get a `Cannot find module` error, try the following command before restarting the server.
3838

3939
```shell
4040
npm install
@@ -52,7 +52,7 @@ npm install
5252
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.
5353

5454
```shell
55-
script/server
55+
npm start
5656
```
5757

5858
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.

content/contributing/writing-for-github-docs/using-yaml-frontmatter.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ featuredLinks:
188188

189189
### `allowTitleToDifferFromFilename`
190190

191-
- 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`.
191+
- 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`.
192192
- Type: `Boolean`. Default is `false`.
193193
- Optional.
194194

@@ -225,7 +225,7 @@ defaultTool: cli
225225
### `learningTracks`
226226

227227
- Purpose: Render a list of learning tracks on a product's sub-landing page.
228-
- type: `String`. This should reference learning tracks' names defined in [`data/learning-tracks/*.yml`](https://github.com/github/docs/tree/main/data/learning-tracks).
228+
- Type: `String`. This should reference learning tracks' names defined in [`data/learning-tracks/*.yml`](https://github.com/github/docs/tree/main/data/learning-tracks).
229229
- Optional
230230

231231
{% note %}

contributing/development.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ In a matter of minutes, you will be ready to edit, preview and test your changes
3838

3939
### Using browser shortcuts
4040

41-
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.
41+
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.
4242

4343
### Enabling different languages
4444

contributing/troubleshooting.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,35 @@ If a staging deployment is pending for more than 5-10min, try the following:
2727
2. If that doesn't work, trigger a new staging deployment by pushing an empty commit on the command line:
2828

2929
```
30-
$ git commit --allow-empty -m 'empty commit to redeploy staging'
30+
git commit --allow-empty -m 'empty commit to redeploy staging'
3131
```
3232

3333
### CI stalled or stuck
3434
:yellow_heart: If tests are stuck yellow for more than an hour, rerun CI by pushing an empty commit on the command line:
3535

3636
```
37-
$ git commit --allow-empty -m 'empty commit to rerun CI'
37+
git commit --allow-empty -m 'empty commit to rerun CI'
3838
```
3939

4040
### Can't run the site locally
41-
If you are running `script/server` and get a `Cannot find module` error, try:
41+
If you are running `npm start` and get a `Cannot find module` error, try:
4242

4343
```
44-
$ npm install
44+
npm install
4545
```
4646

4747
If that doesn't fix it, try:
4848

4949
```
50-
$ rm -rf node_modules
51-
$ npm install
50+
rm -rf node_modules
51+
npm install
5252
```
5353

5454
### Failed staging deployment
5555
Check out the branch and run the site locally:
5656

5757
```
58-
$ script/server
58+
npm start
5959
```
6060

6161
Go to https://localhost:4000
@@ -77,7 +77,7 @@ make sure single quotes are properly escaped in the frontmatter. Also, check the
7777
Check out the branch and run the site locally:
7878

7979
```
80-
$ script/server
80+
npm start
8181
```
8282

8383
Go to whatever page is 500ing on staging on your local server: https://localhost:4000/page-with-error

contributing/working-in-docs-repository.md

-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,4 @@ Here's some information that might be helpful while working on a Docs PR:
1616

1717
- [Liquid](/contributing/liquid-helpers.md) - We use liquid helpers to create different versions of our content.
1818

19-
- [Scripts](/script/README.md) - The scripts directory is the home for all of the scripts you can run locally.
20-
2119
- [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.

jest.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ export default {
2525
testPathIgnorePatterns: ['node_modules/', 'vendor/', 'tests/fixtures/', 'tests/helpers/'],
2626
testMatch: ['**/tests/**/*.js'],
2727
testLocationInResults: isActions,
28-
globalSetup: './script/start-server-for-jest.js',
29-
globalTeardown: './script/kill-server-for-jest.js',
28+
globalSetup: './src/tests/scripts/start-server-for-jest.js',
29+
globalTeardown: './src/tests/scripts/kill-server-for-jest.js',
3030
}

middleware/context.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from '../lib/path-utils.js'
1212
import productNames from '../lib/product-names.js'
1313
import warmServer from '../lib/warm-server.js'
14-
import searchVersions from '../src/search/lib/versions.js'
14+
import searchVersions from '#src/search/lib/versions.js'
1515
import nonEnterpriseDefaultVersion from '#src/versions/lib/non-enterprise-default-version.js'
1616
import { getDataByLanguage, getUIDataMerged } from '../lib/get-data.js'
1717

package.json

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

script/warmup-remotejson.js src/archives/scripts/warmup-remotejson.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import { program } from 'commander'
2222
import semver from 'semver'
2323

24-
import getRemoteJSON from '../middleware/get-remote-json.js'
24+
import getRemoteJSON from '../../../middleware/get-remote-json.js'
2525
import {
2626
deprecated,
2727
firstReleaseStoredInBlobStorage,

src/assets/scripts/deleted-assets-pr-comment-1.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Example use:
1414
//
1515
// export GITHUB_TOKEN=github_pat_11AAAG.....
16-
// ./script/deleted-assets-pr-comment.js github docs-internal main 4a0b0f2
16+
// ./src/assets/scripts/deleted-assets-pr-comment.js github docs-internal main 4a0b0f2
1717
//
1818
// [end-readme]
1919

src/assets/scripts/find-orphaned-assets.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import path from 'path'
1212
import { program } from 'commander'
1313
import walk from 'walk-sync'
1414

15-
import walkFiles from '../../../script/helpers/walk-files.js'
15+
import walkFiles from '#src/workflows/walk-files.js'
1616
import languages from '#src/languages/lib/languages.js'
1717

1818
const EXCEPTIONS = new Set([

src/audit-logs/scripts/sync.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { readFile, writeFile } from 'fs/promises'
1414
import { mkdirp } from 'mkdirp'
1515
import path from 'path'
1616

17-
import { getContents, getCommitSha } from '../../../script/helpers/git-utils.js'
17+
import { getContents, getCommitSha } from '#src/workflows/git-utils.js'
1818

1919
if (!process.env.GITHUB_TOKEN) {
2020
throw new Error('GITHUB_TOKEN environment variable must be set to run this script')

script/bookmarklets/README.md src/bookmarklets/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ Clicking the bookmark will then execute the JavaScript.
1515

1616
## "View in development" toggle
1717

18-
[`script/bookmarklets/view-in-development.js`](./view-in-development.js)
18+
[`src/bookmarklets/view-in-development.js`](./view-in-development.js)
1919

2020
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.
2121

2222
## "View in production" toggle
2323

24-
[`script/bookmarklets/view-in-production.js`](./view-in-production.js)
24+
[`src/bookmarklets/view-in-production.js`](./view-in-production.js)
2525

2626
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.
2727

2828
## Open a docs article in VS Code
2929

30-
[`script/bookmarklets/open-in-vscode.js`](./open-in-vscode.js)
30+
[`src/bookmarklets/open-in-vscode.js`](./open-in-vscode.js)
3131

3232
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.
3333

3434
The installation requires a few steps:
3535

36-
1. Copy the contents of [`script/bookmarklets/open-in-vscode.js`](./open-in-vscode.js).
36+
1. Copy the contents of [`src/bookmarklets/open-in-vscode.js`](./open-in-vscode.js).
3737
1. Browse to https://chriszarate.github.io/bookmarkleter/ and paste the code into the box.
3838
1. Find the path of **your local checkout** of the docs repo you want to open files from (for example, `/Users/<USERNAME>/repos/docs`).
3939
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:
4242

4343
## Add preview links to PRs
4444

45-
[`script/bookmarklets/add-pr-links.js`](./add-pr-links.js)
45+
[`src/bookmarklets/add-pr-links.js`](./add-pr-links.js)
4646

4747
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.)
4848

49-
Note: readable JavaScript source lives in `script/bookmarklets/pr-link-source.js`. The bookmarklet code was generated via https://chriszarate.github.io/bookmarkleter.
49+
Note: readable JavaScript source lives in `src/bookmarklets/pr-link-source.js`. The bookmarklet code was generated via https://chriszarate.github.io/bookmarkleter.
File renamed without changes.

src/content-linter/scripts/disable-rules.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//
66
// Usage:
77
//
8-
// script/markdownlint-disable.js no-generic-link-text
8+
// src/content-linter/scripts/disable-rules.js no-generic-link-text
99

1010
import fs from 'fs'
1111
import { spawn } from 'child_process'

src/content-linter/scripts/lint-content.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { applyFixes } from 'markdownlint-rule-helpers'
99
import boxen from 'boxen'
1010
import ora from 'ora'
1111

12-
import walkFiles from '../../../script/helpers/walk-files.js'
12+
import walkFiles from '#src/workflows/walk-files.js'
1313
import { allConfig, allRules, customRules } from '../lib/helpers/get-rules.js'
1414
import { customConfig, githubDocsFrontmatterConfig } from '../style/github-docs.js'
1515
import { defaultConfig } from '../lib/default-markdownlint-options.js'

src/content-linter/scripts/post-lints.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { program } from 'commander'
44
import fs from 'fs'
55
import coreLib from '@actions/core'
66

7-
import github from '../../../script/helpers/github.js'
8-
import { getEnvInputs } from '../../../src/workflows/get-env-inputs.js'
9-
import { createReportIssue, linkReports } from '../../../src/workflows/issue-report.js'
7+
import github from '#src/workflows/github.js'
8+
import { getEnvInputs } from '#src/workflows/get-env-inputs.js'
9+
import { createReportIssue, linkReports } from '#src/workflows/issue-report.js'
1010

1111
// [start-readme]
1212
//

src/content-linter/tests/category-pages.js

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

0 commit comments

Comments
 (0)