1
0
mirror of synced 2025-12-19 18:10:59 -05:00

make sure all scripts are aliased in package.json (#47375)

This commit is contained in:
Peter Bengtsson
2023-12-07 08:21:20 -05:00
committed by GitHub
parent 024de423ca
commit 309587f39a
13 changed files with 40 additions and 23 deletions

View File

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

View File

@@ -41,7 +41,7 @@ jobs:
REPORT_AUTHOR: docs-bot
REPORT_LABEL: broken content markdown report
REPORT_REPOSITORY: github/docs-content
run: node src/content-linter/scripts/post-lints.js --path /tmp/error-lints.json
run: npm run post-lints -- --path /tmp/error-lints.json
- uses: ./.github/actions/slack-alert
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}

View File

@@ -40,7 +40,7 @@ jobs:
src/fixtures/fixtures/content/get-started/quickstart/hello-world.md \
src/fixtures/fixtures/content/get-started/quickstart/hello-wurld.md
node src/content-render/scripts/test-moved-content.js \
npm run test-moved-content -- \
src/fixtures/fixtures/content/get-started/quickstart/hello-world.md \
src/fixtures/fixtures/content/get-started/quickstart/hello-wurld.md
@@ -55,7 +55,7 @@ jobs:
src/fixtures/fixtures/content/code-security/getting-started \
src/fixtures/fixtures/content/code-security/got-started
node src/content-render/scripts/test-moved-content.js \
npm run test-moved-content -- \
src/fixtures/fixtures/content/code-security/getting-started \
src/fixtures/fixtures/content/code-security/got-started

View File

@@ -41,7 +41,7 @@ jobs:
run: |
set -e
filesToRemove=`./src/assets/scripts/find-orphaned-assets.js`
filesToRemove=`npm run find-orphaned-assets`
[ -z "$filesToRemove" ] && exit 0
echo $filesToRemove | xargs git rm
@@ -64,7 +64,7 @@ jobs:
gh pr create \
--title "Delete orphaned assets ($date)" \
--body "Found with the find-orphaned-assets.js script.\n\nFor more info see https://github.com/github/docs-engineering/blob/main/docs/orphaned-assets.md" \
--body "Found with the 'npm run find-orphaned-assets' script.\n\nFor more info see https://github.com/github/docs-engineering/blob/main/docs/orphaned-assets.md" \
--repo github/docs-internal \
--label docs-content-fr

View File

@@ -104,7 +104,7 @@ jobs:
- name: Check the test fixture data (if applicable)
if: ${{ matrix.name == 'fixtures' }}
run: ./src/tests/scripts/copy-fixture-data.js --check
run: npm run copy-fixture-data -- --check
# This keeps our fixture content/data in check
- name: Check the test fixture content (if applicable)
@@ -114,11 +114,11 @@ jobs:
run: |
# If either of these fail, it means our fixture content's internal
# links can and should be updated.
./src/links/scripts/update-internal-links.js --dry-run --check --strict \
npm run update-internal-links -- --dry-run --check --strict \
src/fixtures/fixtures/content \
--exclude src/fixtures/fixtures/content/get-started/foo/typo-autotitling.md \
--exclude src/fixtures/fixtures/content/get-started/foo/anchor-autotitling.md
./src/links/scripts/update-internal-links.js --dry-run --check --strict \
npm run update-internal-links -- --dry-run --check --strict \
src/fixtures/fixtures/data
- name: Clone all translations

View File

@@ -85,7 +85,7 @@ jobs:
env:
POPULAR_PAGES_JSON: popular-pages/records/popular-pages.json
run: |
node src/languages/scripts/create-translation-health-report.js \
npm run create-translation-health-report -- \
--language ${{ matrix.language }} \
--gitref ${{ env.gitref }} \
>> $GITHUB_WORKSPACE/translation-health-report.json

View File

