Skip to content

Commit

Permalink
Merge branch 'main' into math-block-margin
Browse files Browse the repository at this point in the history
  • Loading branch information
pepelsbey authored Jul 15, 2024
2 parents 8075f2b + 18183d3 commit 1c9c488
Show file tree
Hide file tree
Showing 7 changed files with 347 additions and 396 deletions.
47 changes: 36 additions & 11 deletions build/curriculum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@ export async function buildCurriculumIndex(
const entry = mapper(meta);
if (currentLevel > 2) {
if (last) {
last.children.push(entry);
if (!last.children) {
last.children = [entry];
} else {
last.children.push(entry);
}
return item;
}
}

item.push({ children: [], ...entry });
item.push({ ...entry });
return item;
}, []);

Expand All @@ -127,10 +131,10 @@ function prevNextFromIndex(
const prevEntry = i > 0 ? index[i - 1] : undefined;
const nextEntry = i < index.length - 1 ? index[i + 1] : undefined;

prevEntry && "children" in prevEntry && delete prevEntry.children;
nextEntry && "children" in nextEntry && delete nextEntry.children;
const prev = prevEntry && { url: prevEntry.url, title: prevEntry.title };
const next = nextEntry && { url: nextEntry.url, title: nextEntry.title };

return { prev: prevEntry, next: nextEntry };
return { prev, next };
}

