Skip to content

Commit

Permalink
Merge branch 'main' into poetry-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yin1999 committed Jan 28, 2025
2 parents cf905a8 + 03290c3 commit a2f8830
Show file tree
Hide file tree
Showing 12 changed files with 336 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ jobs:
poetry run deployer search-index ../client/build
- name: Configure AWS Credentials
uses: aws-actions/[email protected].2
uses: aws-actions/[email protected].3
with:
aws-access-key-id: ${{ secrets.DEPLOYER_STAGE_AND_DEV_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEPLOYER_STAGE_AND_DEV_AWS_SECRET_ACCESS_KEY }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/npm-published-simulation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ jobs:
yarn add file:$TARBALL
yarn install
- name: (mdn/content) yarn rari-build --help
working-directory: mdn/content
run: yarn rari-build --help

- name: (mdn/content) yarn rari-tool --help
working-directory: mdn/content
run: yarn rari-tool --help

- name: (mdn/content) yarn yari-build --help
working-directory: mdn/content
run: yarn yari-build --help
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.2.1"
".": "4.2.2"
}
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## [4.2.2](https://github.com/mdn/yari/compare/v4.2.1...v4.2.2) (2025-01-27)


### Bug Fixes

* **csp:** allow images from prod (developer.mozilla.org) ([#12514](https://github.com/mdn/yari/issues/12514)) ([09ded00](https://github.com/mdn/yari/commit/09ded006a49cce576ca0e675b1547c1bbf52fab3))


### Enhancements

* **server:** retry rari fetch if ECONNREFUSED ([#12513](https://github.com/mdn/yari/issues/12513)) ([8cd0bd2](https://github.com/mdn/yari/commit/8cd0bd2ea7d9c87d809fa3d8cb85d25ad63a6ad3))


### Miscellaneous

* **bin:** deprecate yari bins + test rari bins ([#12517](https://github.com/mdn/yari/issues/12517)) ([82a690b](https://github.com/mdn/yari/commit/82a690b223330f102757b166342f183b1b5ad79f))
* **deps-dev:** bump @babel/core from 7.26.0 to 7.26.7 ([#12522](https://github.com/mdn/yari/issues/12522)) ([4d38665](https://github.com/mdn/yari/commit/4d386651e8fbe4442d9ddfee92ef283e56b210b9))
* **deps-dev:** bump @babel/preset-env from 7.26.0 to 7.26.7 ([#12521](https://github.com/mdn/yari/issues/12521)) ([818ce4a](https://github.com/mdn/yari/commit/818ce4a8b95dd33547356f68163a8132952db2a8))
* **deps-dev:** bump @swc/core from 1.10.9 to 1.10.11 ([#12518](https://github.com/mdn/yari/issues/12518)) ([a74997c](https://github.com/mdn/yari/commit/a74997cead287c509e63dd74f2591fd535bbad4c))
* **deps:** bump @mdn/browser-compat-data from 5.6.32 to 5.6.33 ([#12520](https://github.com/mdn/yari/issues/12520)) ([9d0dc90](https://github.com/mdn/yari/commit/9d0dc907aeba4ec7b8345db4cb745b2e23651e8b))
* **deps:** bump boto3 from 1.36.2 to 1.36.6 in /deployer in the dependencies group ([#12524](https://github.com/mdn/yari/issues/12524)) ([f43a823](https://github.com/mdn/yari/commit/f43a823ca1292fc985a72242e68292e9ea200173))
* **deps:** bump openai from 4.80.0 to 4.80.1 ([#12523](https://github.com/mdn/yari/issues/12523)) ([8e89246](https://github.com/mdn/yari/commit/8e89246b0edf53f67c1a84773c171fcc66d890b8))
* **deps:** bump web-specs from 3.35.0 to 3.36.0 ([#12519](https://github.com/mdn/yari/issues/12519)) ([2bb0244](https://github.com/mdn/yari/commit/2bb0244bc4cf24761108b9e4666f436f6e1995a2))

## [4.2.1](https://github.com/mdn/yari/compare/v4.2.0...v4.2.1) (2025-01-24)


Expand Down
4 changes: 3 additions & 1 deletion build/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ if (SENTRY_DSN_BUILD) {
}

program
.name("build")
.name("[DEPRECATED] build")
.option("-i, --interactive", "Ask what to do when encountering flaws", {
default: false,
})
Expand Down Expand Up @@ -600,6 +600,8 @@ program
}
});

console.warn("\n🗑️ This command is deprecated, and will be removed soon.\n");

program.run();
function compareBigInt(a: bigint, b: bigint): number {
if (a < b) {
Expand Down
18 changes: 11 additions & 7 deletions cloud-function/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions deployer/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion deployer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
click = "^8.1.8"
boto3 = "^1.36.2"
boto3 = "^1.36.6"
python-decouple = "^3.8"
requests = {extras = ["security"], version = "^2.32.3"}
elasticsearch-dsl = "^7.4.1"
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mdn/yari",
"version": "4.2.1",
"version": "4.2.2",
"repository": "https://github.com/mdn/yari",
"license": "MPL-2.0",
"author": "MDN Web Docs",
Expand Down Expand Up @@ -84,7 +84,7 @@
"@lit/react": "^1.0.7",
"@lit/task": "^1.0.2",
"@mdn/bcd-utils-api": "^0.0.7",
"@mdn/browser-compat-data": "^5.6.32",
"@mdn/browser-compat-data": "^5.6.33",
"@mdn/rari": "^0.1.20",
"@mozilla/glean": "5.0.3",
"@sentry/node": "^8.51.0",
Expand Down Expand Up @@ -135,7 +135,7 @@
"mdn-data": "^2.15.0",
"open": "^10.1.0",
"open-editor": "^5.1.0",
"openai": "^4.80.0",
"openai": "^4.80.1",
"pg": "^8.13.1",
"pgvector": "^0.2.0",
"prism-svelte": "^0.5.0",
Expand All @@ -161,20 +161,20 @@
"unified": "^11.0.5",
"unist-builder": "^4.0.0",
"unist-util-visit": "^5.0.0",
"web-features": "^2.19.0",
"web-specs": "^3.35.0"
"web-features": "^2.20.0",
"web-specs": "^3.36.0"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/core": "^7.26.7",
"@babel/eslint-parser": "^7.26.5",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "^7.26.0",
"@babel/preset-env": "^7.26.7",
"@mdn/dinocons": "^0.5.5",
"@mdn/minimalist": "^2.0.4",
"@playwright/test": "^1.50.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
"@svgr/webpack": "^8.1.0",
"@swc/core": "^1.10.9",
"@swc/core": "^1.10.11",
"@testing-library/react": "^15.0.7",
"@types/async": "^3.2.24",
"@types/cli-progress": "^3.11.6",
Expand Down Expand Up @@ -274,7 +274,7 @@
"ts-loader": "^9.5.2",
"ts-node": "^10.9.2",
"typescript": "^5.7.3",
"typescript-eslint": "^8.21.0",
"typescript-eslint": "^8.22.0",
"webpack": "^5.97.1",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^6.0.1",
Expand Down
44 changes: 42 additions & 2 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,46 @@ import { handleRunner } from "../libs/play/index.js";
async function fetch_from_rari(path: string) {
const external_url = `${EXTERNAL_DEV_SERVER}${path}`;
console.log(`using ${external_url}`);
// eslint-disable-next-line n/no-unsupported-features/node-builtins
return await (await fetch(external_url)).json();
const response = await fetchWithRetryIfConnRefused(external_url, 5);
return await response.json();
}

// Simulates `curl --retry-connrefused`.
async function fetchWithRetryIfConnRefused(
url: string,
maxRetries: number,
baseDelay = 1000
) {
let attempt = 0;

while (attempt < maxRetries) {
try {
// eslint-disable-next-line n/no-unsupported-features/node-builtins
const response = await fetch(url);
if (!response.ok) {
throw new Error(`failed with HTTP ${response.status}`);
}
return response;
} catch (error: any) {
attempt++;
if (
error.code !== "ECONNREFUSED" &&
error.cause?.code !== "ECONNREFUSED"
) {
throw error;
}

console.log(`retrying ${attempt}/${maxRetries}`);
if (attempt < maxRetries) {
const delay = baseDelay * Math.pow(2, attempt - 1); // Exponential backoff
await new Promise((resolve) => setTimeout(resolve, delay));
} else {
throw new Error(
`failed after ${maxRetries} attempts: ${error.message}`
);
}
}
}
}

async function buildDocumentFromURL(url: string) {
Expand Down Expand Up @@ -570,6 +608,8 @@ app.use(staticMiddlewares);

app.get("/*", async (_, res) => await send404(res));

console.warn("\n🗑️ This command is deprecated, and will be removed soon.\n");

if (!fs.existsSync(path.resolve(CONTENT_ROOT))) {
throw new Error(`${path.resolve(CONTENT_ROOT)} does not exist!`);
}
Expand Down
4 changes: 3 additions & 1 deletion tool/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function tryOrExit<T extends ActionParameters>(

program
.bin("yarn tool")
.name("tool")
.name("[DEPRECATED] tool")
.version("0.0.0")
.disableGlobalOption("--silent")
.cast(false)
Expand Down Expand Up @@ -1104,4 +1104,6 @@ program
})
);

console.warn("\n🗑️ This command is deprecated, and will be removed soon.\n");

program.run();
Loading

0 comments on commit a2f8830

Please sign in to comment.