-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sticky-bcd-headers-desktop
- Loading branch information
Showing
362 changed files
with
17,525 additions
and
12,675 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ cloud-function/**/*.js | |
filecheck/*.js | ||
mdn/content/ | ||
tool/*.js | ||
bins/*.mjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Compare bundle size | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
# Build current and upload stats.json | ||
build-head: | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
name: "Build head" | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: yarn | ||
|
||
- name: Cache @vscode/ripgrep bin | ||
uses: actions/cache@v4 | ||
with: | ||
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }} | ||
path: node_modules/@vscode/ripgrep/bin/ | ||
|
||
- name: Install all yarn packages | ||
run: yarn --frozen-lockfile | ||
env: | ||
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build | ||
run: yarn build:client | ||
env: | ||
ANALYZE_BUNDLE_PR: true | ||
|
||
- name: Upload stats.json | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: head-stats | ||
path: ./client/build/stats.json | ||
|
||
# Build base for comparison and upload stats.json | ||
build-base: | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
name: "Build base" | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.base_ref }} | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: yarn | ||
|
||
- name: Cache @vscode/ripgrep bin | ||
uses: actions/cache@v4 | ||
with: | ||
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }} | ||
path: node_modules/@vscode/ripgrep/bin/ | ||
|
||
- name: Install all yarn packages | ||
run: yarn --frozen-lockfile | ||
env: | ||
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build | ||
run: yarn build:client | ||
env: | ||
ANALYZE_BUNDLE_PR: true | ||
|
||
- name: Upload stats.json | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: base-stats | ||
path: ./client/build/stats.json | ||
|
||
# run the action against the stats.json files | ||
compare: | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
name: "Compare base & head bundle sizes" | ||
runs-on: ubuntu-latest | ||
needs: [build-base, build-head] | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
- uses: github/webpack-bundlesize-compare-action@v1 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
current-stats-json-path: ./head-stats/stats.json | ||
base-stats-json-path: ./base-stats/stats.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,12 @@ jobs: | |
lfs: true | ||
token: ${{ secrets.MDN_STUDIO_PAT }} | ||
|
||
- uses: actions/checkout@v4 | ||
if: ${{ ! vars.SKIP_BUILD }} | ||
with: | ||
repository: mdn/generic-content | ||
path: mdn/generic-content | ||
|
||
- uses: actions/checkout@v4 | ||
if: ${{ ! vars.SKIP_BUILD }} | ||
with: | ||
|
@@ -115,6 +121,26 @@ jobs: | |
# See matching warning for mdn/content checkout step | ||
fetch-depth: 0 | ||
|
||
- name: Checkout (translated-content-de) | ||
uses: actions/checkout@v4 | ||
if: ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }} | ||
with: | ||
repository: mdn/translated-content-de | ||
path: mdn/translated-content-de | ||
|
||
- name: Move de into translated-content | ||
if: ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }} | ||
run: | | ||
mv mdn/translated-content-de/files/de mdn/translated-content/files/ | ||
rm -rf mdn/translated-content-de | ||
- name: Clean and commit de | ||
if: ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }} | ||
working-directory: mdn/translated-content | ||
run: | | ||
git add files/de | ||
git -c user.name='MDN' -c user.email='[email protected]' commit -m 'de' | ||
- uses: actions/checkout@v4 | ||
if: ${{ ! vars.SKIP_BUILD }} | ||
with: | ||
|
@@ -132,7 +158,8 @@ jobs: | |
if: ${{ ! vars.SKIP_BUILD }} | ||
run: yarn --frozen-lockfile | ||
env: | ||
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note | ||
# Use a GITHUB_TOKEN to bypass rate limiting for ripgrep and rari. | ||
# See https://github.com/microsoft/vscode-ripgrep#github-api-limit-note | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install Python | ||
|
@@ -176,8 +203,15 @@ jobs: | |
CONTRIBUTOR_SPOTLIGHT_ROOT: ${{ github.workspace }}/mdn/mdn-contributor-spotlight/contributors | ||
BLOG_ROOT: ${{ github.workspace }}/mdn/mdn-studio/content/posts | ||
CURRICULUM_ROOT: ${{ github.workspace }}/mdn/curriculum | ||
GENERIC_CONTENT_ROOT: ${{ github.workspace }}/mdn/generic-content/files | ||
BASE_URL: "https://developer.mozilla.org" | ||
|
||
# rari | ||
BUILD_OUT_ROOT: "client/build" | ||
LIVE_SAMPLES_BASE_URL: https://live.mdnplay.dev | ||
INTERACTIVE_EXAMPLES_BASE_URL: https://interactive-examples.mdn.mozilla.net | ||
ADDITIONAL_LOCALES_FOR_GENERICS_AND_SPAS: de | ||
|
||
# The default for this environment variable is geared for writers | ||
# (aka. local development). Usually defaults are supposed to be for | ||
# secure production but this is an exception and default | ||
|
@@ -225,10 +259,14 @@ jobs: | |
REACT_APP_MDN_PLUS_10Y_PLAN: price_1KeG02JNcmPzuWtRlrSiLTI6 | ||
|
||
# Surveys. | ||
REACT_APP_SURVEY_START_WEB_APP_AUGUST_2024: 1722816000000 # new Date("2024-08-05Z").getTime() | ||
REACT_APP_SURVEY_END_WEB_APP_AUGUST_2024: 1723593600000 # new Date("2024-08-14Z").getTime() | ||
REACT_APP_SURVEY_RATE_FROM_WEB_APP_AUGUST_2024: 0.0 | ||
REACT_APP_SURVEY_RATE_TILL_WEB_APP_AUGUST_2024: 0.05 # 5% | ||
REACT_APP_SURVEY_START_WEBDX_EDITING_2024: 1731628800000 # new Date("2024-11-15Z").getTime() | ||
REACT_APP_SURVEY_END_WEBDX_EDITING_2024: 1732320000000 # new Date("2024-11-23Z").getTime() | ||
REACT_APP_SURVEY_RATE_FROM_WEBDX_EDITING_2024: 0.0 | ||
REACT_APP_SURVEY_RATE_TILL_WEBDX_EDITING_2024: 0.1 # 10% | ||
REACT_APP_SURVEY_START_HOUSE_SURVEY_2025: 1736208000000 # new Date("2025-01-07Z").getTime() | ||
REACT_APP_SURVEY_END_HOUSE_SURVEY_2025: 1736899200000 # new Date("2025-01-15Z").getTime() | ||
REACT_APP_SURVEY_RATE_FROM_HOUSE_SURVEY_2025: 0.0 | ||
REACT_APP_SURVEY_RATE_TILL_HOUSE_SURVEY_2025: 0.05 # 5% | ||
|
||
# Telemetry. | ||
REACT_APP_GLEAN_CHANNEL: prod | ||
|
@@ -261,39 +299,27 @@ jobs: | |
echo "CONTENT_ROOT=$CONTENT_ROOT" | ||
echo "CONTENT_TRANSLATED_ROOT=$CONTENT_TRANSLATED_ROOT" | ||
yarn build:sw | ||
yarn build:prepare | ||
yarn tool sync-translated-content | ||
yarn build:client | ||
yarn build:ssr | ||
yarn tool:legacy build-robots-txt | ||
# Build using one process per locale. | ||
# Note: We have 4 cores, but 9 processes is a reasonable number. | ||
for locale in en-us es fr ja ko pt-br ru zh-cn zh-tw; do | ||
yarn build:docs --locale $locale 2>&1 | sed "s/^/[$locale] /" & | ||
pids+=($!) | ||
done | ||
yarn rari content sync-translated-content | ||
yarn rari git-history | ||
for pid in "${pids[@]}"; do | ||
wait $pid | ||
done | ||
yarn rari build --all --issues client/build/issues.json --templ-stats | ||
du -sh client/build | ||
# Build the blog | ||
yarn build:blog | ||
# Build the curriculum | ||
yarn build:curriculum | ||
# Generate sitemap index file | ||
yarn build --sitemap-index | ||
# SSR all pages | ||
yarn render:html | ||
# Generate whatsdeployed files. | ||
yarn tool whatsdeployed --output client/build/_whatsdeployed/code.json | ||
yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json | ||
yarn tool whatsdeployed $CONTENT_TRANSLATED_ROOT --output client/build/_whatsdeployed/translated-content.json | ||
yarn tool:legacy whatsdeployed --output client/build/_whatsdeployed/code.json | ||
yarn tool:legacy whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json | ||
yarn tool:legacy whatsdeployed $CONTENT_TRANSLATED_ROOT --output client/build/_whatsdeployed/translated-content.json | ||
# Sort DE search index by en-US popularity. | ||
node scripts/reorder-search-index.mjs client/build/en-us/search-index.json client/build/de/search-index.json | ||
- name: Update search index | ||
if: ${{ ! vars.SKIP_BUILD }} | ||
|
@@ -349,10 +375,12 @@ jobs: | |
- name: Deploy Function | ||
if: ${{ ! vars.SKIP_FUNCTION }} | ||
run: |- | ||
set -eo pipefail | ||
for region in europe-west1 us-west1 asia-east1; do | ||
gcloud beta functions deploy mdn-prod-prod-$region \ | ||
--gen2 \ | ||
--runtime=nodejs18 \ | ||
--runtime=nodejs20 \ | ||
--region=$region \ | ||
--source=cloud-function \ | ||
--trigger-http \ | ||
|
@@ -368,7 +396,7 @@ jobs: | |
--set-env-vars="ORIGIN_PLAY=mdnplay.dev" \ | ||
--set-env-vars="SOURCE_CONTENT=https://storage.googleapis.com/${{ vars.GCP_BUCKET_NAME }}/main/" \ | ||
--set-env-vars="SOURCE_API=https://api.developer.mozilla.org/" \ | ||
--set-env-vars="ORIGIN_TRIAL_TOKEN=A9YWJd0eN0+JyqsF5/4sYlFePcOgkAIKtGSnrERJ7zmzK65fqcrdYjmHUlxAV79Fphmwt96Gkyw2F1WmMEUEztgAAABdeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb24iLCJleHBpcnkiOjE3NDk3NDMyNjF9" \ | ||
--set-env-vars="ORIGIN_TRIAL_TOKEN=AxVILwizhbMjxFeHOn1P3R8niO1RJY/smaK4B4d1rLzc1gTaxtXMSaTi+FoigYgCw40uFRDwFcEAeqDR+vVLOW4AAABfeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb25WMiIsImV4cGlyeSI6MTc0MjA3OTYwMH0=" \ | ||
--set-env-vars="BSA_ENABLED=true" \ | ||
--set-env-vars="SENTRY_DSN=${{ secrets.SENTRY_DSN_CLOUD_FUNCTION }}" \ | ||
--set-env-vars="SENTRY_ENVIRONMENT=prod" \ | ||
|
Oops, something went wrong.