async function buildPrevNextOverview(slug: string): Promise<PrevNext> {
Expand Down Expand Up @@ -205,13 +209,34 @@ async function readCurriculumPage(
let group: string;
if (!options?.forIndex) {
if (attributes.template === Template.Landing) {
modules = (await buildCurriculumIndex())?.filter(
(x) => x.children?.length
);
modules = (await buildCurriculumIndex())
?.filter((x) => x.children?.length)
.map(({ url, title, summary, topic, slug, children }) => ({
url,
title,
summary,
topic,
slug,
children: children.length
? children.map(({ url, title, summary, topic, slug }) => ({
url,
title,
summary,
topic,
slug,
}))
: undefined,
}));
} else if (attributes.template === Template.Overview) {
modules = (await buildCurriculumIndex())?.find(
(x) => x.slug === slug
)?.children;
modules = (await buildCurriculumIndex())
?.find((x) => x.slug === slug)
?.children.map(({ url, title, summary, topic, slug }) => ({
url,
title,
summary,
topic,
slug,
}));
}
if (attributes.template === Template.Module) {
prevNext = await buildPrevNextModule(slug);
Expand Down
7 changes: 5 additions & 2 deletions build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ function getCurrentGitBranch(root: string) {
// Only bother getting fancy if the root is CONTENT_ROOT.
// For other possible roots, just leave it to the default.
if (root === CONTENT_ROOT) {
if (process.env.GITHUB_REF) {
if (
process.env.GITHUB_REF &&
process.env.GITHUB_REPOSITORY !== "mdn/yari"
) {
name = process.env.GITHUB_REF.split("/").slice(2).join("/");
} else {
// Most probably, you're hacking on the content, using Yari to preview,
Expand Down Expand Up @@ -548,7 +551,7 @@ export async function buildDocument(
}

function addBaseline(doc: Partial<Doc>) {
if (doc.browserCompat) {
if (doc.browserCompat && !doc.mdn_url?.includes("/docs/MDN/")) {
const filteredBrowserCompat = doc.browserCompat.filter(
(query) =>
// temporary blocklist while we wait for per-key baseline statuses
Expand Down
2 changes: 1 addition & 1 deletion client/pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@zip.js/zip.js": "2.7.45",
"dexie": "3.2.7"
"dexie": "4.0.8"
},
"devDependencies": {
"@types/dexie": "1.3.1",
Expand Down
8 changes: 4 additions & 4 deletions client/pwa/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,10 @@ cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"

dexie@*, dexie@3.2.7:
version "3.2.7"
resolved "https://registry.yarnpkg.com/dexie/-/dexie-3.2.7.tgz#1346541c9c81e3bc6055a042a928837890595e3a"
integrity sha512-2a+BXvVhY5op+smDRLxeBAivE7YcYaneXJ1la3HOkUfX9zKkE/AJ8CNgjiXbtXepFyFmJNGSbmjOwqbT749r/w==
dexie@*, dexie@4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/dexie/-/dexie-4.0.8.tgz#21fca70686bdaa1d86fad45b6b19316f6a084a1d"
integrity sha512-1G6cJevS17KMDK847V3OHvK2zei899GwpDiqfEXHP1ASvme6eWJmAp9AU4s1son2TeGkWmC0g3y8ezOBPnalgQ==

electron-to-chromium@^1.4.601:
version "1.4.645"
Expand Down
2 changes: 1 addition & 1 deletion client/src/ui/atoms/login-link/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function useLoginUrl() {
const sp = new URLSearchParams();

let next = pathname ? pathname + search : `/${locale}/`;
sp.set("next", encodeURI(next));
sp.set("next", next);

let prefix = "";
// When doing local development with Yari, the link to authenticate in Kuma
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@
"@codemirror/theme-one-dark": "^6.1.2",
"@fast-csv/parse": "^5.0.0",
"@mdn/bcd-utils-api": "^0.0.7",
"@mdn/browser-compat-data": "^5.5.37",
"@mdn/browser-compat-data": "^5.5.39",
"@mozilla/glean": "5.0.2",
"@sentry/node": "^8.15.0",
"@sentry/node": "^8.17.0",
"@stripe/stripe-js": "^4.1.0",
"@use-it/interval": "^1.0.0",
"@vscode/ripgrep": "^1.15.9",
"@webref/css": "^6.13.0",
"@webref/css": "^6.13.1",
"accept-language-parser": "^1.5.0",
"async": "^3.2.5",
"chalk": "^5.3.0",
Expand All @@ -96,7 +96,7 @@
"express": "^4.19.2",
"fdir": "^6.1.1",
"feed": "^4.2.2",
"file-type": "^19.1.0",
"file-type": "^19.1.1",
"front-matter": "^4.0.2",
"fs-extra": "^11.2.0",
"got": "^13.0.0",
Expand All @@ -112,14 +112,14 @@
"is-svg": "^5.0.1",
"js-yaml": "^4.1.0",
"loglevel": "^1.9.1",
"lru-cache": "^10.4.0",
"lru-cache": "^10.4.3",
"md5-file": "^5.0.0",
"mdast-util-from-markdown": "^2.0.1",
"mdast-util-phrasing": "^4.1.0",
"mdn-data": "^2.8.0",
"open": "^10.1.0",
"open-editor": "^4.1.1",
"openai": "^4.52.4",
"openai": "^4.52.7",
"pg": "^8.12.0",
"pgvector": "^0.2.0",
"prism-svelte": "^0.5.0",
Expand All @@ -146,13 +146,13 @@
"unist-builder": "^4.0.0",
"unist-util-visit": "^5.0.0",
"web-features": "^0.9.0",
"web-specs": "^3.13.0"
"web-specs": "^3.13.1"
},
"devDependencies": {
"@babel/core": "^7.24.7",
"@babel/eslint-parser": "^7.24.7",
"@babel/core": "^7.24.9",
"@babel/eslint-parser": "^7.24.8",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "^7.24.7",
"@babel/preset-env": "^7.24.8",
"@mdn/dinocons": "^0.5.5",
"@mdn/minimalist": "^2.0.4",
"@playwright/test": "^1.45.1",
Expand All @@ -175,7 +175,7 @@
"babel-preset-react-app": "^10.0.1",
"bfj": "^8.0.0",
"braces": "^3.0.3",
"browserslist": "^4.23.1",
"browserslist": "^4.23.2",
"camelcase": "^8.0.0",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"cross-env": "^7.0.3",
Expand All @@ -191,7 +191,7 @@
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react": "^7.34.4",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-unicorn": "^54.0.0",
"eslint-webpack-plugin": "^4.2.0",
Expand Down Expand Up @@ -255,7 +255,7 @@
"ts-node": "^10.9.2",
"typescript": "^5.5.3",
"typescript-eslint": "^7.16.0",
"webpack": "^5.92.1",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"webpack-manifest-plugin": "^5.0.0",
Expand Down
Loading

0 comments on commit 1c9c488

Please sign in to comment.