@@ -16,9 +16,15 @@
},
"exports": "./src/frame/server.js",
"scripts": {
"analyze-text": "node src/search/scripts/analyze-text.js",
"archive-version": "node src/ghes-releases/scripts/archive-version.js",
"build": "next build",
"check-github-github-links": "node src/links/scripts/check-github-github-links.js",
"copy-fixture-data": "node src/tests/scripts/copy-fixture-data.js",
"create-translation-health-report": "node src/languages/scripts/create-translation-health-report.js",
"debug": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon --inspect src/frame/server.js",
"dev": "cross-env npm start",
"find-orphaned-assets": "node src/assets/scripts/find-orphaned-assets.js",
"fixture-dev": "cross-env ROOT=src/fixtures/fixtures npm start",
"fixture-test": "cross-env ROOT=src/fixtures/fixtures npm test -- src/fixtures/tests",
"index-test-fixtures": "node src/search/scripts/index-elasticsearch.js -l en -l ja -V ghae -V dotcom --index-prefix tests -- src/search/tests/fixtures/search-indexes",
@@ -28,16 +34,21 @@
"move-content": "node src/content-render/scripts/move-content.js",
"openapi-docs": "node src/rest/docs.js",
"playwright-test": "playwright test --config src/fixtures/playwright.config.ts --project=\"Google Chrome\"",
"post-lints": "node src/content-linter/scripts/post-lints.js",
"postinstall": "cp package-lock.json .installed.package-lock.json && echo \"Updated .installed.package-lock.json\" # see husky/post-checkout and husky/post-merge",
"prepare": "husky install src/workflows/husky",
"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 src/workflows/prevent-pushes-to-main.js",
"release-banner": "node src/ghes-releases/scripts/release-banner.js",
"remove-version-markup": "node src/ghes-releases/scripts/remove-version-markup.js",
"rendered-content-link-checker-cli": "node src/links/scripts/rendered-content-link-checker-cli.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-",
"start": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon src/frame/server.js",
"start-all-languages": "cross-env NODE_ENV=development nodemon src/frame/server.js",
"start-for-playwright": "cross-env ROOT=src/fixtures/fixtures TRANSLATIONS_FIXTURE_ROOT=src/fixtures/fixtures/translations ENABLED_LANGUAGES=en,ja NODE_ENV=test node src/frame/server.js",
"symlink-from-local-repo": "node src/early-access/scripts/symlink-from-local-repo.js",
"sync-rest": "node src/rest/scripts/update-files.js",
"sync-search": "cross-env NODE_OPTIONS='--max_old_space_size=8192' start-server-and-test sync-search-server 4002 sync-search-indices",
"sync-search-ghes-release": "cross-env GHES_RELEASE=1 start-server-and-test sync-search-server 4002 sync-search-indices",
@@ -45,8 +56,14 @@
"sync-search-server": "cross-env NODE_ENV=production PORT=4002 MINIMAL_RENDER=true CHANGELOG_DISABLED=true node src/frame/server.js",
"sync-webhooks": "src/rest/scripts/update-files.js -o webhooks",
"test": "cross-env NODE_OPTIONS='--max_old_space_size=4096 --experimental-vm-modules' jest --logHeapUsage",
"test-moved-content": "node src/content-render/scripts/test-moved-content.js",
"test-watch": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --watch --notify --notifyMode=change --coverage",
"tsc": "tsc --noEmit"
"toggle-ghae-feature-flags": "node src/versions/scripts/toggle-ghae-feature-flags.js",
"tsc": "tsc --noEmit",
"update-data-and-image-paths": "node src/early-access/scripts/update-data-and-image-paths.js",
"update-internal-links": "node src/links/scripts/update-internal-links.js",
"validate-asset-images": "node src/assets/scripts/validate-asset-images.js",
"warmup-remotejson": "node src/archives/scripts/warmup-remotejson.js"
},
"lint-staged": {
"*.{js,mjs,ts,tsx}": "eslint --cache --fix",

View File

@@ -24,6 +24,6 @@ git clone https://github.com/github/docs-early-access.git
popd > /dev/null
# Symlink the local docs-early-access repo into this repo
node src/early-access/scripts/symlink-from-local-repo.js -p ../docs-early-access
npm run symlink-from-local-repo -- -p ../docs-early-access
echo -e '\nDone!'

View File

@@ -60,7 +60,7 @@ The dates we use for Enterprise releases and deprecations are stored in [release
1. Do a dry run by scraping a small amount of files to test locally on your machine. This command does not overwrite the references to asset files so they will render on your machine.
```shell
node --max-old-space-size=8192 src/ghes-releases/scripts/archive-version.js --dry-run --local-dev
npm run archive-version -- --dry-run --local-dev
```
1. Navigate to the scraped files directory (`tmpArchivalDir_<VERSION_TO_DEPRECATE>`) inside your docs-internal checkout. Open a few HTML files and ensure they render and drop-down pickers work correctly.
@@ -68,7 +68,7 @@ The dates we use for Enterprise releases and deprecations are stored in [release
1. If the dry-run looks good, scrape all content files. This will take about 20-30 minutes. **Note:** This will overwrite the directory that was previously generated with new files. You can also create a specific output directory using the `--output` flag.
```shell
node --max-old-space-size=8192 src/ghes-releases/scripts/archive-version.js
npm run archive-version
```
1. Revert changes to `src/search/components/Search.tsx`.
@@ -90,7 +90,7 @@ The dates we use for Enterprise releases and deprecations are stored in [release
1. Click `Containers` in the left sidebar, then click the `enterprise` container.
1. Click `Upload` in the top bar. Drag and drop or click `Browse for files` to select the directory inside of `tmpArchivalDir_<VERSION_TO_DEPRECATE>`. For example, at the time of this writing, the directory name was `3.5`. The upload will take several minutes and the UI may not give feedback immediately. Don't close the browser tab or navigate away from the page until the upload is complete.
App method:
1. Open the Microsoft Azure Storage Explorer app from the `Overview` tab [githubdocs Azure Storage Blob resource page](https://portal.azure.com/#@githubazure.onmicrosoft.com/resource/subscriptions/fa6134a7-f27e-4972-8e9f-0cedffa328f1/resourceGroups/docs-production/providers/Microsoft.Storage/storageAccounts/githubdocs/overview).
@@ -144,7 +144,7 @@ This step will remove the version from the drop-down picker, effectively depreca
1. Manually delete the deprecated directory in `data/graphql`. For example, if you are deprecating the 3.5 release, you'd delete the `data/graphql/ghes-3.5` directory.
1. Open a new PR. Reviewers will be automatically assigned.
1. Open a new PR. Reviewers will be automatically assigned.
1. When the PR is approved, merge it in. 🚢
@@ -157,7 +157,7 @@ This step will remove the version from the drop-down picker, effectively depreca
1. Remove the outdated Liquid markup and frontmatter.
```shell
src/ghes-releases/scripts/remove-version-markup.js --release <number>
npm run remove-version-markup -- --release <number>
```
1. If data resuables were deleted automatically, you'll need to remove references to the deleted reusable in the content. Using VSCode to find the occurrences is quick and there are typically only a few to update. If you have any questions, reach out to the docs-content team in #docs-content to ask for help updating the Markdown files.
@@ -178,7 +178,7 @@ This step will remove the version from the drop-down picker, effectively depreca
## Re-scraping a page or all pages
Occasionally, a change will need to be added to our archived enterprise versions. If this occurs, you can check out the `enterprise-<release number>-release` branch and re-scrape the page or all pages using `src/ghes-releases/scripts/archive-version.js`. To scrape a single page you can use the `—page <page relative path>` option.
Occasionally, a change will need to be added to our archived enterprise versions. If this occurs, you can check out the `enterprise-<release number>-release` branch and re-scrape the page or all pages using `npm run archive-version`. To scrape a single page you can use the `—page <page relative path>` option.
For each language, upload the new file to Azure blob storage in the `enterprise` container.

View File

@@ -31,7 +31,7 @@ If you aren't comfortable going through the steps alone, sync up with a docs eng
- [ ] If this is a release candidate release, add a Release Candidate banner:
```
src/ghes-releases/scripts/release-banner.js --action create --version <PLAN@RELEASE>
npm run release-banner -- --action create --version <PLAN@RELEASE>
```
- [ ] 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.
@@ -73,7 +73,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 `/src/links/scripts/rendered-content-link-checker-cli.js` in a local copy of the megabranch.
- [ ] A few days before shipping, check for broken links. Run `npm run rendered-content-link-checker-cli` 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.

View File

@@ -17,7 +17,7 @@ const tokenize = (str) => {
return tokenizer.readTopLevelTokens()
}
// This module is used by
// src/ghes-releases/scripts/remove-version-markup.js to remove
// `npm run remove-version-markup` to remove
// and update Liquid conditionals when a GHES release is being deprecated. It is also used by
// src/ghes-releases/tests/remove-liquid-statements.js.
export default function removeLiquidStatements(content, release, nextOldestRelease, file) {

View File

@@ -8,7 +8,7 @@
/* Nota bene:
If you are getting more errors all the sudden, try running this:
$ src/languages/scripts/create-translation-health-report.js -l en -r 000
$ npm run create-translation-health-report -- -l en -r 000
If there's any errors before getting the JSON output,
const context = { ... } probably needs more data.
*/

View File

@@ -8,7 +8,7 @@
//
// Example:
//
// ./src/search/scripts/analyze-text.js my words to tokenize
// npm run analyze-text "my words" to tokenize
//
// [end-readme]