Skip to content

Commit

Permalink
Merge branch 'main' into fix-5652
Browse files Browse the repository at this point in the history
  • Loading branch information
yin1999 committed Feb 16, 2023
2 parents ac60c0e + 79fb3fc commit 2b68ba5
Show file tree
Hide file tree
Showing 384 changed files with 8,525 additions and 8,269 deletions.
File renamed without changes.
8 changes: 7 additions & 1 deletion .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { readGitignoreFiles } = require("eslint-gitignore");
const path = require("node:path");
const { readGitignoreFiles } = require("eslint-gitignore");

const ignores = readGitignoreFiles({
cwd: path.join(".git", "info"),
Expand Down Expand Up @@ -40,6 +40,12 @@ module.exports = {
"warn",
{ ignoreRestSiblings: true },
],
"n/no-extraneous-import": [
"error",
{
allowModules: ["@jest/globals"],
},
],
"n/no-missing-import": "off",
"n/no-unpublished-import": "off",
"n/shebang": "off",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/aws-lambda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: yarn
cache-dependency-path: |
deployer/aws-lambda/content-origin-request/yarn.lock
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: yarn

- name: Install all yarn packages
Expand All @@ -75,7 +75,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.10"

- name: Install Python poetry
uses: snok/install-poetry@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/developing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: yarn

- name: Install all yarn packages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: yarn

- name: Install all yarn packages
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/npm-published-simulation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: "yarn"

- name: Install all yarn packages
Expand Down Expand Up @@ -57,7 +57,9 @@ jobs:
ls -lh $TARBALL
mv $TARBALL mdn/content/
cd mdn/content
yarn cache clean --all
yarn add file:$TARBALL
yarn install
- name: (mdn/content) yarn yari-build --help
working-directory: mdn/content
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: yarn

- name: Install all yarn packages
Expand Down
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
2 changes: 1 addition & 1 deletion .github/workflows/pr-deployer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.10"

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: "yarn"

- name: Lint markdown files
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-kumascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: yarn

- name: Install all yarn packages
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/prod-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: yarn

- name: Install all yarn packages
Expand All @@ -98,7 +98,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.10"

- name: Install Python poetry
uses: snok/install-poetry@v1
Expand Down Expand Up @@ -167,13 +167,10 @@ 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: 1675944000000 # (new Date("2023-02-09 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
Expand All @@ -182,6 +179,9 @@ jobs:
# Newsletter
REACT_APP_NEWSLETTER_ENABLED: true

# Placement
REACT_APP_PLACEMENT_ENABLED: true

run: |
# Info about which CONTENT_* environment variables were set and to what.
Expand Down Expand Up @@ -234,6 +234,10 @@ jobs:

DEPLOYER_ELASTICSEARCH_URL: ${{ secrets.DEPLOYER_PROD_ELASTICSEARCH_URL }}

KEVEL_SITE_ID: ${{ secrets.DEPLOYER_PROD_KEVEL_SITE_ID }}
KEVEL_NETWORK_ID: ${{ secrets.DEPLOYER_PROD_KEVEL_NETWORK_ID }}
SIGN_SECRET: ${{ secrets.DEPLOYER_PROD_SIGN_SECRET }}

run: |
# Info about which CONTENT_* environment variables were set and to what.
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/stage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: yarn

- name: Install all yarn packages
Expand All @@ -98,7 +98,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.10"

- name: Install Python poetry
uses: snok/install-poetry@v1
Expand Down Expand Up @@ -164,13 +164,10 @@ 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: 1675944000000 # (new Date("2023-02-09 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
Expand All @@ -179,6 +176,9 @@ jobs:
# Newsletter
REACT_APP_NEWSLETTER_ENABLED: true

# Placement
REACT_APP_PLACEMENT_ENABLED: true

run: |
# Info about which CONTENT_* environment variables were set and to what.
Expand Down Expand Up @@ -232,6 +232,12 @@ jobs:

DEPLOYER_ELASTICSEARCH_URL: ${{ secrets.DEPLOYER_STAGE_ELASTICSEARCH_URL }}

DEPLOYER_LAMBDA_PREFIX: stage-

KEVEL_SITE_ID: ${{ secrets.DEPLOYER_STAGE_KEVEL_SITE_ID }}
KEVEL_NETWORK_ID: ${{ secrets.DEPLOYER_STAGE_KEVEL_NETWORK_ID }}
SIGN_SECRET: ${{ secrets.DEPLOYER_STAGE_SIGN_SECRET }}

run: |
# Info about which CONTENT_* environment variables were set and to what.
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
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 @@ -61,7 +69,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: 18
cache: yarn

- name: Install all yarn packages
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 .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18
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
4 changes: 2 additions & 2 deletions build/build-options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dotenv from "dotenv";
dotenv.config();

import { FLAW_LEVELS, VALID_FLAW_CHECKS } from "../libs/constants";
import { FLAW_LEVELS, VALID_FLAW_CHECKS } from "../libs/constants/index.js";
import {
DEFAULT_FLAW_LEVELS,
FILES,
Expand All @@ -11,7 +11,7 @@ import {
FIX_FLAWS_DRY_RUN,
FIX_FLAWS_TYPES,
FIX_FLAWS_VERBOSE,
} from "../libs/env";
} from "../libs/env/index.js";

const options = Object.freeze({
flawLevels: parseFlawLevels(DEFAULT_FLAW_LEVELS),
Expand Down
11 changes: 6 additions & 5 deletions build/check-images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

import path from "node:path";

import sizeOf from "image-size";
import imagesize from "image-size";

import { Document, Image } from "../content";
import { FLAW_LEVELS } from "../libs/constants";
import { findMatchesInText } from "./matches-in-text";
import { DEFAULT_LOCALE } from "../libs/constants";
import { Document, Image } from "../content/index.js";
import { FLAW_LEVELS, DEFAULT_LOCALE } from "../libs/constants/index.js";
import { findMatchesInText } from "./matches-in-text.js";

const { default: sizeOf } = imagesize;

/**
* Mutate the `$` instance for image reference and if appropriate,
Expand Down
Loading

0 comments on commit 2b68ba5

Please sign in to comment.