Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/mocha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
[
"*.md",
"docs/**",
"docs-next/**",
".github/**",
".prettierignore",
"AUTHORS",
Expand All @@ -21,7 +20,6 @@ on:
[
"*.md",
"docs/**",
"docs-next/**",
".github/**",
".prettierignore",
"AUTHORS",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="docs-next/src/components/mocha-logo.svg" alt="Mocha test framework logo"/>
<img src="docs/src/components/mocha-logo.svg" alt="Mocha test framework logo"/>
</p>

<p align="center">☕️ Classic, reliable, trusted test framework for Node.js and the browser ☕️</p>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs-next/README.md → docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is the current Mocha documentation website, hosted at [mochajs.org](https:/
To run this site:

```shell
cd docs-next
cd docs
npm i
npm run generate
npm run dev
Expand Down
61 changes: 28 additions & 33 deletions docs/_data/supporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,32 +99,32 @@ const nodeToSupporter = (node) => ({

const fetchImage = process.env.MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD
? async (supporter) => {
invalidSupporters.push(supporter);
}
invalidSupporters.push(supporter);
}
: async (supporter) => {
try {
const { avatar: url } = supporter;
const response = await fetch(url, {
signal: AbortSignal.timeout(30000),
});
if (response.headers.get("content-type")?.startsWith("text/html")) {
throw new TypeError(
"received html and expected a png; outage likely",
);
}
const imageBuf = Buffer.from(await response.arrayBuffer());
debug("fetched %s", url);
const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + ".png");
await writeFile(filePath, imageBuf);
debug("wrote %s", filePath);
} catch (err) {
console.error(
`failed to load ${supporter.avatar}; will discard ${supporter.tier} "${supporter.name} (${supporter.slug}). reason:\n`,
err,
try {
const { avatar: url } = supporter;
const response = await fetch(url, {
signal: AbortSignal.timeout(30000),
});
if (response.headers.get("content-type")?.startsWith("text/html")) {
throw new TypeError(
"received html and expected a png; outage likely",
);
invalidSupporters.push(supporter);
}
};
const imageBuf = Buffer.from(await response.arrayBuffer());
debug("fetched %s", url);
const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + ".png");
await writeFile(filePath, imageBuf);
debug("wrote %s", filePath);
} catch (err) {
console.error(
`failed to load ${supporter.avatar}; will discard ${supporter.tier} "${supporter.name} (${supporter.slug}). reason:\n`,
err,
);
invalidSupporters.push(supporter);
}
};

/**
* Retrieves donation data from OC
Expand Down Expand Up @@ -269,26 +269,21 @@ const getSupporters = async () => {
if (successRate < PRODUCTION_SUCCESS_THRESHOLD) {
if (process.env.NETLIFY && process.env.CONTEXT !== "deploy-preview") {
throw new Error(
`Failed to meet success threshold ${
PRODUCTION_SUCCESS_THRESHOLD * 100
}% (was ${
successRate * 100
`Failed to meet success threshold ${PRODUCTION_SUCCESS_THRESHOLD * 100
}% (was ${successRate * 100
}%) for a production deployment; refusing to deploy`,
);
} else {
console.warn(
`WARNING: Success rate of ${
successRate * 100
}% fails to meet production threshold of ${
PRODUCTION_SUCCESS_THRESHOLD * 100
`WARNING: Success rate of ${successRate * 100
}% fails to meet production threshold of ${PRODUCTION_SUCCESS_THRESHOLD * 100
}%; would fail a production deployment!`,
);
}
}
debug("supporter image pull completed");

// TODO: For now, this supporters.js script is used both in the classic docs (docs/) and next (docs-next/).
// Eventually, we'll sunset the classic docs and only have docs-next.
// TODO: we'll sunset the classic docs and only have docs.
// At that point we'll have supporters.js only used for writing files.
if (process.argv.includes("--write-supporters-json")) {
await mkdir("src/content/data", { recursive: true });
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs-next/netlify.toml → docs/netlify.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[build]
command = "npm run docs"
publish = "docs-next/dist/"
publish = "docs/dist/"

[build.environment]
DEBUG = "mocha:docs*"
NODE_VERSION = "24"

[context.deploy-preview]
command = "npm run docs"
publish = "docs-next/dist/"
publish = "docs/dist/"
5 changes: 3 additions & 2 deletions docs-next/package-lock.json → docs/package-lock.json

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

7 changes: 4 additions & 3 deletions docs-next/package.json → docs/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "docs-next",
"name": "docs",
"type": "module",
"version": "0.0.1",
"scripts": {
"astro": "astro",
"build": "astro check && astro build",
"dev": "astro dev",
"docs": "cd .. && npm i && cd docs-next && npm i && npm run generate && npm run build && cp _redirects dist/_redirects",
"generate": "node ../docs/_data/supporters.js --write-supporters-json",
"docs": "cd .. && npm i && cd docs && npm i && npm run generate && npm run build && cp _redirects dist/_redirects",
"generate": "node _data/supporters.js --write-supporters-json",
"lint:knip": "knip --cache",
"preview": "astro preview",
"start": "astro dev"
Expand All @@ -20,6 +20,7 @@
"typescript": "^5.9.3"
},
"devDependencies": {
"debug": "^4.4.3",
"knip": "^5.83.1"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ module.exports = defineConfig(
".karma/**",
"**/*.{fixture,min}.{js,mjs}",
"coverage/**",
"docs-next/{.astro,dist}/**",
"docs/{.astro,dist}/**",
"mocha.js",
"out/**",
"test/integration/fixtures/**",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"scripts": {
"build": "rollup -c ./rollup.config.mjs",
"clean": "rimraf mocha.js mocha.js.map",
"docs": "cd docs-next; npm run docs",
"docs": "cd docs; npm run docs",
"format:check": "prettier --check .",
"format:fix": "prettier --write .",
"lint:installed-check": "installed-check --engine-check --ignore-dev",
Expand Down Expand Up @@ -188,4 +188,4 @@
"@types/estree": "^1.0.7",
"webdriverio": "^9.0.0"
}
}
}
Loading