Skip to content

Commit

Permalink
Merge branch 'main' into sync-case
Browse files Browse the repository at this point in the history
  • Loading branch information
yin1999 committed Feb 7, 2023
2 parents 68f6134 + ca42266 commit 3138ebf
Show file tree
Hide file tree
Showing 213 changed files with 5,205 additions and 6,658 deletions.
File renamed without changes.
6 changes: 4 additions & 2 deletions .github/workflows/pr-commit-signatures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ jobs:

steps:
- name: Fetch commits
run: curl -s "${{ github.event.pull_request._links.commits.href }}" > commits.json
run: gh api "${{ github.event.pull_request._links.commits.href }}" | tee commits.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Filter unverified commits
run: jq '[.[].commit | select(.verification.verified == false)]' < commits.json > unverified-commits.json
run: jq '[.[].commit | select(.verification.verified == false)]' < commits.json | tee unverified-commits.json

- name: List unverified commits
run: jq '.[] | [{message, tree, author, committer, verification}]' < unverified-commits.json
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/prod-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,18 @@ jobs:
REACT_APP_MDN_PLUS_10Y_PLAN: price_1KeG02JNcmPzuWtRlrSiLTI6

# Surveys.
REACT_APP_SURVEY_START_INTEROP_2023: 1667217600000 # (new Date("2022-10-31 12:00:00Z")).getTime()
REACT_APP_SURVEY_END_INTEROP_2023: 1667822400000 # (new Date("2022-11-07 12:00:00Z")).getTime()

REACT_APP_SURVEY_RATE_FROM_INTEROP_2023_CSS_HTML: 0.0
REACT_APP_SURVEY_RATE_TILL_INTEROP_2023_CSS_HTML: 0.10 # 10 %
REACT_APP_SURVEY_RATE_FROM_INTEROP_2023_API_JS: 0.10
REACT_APP_SURVEY_RATE_TILL_INTEROP_2023_API_JS: 0.15 # 5 %
REACT_APP_SURVEY_START_FIREFOX_WEB_COMPAT_2023: 1675252800000 # (new Date("2023-02-01 12:00:00Z")).getTime()
REACT_APP_SURVEY_END_FIREFOX_WEB_COMPAT_2023: 1675684800000 # (new Date("2023-02-06 12:00:00Z")).getTime()
REACT_APP_SURVEY_RATE_FROM_FIREFOX_WEB_COMPAT_2023: 0.0
REACT_APP_SURVEY_RATE_TILL_FIREFOX_WEB_COMPAT_2023: 0.10 # 10%

# Telemetry.
REACT_APP_GLEAN_CHANNEL: prod
REACT_APP_GLEAN_ENABLED: true

# Newsletter
REACT_APP_NEWSLETTER_ENABLED: true

run: |
# Info about which CONTENT_* environment variables were set and to what.
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/stage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,18 @@ jobs:
REACT_APP_MDN_PLUS_10Y_PLAN: price_1K6X8VKb9q6OnNsLFlUcEiu4

# Surveys.
REACT_APP_SURVEY_START_INTEROP_2023: 0 # stage
REACT_APP_SURVEY_END_INTEROP_2023: 1667822400000 # (new Date("2022-11-07 12:00:00Z")).getTime()

REACT_APP_SURVEY_RATE_FROM_INTEROP_2023_CSS_HTML: 0.0
REACT_APP_SURVEY_RATE_TILL_INTEROP_2023_CSS_HTML: 0.10 # 10 %
REACT_APP_SURVEY_RATE_FROM_INTEROP_2023_API_JS: 0.10
REACT_APP_SURVEY_RATE_TILL_INTEROP_2023_API_JS: 0.15 # 5 %
REACT_APP_SURVEY_START_FIREFOX_WEB_COMPAT_2023: 0 # stage
REACT_APP_SURVEY_END_FIREFOX_WEB_COMPAT_2023: 1675771200000 # (new Date("2023-02-07 12:00:00Z")).getTime()
REACT_APP_SURVEY_RATE_FROM_FIREFOX_WEB_COMPAT_2023: 0.0
REACT_APP_SURVEY_RATE_TILL_FIREFOX_WEB_COMPAT_2023: 0.10 # 10%

# Telemetry.
REACT_APP_GLEAN_CHANNEL: stage
REACT_APP_GLEAN_ENABLED: true

# Newsletter
REACT_APP_NEWSLETTER_ENABLED: true

run: |
# Info about which CONTENT_* environment variables were set and to what.
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
cache: yarn
cache-dependency-path: |
yarn.lock
client/pwa/yarn.lock
deployer/aws-lambda/content-origin-request/yarn.lock
deployer/aws-lambda/content-origin-response/yarn.lock
deployer/aws-lambda/tests/yarn.lock
Expand All @@ -31,6 +32,10 @@ jobs:
- name: Install all yarn packages (ROOT)
run: yarn --frozen-lockfile

- name: Install all yarn packages (pwa)
working-directory: client/pwa
run: yarn --frozen-lockfile

- name: Install all yarn packages (aws-lambda/content-origin-request)
working-directory: deployer/aws-lambda/content-origin-request
run: yarn --frozen-lockfile
Expand All @@ -52,6 +57,9 @@ jobs:
- name: Lint stylelint
run: yarn stylelint

- name: Check TypeScript
run: yarn check:tsc

