mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 20:57:17 +02:00
misc: change showcase submission process, use GitHub discussion (#7828)
This commit is contained in:
parent
19dcee068e
commit
f21ee7c23b
3 changed files with 27 additions and 31 deletions
|
@ -19,6 +19,11 @@ const allImages = (
|
||||||
const [, , ...selectedImages] = process.argv;
|
const [, , ...selectedImages] = process.argv;
|
||||||
const images = selectedImages.length > 0 ? selectedImages : allImages;
|
const images = selectedImages.length > 0 ? selectedImages : allImages;
|
||||||
|
|
||||||
|
const stats = {
|
||||||
|
skipped: 0,
|
||||||
|
resized: 0,
|
||||||
|
};
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
images.map(async (img) => {
|
images.map(async (img) => {
|
||||||
const imgPath = fileURLToPath(
|
const imgPath = fileURLToPath(
|
||||||
|
@ -28,6 +33,7 @@ await Promise.all(
|
||||||
if (width === 640 && height === 320 && imgPath.endsWith('.png')) {
|
if (width === 640 && height === 320 && imgPath.endsWith('.png')) {
|
||||||
// Do not emit if not resized. Important because we can't guarantee
|
// Do not emit if not resized. Important because we can't guarantee
|
||||||
// idempotency during resize -> optimization
|
// idempotency during resize -> optimization
|
||||||
|
stats.skipped += 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info`Resized path=${imgPath}: Before number=${width}×number=${height}`;
|
logger.info`Resized path=${imgPath}: Before number=${width}×number=${height}`;
|
||||||
|
@ -36,9 +42,13 @@ await Promise.all(
|
||||||
.png()
|
.png()
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
await fs.writeFile(imgPath.replace(/jpe?g/, 'png'), data);
|
await fs.writeFile(imgPath.replace(/jpe?g/, 'png'), data);
|
||||||
|
stats.resized += 1;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log(`Showcase images resizing complete.
|
||||||
|
${JSON.stringify(stats, null, 2)}`);
|
||||||
|
|
||||||
// You should also run
|
// You should also run
|
||||||
// optimizt `find website/src/data/showcase -type f -name '*.png'`.
|
// optimizt `find website/src/data/showcase -type f -name '*.png'`.
|
||||||
// This is not included here because @funboxteam/optimizt doesn't seem to play
|
// This is not included here because @funboxteam/optimizt doesn't seem to play
|
||||||
|
|
|
@ -11,51 +11,38 @@ import {translate} from '@docusaurus/Translate';
|
||||||
import {sortBy} from '@site/src/utils/jsUtils';
|
import {sortBy} from '@site/src/utils/jsUtils';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ADD YOUR SITE TO THE DOCUSAURUS SHOWCASE:
|
* ADD YOUR SITE TO THE DOCUSAURUS SHOWCASE
|
||||||
*
|
*
|
||||||
* Requirements for adding your site to our showcase:
|
* Please don't submit a PR yourself: use the Github Discussion instead:
|
||||||
* - It is a production-ready site with real content and decent customizations
|
* https://github.com/facebook/docusaurus/discussions/7826
|
||||||
* (different from the init templates)
|
|
||||||
* - It is NOT a work-in-progress with empty pages
|
|
||||||
* - It has a stable domain (a Netlify/Vercel deploy preview is not allowed)
|
|
||||||
*
|
*
|
||||||
* Instructions:
|
* Instructions for maintainers:
|
||||||
* - Add your site in the json array below
|
* - Add the site in the json array below
|
||||||
* - `title` is your project's name (no need for the "Docs" suffix)
|
* - `title` is the project's name (no need for the "Docs" suffix)
|
||||||
* - A short (≤120 characters) description of your project
|
* - A short (≤120 characters) description of the project
|
||||||
* - Use relevant tags to categorize your site (read the tag descriptions on the
|
* - Use relevant tags to categorize the site (read the tag descriptions on the
|
||||||
* https://docusaurus.io/showcase page and some further clarifications below)
|
* https://docusaurus.io/showcase page and some further clarifications below)
|
||||||
* - Add a local image preview (decent screenshot of your Docusaurus site)
|
* - Add a local image preview (decent screenshot of the Docusaurus site)
|
||||||
* - The image MUST be added to the GitHub repository, and use `require("img")`
|
* - The image MUST be added to the GitHub repository, and use `require("img")`
|
||||||
* - The image has to have minimum width 640 and an aspect of no wider than 2:1
|
* - The image has to have minimum width 640 and an aspect of no wider than 2:1
|
||||||
* - If your website is open-source, add your source link. The link should open
|
* - If a website is open-source, add a source link. The link should open
|
||||||
* to a directory containing the `docusaurus.config.js` file
|
* to a directory containing the `docusaurus.config.js` file
|
||||||
|
* - Resize images: node admin/scripts/resizeImage.js
|
||||||
|
* - Run optimizt manually (see resize image script comment)
|
||||||
* - Open a PR and check for reported CI errors
|
* - Open a PR and check for reported CI errors
|
||||||
*
|
*
|
||||||
* Example PR: https://github.com/facebook/docusaurus/pull/7620
|
* Example PR: https://github.com/facebook/docusaurus/pull/7620
|
||||||
*
|
|
||||||
* If you edit this file through the GitHub interface, you can:
|
|
||||||
* - Submit first your users.tsx edit PR
|
|
||||||
* - This will create a branch on your Docusaurus fork (usually "patch-1")
|
|
||||||
* - Go to https://github.com/<username>/docusaurus/tree/<branch>/website/src/data/showcase
|
|
||||||
* - Drag-and-drop an image here to add it to your existing PR
|
|
||||||
*
|
|
||||||
* Please help us maintain this showcase page data:
|
|
||||||
* - Update sites with wrong data
|
|
||||||
* - Ensure site tags remain correct over time
|
|
||||||
* - Remove sites not using Docusaurus anymore
|
|
||||||
* - Add missing Docusaurus sites (if the site owner agreed)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// LIST OF AVAILABLE TAGS
|
// LIST OF AVAILABLE TAGS
|
||||||
// Available tags to assign to your site
|
// Available tags to assign to a showcase site
|
||||||
// Please choose all tags that you think might apply.
|
// Please choose all tags that you think might apply.
|
||||||
// We'll remove inappropriate tags, but it's less likely that we add tags.
|
// We'll remove inappropriate tags, but it's less likely that we add tags.
|
||||||
export type TagType =
|
export type TagType =
|
||||||
// DO NOT USE THIS TAG: we choose sites to add to favorites
|
// DO NOT USE THIS TAG: we choose sites to add to favorites
|
||||||
| 'favorite'
|
| 'favorite'
|
||||||
// For open-source sites, a link to the source code is required.
|
// For open-source sites, a link to the source code is required.
|
||||||
// The source should be your *website's* source, not your project's source!
|
// The source should be the *website's* source, not the project's source!
|
||||||
| 'opensource'
|
| 'opensource'
|
||||||
| 'product'
|
| 'product'
|
||||||
// Feel free to add the 'design' tag as long as there's _some_ level of
|
// Feel free to add the 'design' tag as long as there's _some_ level of
|
||||||
|
@ -71,7 +58,7 @@ export type TagType =
|
||||||
// Right-to-left direction.
|
// Right-to-left direction.
|
||||||
| 'rtl';
|
| 'rtl';
|
||||||
|
|
||||||
// Add your site to this list
|
// Add sites to this list
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
const Users: User[] = [
|
const Users: User[] = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,8 +37,7 @@ const TITLE = translate({message: 'Docusaurus Site Showcase'});
|
||||||
const DESCRIPTION = translate({
|
const DESCRIPTION = translate({
|
||||||
message: 'List of websites people are building with Docusaurus',
|
message: 'List of websites people are building with Docusaurus',
|
||||||
});
|
});
|
||||||
const EDIT_URL =
|
const SUBMIT_URL = 'https://github.com/facebook/docusaurus/discussions/7826';
|
||||||
'https://github.com/facebook/docusaurus/edit/main/website/src/data/users.tsx';
|
|
||||||
|
|
||||||
type UserState = {
|
type UserState = {
|
||||||
scrollTopPosition: number;
|
scrollTopPosition: number;
|
||||||
|
@ -126,7 +125,7 @@ function ShowcaseHeader() {
|
||||||
<p>{DESCRIPTION}</p>
|
<p>{DESCRIPTION}</p>
|
||||||
<a
|
<a
|
||||||
className="button button--primary"
|
className="button button--primary"
|
||||||
href={EDIT_URL}
|
href={SUBMIT_URL}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer">
|
rel="noreferrer">
|
||||||
<Translate id="showcase.header.button">
|
<Translate id="showcase.header.button">
|
||||||
|
|
Loading…
Add table
Reference in a new issue