Skip to content

Commit

Permalink
Make argos screenshot dogfooding pages
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Nov 7, 2024
1 parent 9e4dda5 commit ff3b533
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/argos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: npx playwright install --with-deps chromium

- name: Build website fast
run: yarn build:website:fast --dev
run: yarn build:website:fast:argos --dev

- name: Take Argos screenshots
run: yarn argos:screenshot
5 changes: 5 additions & 0 deletions argos/tests/screenshot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ function isBlacklisted(pathname: string) {
pathname.startsWith('/changelog') ||
// versioned docs
pathname.match(/^\/docs\/((\d\.\d\.\d)|(next))\//) ||
// verbose useless dogfooding pages
pathname.startsWith('/tests/docs/toc/') ||
pathname.startsWith('/tests/docs/tags/') ||
pathname.startsWith('/tests/blog/page/') ||
pathname.startsWith('/tests/blog/tags/') ||
// manually excluded urls
BlacklistedPathnames.includes(pathname)
);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"build:website:deployPreview:build": "cross-env NETLIFY=true CONTEXT='deploy-preview' yarn workspace website build",
"build:website:deployPreview": "yarn build:website:deployPreview:testWrap && yarn build:website:deployPreview:build",
"build:website:fast": "yarn workspace website build:fast",
"build:website:fast:argos": "cross-env DOCUSAURUS_ARGOS_BUILD=true yarn workspace website build:fast",
"build:website:fast:rsdoctor": "yarn workspace website build:fast:rsdoctor",
"build:website:fast:profile": "yarn workspace website build:fast:profile",
"build:website:en": "yarn workspace website build --locale en",
Expand Down
10 changes: 9 additions & 1 deletion website/_dogfooding/dogfooding.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ import type {Options as DocsOptions} from '@docusaurus/plugin-content-docs';
import type {Options as BlogOptions} from '@docusaurus/plugin-content-blog';
import type {Options as PageOptions} from '@docusaurus/plugin-content-pages';

export const isArgosBuild = process.env.DOCUSAURUS_ARGOS_BUILD === 'true';

if (isArgosBuild) {
console.warn(
'Building site for Argos CI - additional dogfooding pages will be preserved in sitemap',
);
}

export function dogfoodingTransformFrontMatter(frontMatter: {
[key: string]: unknown;
}): {[key: string]: unknown} {
Expand Down Expand Up @@ -39,7 +47,7 @@ export const dogfoodingPluginInstances: PluginConfig[] = [
sidebarPath: '_dogfooding/docs-tests-sidebars.js',
versions: {
current: {
noIndex: true,
noIndex: !isArgosBuild,
},
},
onInlineTags: 'warn',
Expand Down
7 changes: 5 additions & 2 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
dogfoodingThemeInstances,
dogfoodingRedirects,
dogfoodingTransformFrontMatter,
isArgosBuild,
} from './_dogfooding/dogfooding.config';

import ConfigLocalized from './docusaurus.config.localized.json';
Expand Down Expand Up @@ -538,8 +539,10 @@ export default async function createConfigAsync() {
}
: undefined,
sitemap: {
// Note: /tests/docs already has noIndex: true
ignorePatterns: ['/tests/{blog,pages}/**'],
ignorePatterns: isArgosBuild
? undefined
: // Note: /tests/docs already has noIndex: true
['/tests/{blog,pages}/**'],
lastmod: 'date',
priority: null,
changefreq: null,
Expand Down

0 comments on commit ff3b533

Please sign in to comment.