test:
runs-on: ubuntu-latest

Expand All @@ -73,17 +81,8 @@ jobs:
- name: Build and start server
id: server
env:
ENV_FILE: testing/.env
ENV_FILE: .env.testing
run: |
# because `yarn build:prepare` is a wrapper for `yarn build:client` and
# `yarn build:client` can't respect the `$ENV_FILE` environment variable,
# because it has to build from the `./client/` directory, we have to
# manually copy the `testing/.env` file into `client/` so that when
# `yarn build:client` runs, it gets the same environment variables
# as you'd get when doing `yarn build:ssr`.
cp testing/.env client/
yarn build:prepare
yarn build
Expand All @@ -98,7 +97,7 @@ jobs:
- name: Basic m2h tool testing
env:
ENV_FILE: testing/.env
ENV_FILE: .env.testing
run: |
yarn m2h markdown/tool/m2h --locale en-US
diff -s testing/content/files/en-us/markdown/tool/m2h/index.html testing/content/files/en-us/markdown/tool/m2h/expected.html
Expand Down
5 changes: 0 additions & 5 deletions .lintstagedrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Yari

![Testing](https://github.com/mdn/yari/workflows/Testing%20Yari/badge.svg)
![Production Build](https://github.com/mdn/yari/workflows/Production%20Build/badge.svg)
![Prod Build](https://github.com/mdn/yari/workflows/Prod%20Build/badge.svg)

## Quickstart

Expand Down
155 changes: 0 additions & 155 deletions build/bcd-urls.ts

This file was deleted.

46 changes: 21 additions & 25 deletions build/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import { prompt } from "inquirer";
import { Document, slugToFolder, translationsOf } from "../content";
import { CONTENT_ROOT, CONTENT_TRANSLATED_ROOT } from "../libs/env";
import { VALID_LOCALES } from "../libs/constants";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { renderHTML } from "../ssr/dist/main";
import options from "./build-options";
import { buildDocument, BuiltDocument, renderContributorsTxt } from ".";
import { Flaws } from "../libs/types";
import * as bcd from "@mdn/browser-compat-data/types";
import { DocMetadata, Flaws } from "../libs/types";
import SearchIndex from "./search-index";
import { BUILD_OUT_ROOT } from "../libs/env";
import { makeSitemapXML, makeSitemapIndexXML } from "./sitemaps";
Expand All @@ -35,6 +36,10 @@ export interface InteractiveDocumentBuild {
skip: false;
}

interface GlobalMetadata {
[locale: string]: Array<DocMetadata>;
}

async function buildDocumentInteractive(
documentPath,
interactive,
Expand Down Expand Up @@ -116,7 +121,7 @@ async function buildDocuments(
findAllOptions.files = new Set(files);
}

const metadata = {};
const metadata: GlobalMetadata = {};

const documents = Document.findAll(findAllOptions);
const progressBar = new cliProgress.SingleBar(
Expand Down Expand Up @@ -161,7 +166,7 @@ async function buildDocuments(
}

const {
doc: { doc: builtDocument, liveSamples, fileAttachments, bcdData },
doc: { doc: builtDocument, liveSamples, fileAttachments },
document,
} = result;

Expand Down Expand Up @@ -190,27 +195,6 @@ async function buildDocuments(
builtDocument.source.github_url.replace("/blob/", "/commits/")
)
);
for (const { url, data } of bcdData) {
fs.writeFileSync(
path.join(outPath, path.basename(url)),
JSON.stringify(data, (key, value) => {
// The BCD data object contains a bunch of data we don't need in the
// React component that loads the `bcd.json` file and displays it.
// The `.releases` block contains information about browsers (e.g
// release dates) and that part has already been extracted and put
// next to each version number where appropriate.
// Therefore, we strip out all "retired" releases.
if (key === "releases") {
return Object.fromEntries(
Object.entries(value as bcd.ReleaseStatement).filter(
([, v]) => v.status !== "retired"
)
);
}
return value;
})
);
}

for (const { id, html } of liveSamples) {
const liveSamplePath = path.join(outPath, `_sample_.${id}.html`);
Expand Down Expand Up @@ -300,6 +284,18 @@ async function buildDocuments(
JSON.stringify(meta)
);
}

const allBrowserCompat = new Set<string>();
Object.values(metadata).forEach((localeMeta) =>
localeMeta.forEach((doc) =>
doc.browserCompat?.forEach((query) => allBrowserCompat.add(query))
)
);
fs.writeFileSync(
path.join(BUILD_OUT_ROOT, "allBrowserCompat.txt"),
[...allBrowserCompat].join(" ")
);

return { slugPerLocale: docPerLocale, peakHeapBytes, totalFlaws };
}

Expand Down
3 changes: 2 additions & 1 deletion build/document-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const TRANSFORM_STRINGS = new Map(
"CSS: Cascading Style Sheets": "CSS",
"Graphics on the Web": "Graphics",
"HTML elements reference": "Elements",
"JavaScript reference": "JavaScript",
"JavaScript reference": "Reference",
"JavaScript Guide": "Guide",
"Structuring the web with HTML": "HTML",
"Learn to style HTML using CSS": "CSS",
"Web forms — Working with user data": "Forms",
Expand Down
Loading

0 comments on commit 3138ebf

Please sign in to comment.