mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 09:43:10 +00:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5e675821f | ||
|
|
a97a74ff62 | ||
|
|
0da59368fc | ||
|
|
9088efb306 | ||
|
|
643c33c11c | ||
|
|
921fa240e7 | ||
|
|
a9cef92bd2 | ||
|
|
a779857353 | ||
|
|
760a5ae533 | ||
|
|
6d1897dfd9 | ||
|
|
31bd1b188e | ||
|
|
539fd731e0 | ||
|
|
803cceee39 | ||
|
|
6c06a70905 | ||
|
|
839ccbd451 | ||
|
|
1a91145b3b | ||
|
|
85e32fd31a | ||
|
|
3c051ee9f9 | ||
|
|
17a2751cf5 | ||
|
|
ab6147a99b | ||
|
|
ed758fce06 | ||
|
|
68cc2814eb | ||
|
|
97278be7fb | ||
|
|
a2e05d2118 |
|
|
@ -21,28 +21,21 @@
|
|||
],
|
||||
"ignorePaths": [
|
||||
"CHANGELOG.md",
|
||||
"CHANGELOG-v*.md",
|
||||
"patches",
|
||||
"packages/docusaurus-theme-translations/locales",
|
||||
"packages/docusaurus-plugin-ideal-image/src/theme/IdealImageLegacy",
|
||||
"package.json",
|
||||
"yarn.lock",
|
||||
"project-words.txt",
|
||||
"__snapshots__",
|
||||
"admin/scripts",
|
||||
"website/src/data/users.tsx",
|
||||
"website/src/data/tweets.tsx",
|
||||
"website/docusaurus.config.localized.json",
|
||||
"website/_dogfooding/_pages tests/diagrams.mdx",
|
||||
"*.xyz",
|
||||
"*.docx",
|
||||
"*.xsl",
|
||||
"*.xslt",
|
||||
"*.gitignore",
|
||||
"versioned_docs",
|
||||
"*.min.*",
|
||||
"jest/vendor"
|
||||
],
|
||||
"ignoreRegExpList": ["Email", "Urls", "#[\\w-]*"],
|
||||
"enableFiletypes": ["mdx"]
|
||||
"ignoreRegExpList": ["Email", "Urls", "#[\\w-]*"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,32 @@
|
|||
{
|
||||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
}
|
||||
},
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"orta.vscode-jest",
|
||||
"esbenp.prettier-vscode",
|
||||
"streetsidesoftware.code-spell-checker"
|
||||
]
|
||||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04",
|
||||
"settings": {
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
}
|
||||
},
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"orta.vscode-jest",
|
||||
"esbenp.prettier-vscode",
|
||||
"streetsidesoftware.code-spell-checker"
|
||||
],
|
||||
"forwardPorts": [3000],
|
||||
"containerUser": "vscode",
|
||||
"postCreateCommand": "yarn install",
|
||||
"waitFor": "postCreateCommand", // otherwise automated jest tests fail
|
||||
"features": {
|
||||
"node": {
|
||||
"version": "22"
|
||||
"version": "18"
|
||||
},
|
||||
"github-cli": "latest"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,3 @@ packages/create-docusaurus/lib/*
|
|||
packages/create-docusaurus/templates/facebook
|
||||
|
||||
website/_dogfooding/_swizzle_theme_tests
|
||||
website/_dogfooding/_asset-tests/badSyntax.js
|
||||
|
||||
|
||||
packages/docusaurus-plugin-ideal-image/src/theme/IdealImageLegacy
|
||||
|
|
|
|||
|
|
@ -9,18 +9,16 @@ const OFF = 0;
|
|||
const WARNING = 1;
|
||||
const ERROR = 2;
|
||||
|
||||
// Prevent importing lodash, usually for browser bundle size reasons
|
||||
const LodashImportPatterns = ['lodash', 'lodash.**', 'lodash/**'];
|
||||
|
||||
// Prevent importing content plugins, usually for coupling reasons
|
||||
const ContentPluginsImportPatterns = [
|
||||
'@docusaurus/plugin-content-blog',
|
||||
'@docusaurus/plugin-content-blog/**',
|
||||
// TODO fix theme-common => docs dependency issue
|
||||
// '@docusaurus/plugin-content-docs',
|
||||
// '@docusaurus/plugin-content-docs/**',
|
||||
'@docusaurus/plugin-content-pages',
|
||||
'@docusaurus/plugin-content-pages/**',
|
||||
const ClientRestrictedImportPatterns = [
|
||||
// Prevent importing lodash in client bundle for bundle size
|
||||
'lodash',
|
||||
'lodash.**',
|
||||
'lodash/**',
|
||||
// Prevent importing server code in client bundle
|
||||
'**/../babel/**',
|
||||
'**/../server/**',
|
||||
'**/../commands/**',
|
||||
'**/../webpack/**',
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
|
|
@ -34,7 +32,7 @@ module.exports = {
|
|||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
// tsconfigRootDir: __dirname,
|
||||
// project: ['./tsconfig.base.json', './website/tsconfig.base.json'],
|
||||
// project: ['./tsconfig.json', './website/tsconfig.json'],
|
||||
},
|
||||
globals: {
|
||||
JSX: true,
|
||||
|
|
@ -60,7 +58,6 @@ module.exports = {
|
|||
},
|
||||
reportUnusedDisableDirectives: true,
|
||||
plugins: [
|
||||
'react-compiler',
|
||||
'react-hooks',
|
||||
'header',
|
||||
'jest',
|
||||
|
|
@ -69,7 +66,6 @@ module.exports = {
|
|||
'@docusaurus',
|
||||
],
|
||||
rules: {
|
||||
'react-compiler/react-compiler': ERROR,
|
||||
'react/jsx-uses-react': OFF, // JSX runtime: automatic
|
||||
'react/react-in-jsx-scope': OFF, // JSX runtime: automatic
|
||||
'array-callback-return': WARNING,
|
||||
|
|
@ -89,14 +85,13 @@ module.exports = {
|
|||
ignorePattern: '(eslint-disable|@)',
|
||||
},
|
||||
],
|
||||
'arrow-body-style': OFF,
|
||||
'no-await-in-loop': OFF,
|
||||
'no-case-declarations': WARNING,
|
||||
'no-console': OFF,
|
||||
'no-constant-binary-expression': ERROR,
|
||||
'no-continue': OFF,
|
||||
'no-control-regex': WARNING,
|
||||
'no-else-return': OFF,
|
||||
'no-else-return': [WARNING, {allowElseIf: true}],
|
||||
'no-empty': [WARNING, {allowEmptyCatch: true}],
|
||||
'no-lonely-if': WARNING,
|
||||
'no-nested-ternary': WARNING,
|
||||
|
|
@ -208,13 +203,10 @@ module.exports = {
|
|||
})),
|
||||
],
|
||||
'no-template-curly-in-string': WARNING,
|
||||
'no-unused-expressions': [
|
||||
WARNING,
|
||||
{allowTaggedTemplates: true, allowShortCircuit: true},
|
||||
],
|
||||
'no-unused-expressions': [WARNING, {allowTaggedTemplates: true}],
|
||||
'no-useless-escape': WARNING,
|
||||
'no-void': [ERROR, {allowAsStatement: true}],
|
||||
'prefer-destructuring': OFF,
|
||||
'prefer-destructuring': WARNING,
|
||||
'prefer-named-capture-group': WARNING,
|
||||
'prefer-template': WARNING,
|
||||
yoda: WARNING,
|
||||
|
|
@ -298,13 +290,13 @@ module.exports = {
|
|||
'jest/expect-expect': OFF,
|
||||
'jest/no-large-snapshots': [
|
||||
WARNING,
|
||||
{maxSize: Infinity, inlineMaxSize: 50},
|
||||
{maxSize: Infinity, inlineMaxSize: 10},
|
||||
],
|
||||
'jest/no-test-return-statement': ERROR,
|
||||
'jest/prefer-expect-resolves': WARNING,
|
||||
'jest/prefer-lowercase-title': [WARNING, {ignore: ['describe']}],
|
||||
'jest/prefer-spy-on': WARNING,
|
||||
'jest/prefer-to-be': OFF,
|
||||
'jest/prefer-to-be': WARNING,
|
||||
'jest/prefer-to-have-length': WARNING,
|
||||
'jest/require-top-level-describe': ERROR,
|
||||
'jest/valid-title': [
|
||||
|
|
@ -352,7 +344,10 @@ module.exports = {
|
|||
ERROR,
|
||||
{'ts-expect-error': 'allow-with-description'},
|
||||
],
|
||||
'@typescript-eslint/consistent-indexed-object-style': OFF,
|
||||
'@typescript-eslint/consistent-indexed-object-style': [
|
||||
WARNING,
|
||||
'index-signature',
|
||||
],
|
||||
'@typescript-eslint/consistent-type-imports': [
|
||||
WARNING,
|
||||
{disallowTypeAnnotations: false},
|
||||
|
|
@ -382,14 +377,7 @@ module.exports = {
|
|||
// We don't provide any escape hatches for this rule. Rest siblings and
|
||||
// function placeholder params are always ignored, and any other unused
|
||||
// locals must be justified with a disable comment.
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
ERROR,
|
||||
{
|
||||
ignoreRestSiblings: true,
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-unused-vars': [ERROR, {ignoreRestSiblings: true}],
|
||||
'@typescript-eslint/prefer-optional-chain': ERROR,
|
||||
'@docusaurus/no-html-links': ERROR,
|
||||
'@docusaurus/prefer-docusaurus-heading': ERROR,
|
||||
|
|
@ -405,7 +393,6 @@ module.exports = {
|
|||
'@',
|
||||
'WebContainers',
|
||||
'Twitter',
|
||||
'X',
|
||||
'GitHub',
|
||||
'Dev.to',
|
||||
'1.x',
|
||||
|
|
@ -420,33 +407,7 @@ module.exports = {
|
|||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
patterns: [
|
||||
...LodashImportPatterns,
|
||||
...ContentPluginsImportPatterns,
|
||||
// Prevent importing server code in client bundle
|
||||
'**/../babel/**',
|
||||
'**/../server/**',
|
||||
'**/../commands/**',
|
||||
'**/../webpack/**',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'packages/docusaurus-theme-common/src/**/*.{js,ts,tsx}',
|
||||
'packages/docusaurus-utils-common/src/**/*.{js,ts,tsx}',
|
||||
],
|
||||
excludedFiles: '*.test.{js,ts,tsx}',
|
||||
rules: {
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
patterns: [
|
||||
...LodashImportPatterns,
|
||||
...ContentPluginsImportPatterns,
|
||||
],
|
||||
patterns: ClientRestrictedImportPatterns,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -458,7 +419,7 @@ module.exports = {
|
|||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
patterns: LodashImportPatterns.concat(
|
||||
patterns: ClientRestrictedImportPatterns.concat(
|
||||
// Prevents relative imports between React theme components
|
||||
[
|
||||
'../**',
|
||||
|
|
|
|||
|
|
@ -23,26 +23,25 @@ jobs:
|
|||
# Argos is heavy to run
|
||||
# We only want to trigger Argos on PRs with the 'Argos' label
|
||||
# See https://stackoverflow.com/questions/62325286/run-github-actions-when-pull-requests-have-a-specific-label
|
||||
if: ${{ (github.event_name != 'pull_request' && github.ref_name == 'main') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Argos')) }}
|
||||
if: ${{ github.ref_name == 'main' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Argos')) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
node-version: 18
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Install Playwright browsers
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Build website fast
|
||||
run: yarn argos:build
|
||||
run: yarn build:website:fast
|
||||
|
||||
- name: Take Argos screenshots
|
||||
run: yarn argos:screenshot
|
||||
|
|
|
|||
|
|
@ -22,15 +22,13 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
node-version: '18'
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
- name: Build blog-only
|
||||
run: yarn workspace website build:blogOnly
|
||||
env:
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
name: Build Hash Router
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- docusaurus-v**
|
||||
paths:
|
||||
- packages/**
|
||||
- .github/workflows/build-hash-router.yml
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Hash Router
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
|
||||
- name: Build Hash Router
|
||||
run: yarn build:website:fast
|
||||
env:
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
DOCUSAURUS_ROUTER: 'hash'
|
||||
# Note: hash router + baseUrl do not play well together
|
||||
# This would host at https://facebook.github.io/docusaurus/#/docusaurus/
|
||||
# BASE_URL: '/docusaurus/' # hash router +
|
||||
|
||||
- name: Upload Website artifact
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: website-hash-router-archive
|
||||
path: website/build
|
||||
|
||||
#- name: Upload Website Pages artifact
|
||||
# uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
|
||||
# with:
|
||||
# path: website/build
|
||||
|
||||
# Deploy to https://facebook.github.io/docusaurus/
|
||||
- name: Deploy to GitHub Pages
|
||||
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'main' }}
|
||||
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: website/build
|
||||
|
||||
## TODO we should be able to use this new deploy-pages action
|
||||
## However this requires a Meta admin to configure it here
|
||||
## https://github.com/facebook/docusaurus/settings/pages
|
||||
## So for now we keep using the former method
|
||||
## See https://docusaurus.io/docs/deployment#triggering-deployment-with-github-actions
|
||||
#deploy:
|
||||
# name: Deploy to GitHub Pages
|
||||
# if: ${{ github.event_name != 'pull_request' && github.ref_name == 'main' }}
|
||||
# needs: build
|
||||
# permissions:
|
||||
# pages: write
|
||||
# id-token: write
|
||||
# environment:
|
||||
# name: github-pages
|
||||
# url: ${{ steps.deployment.outputs.page_url }}
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Deploy to GitHub Pages
|
||||
# id: deployment
|
||||
# uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
|
||||
|
|
@ -11,7 +11,6 @@ on:
|
|||
- main
|
||||
- docusaurus-v**
|
||||
paths:
|
||||
- .github/workflows/build-perf.yml
|
||||
- package.json
|
||||
- yarn.lock
|
||||
- packages/**
|
||||
|
|
@ -26,7 +25,6 @@ permissions:
|
|||
contents: read
|
||||
|
||||
jobs:
|
||||
# Posts a PR comment with build size differences from PR vs main branches
|
||||
build-size:
|
||||
permissions:
|
||||
checks: write # for preactjs/compressed-size-action to create and update the checks
|
||||
|
|
@ -36,68 +34,45 @@ jobs:
|
|||
name: Build Size Report
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
DOCUSAURUS_INFRA: ['SLOWER', 'FASTER']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
node-version: '18'
|
||||
cache: yarn
|
||||
- name: Track build size changes
|
||||
uses: preactjs/compressed-size-action@8518045ed95e94e971b83333085e1cb99aa18aa8 # v2.9.0
|
||||
uses: preactjs/compressed-size-action@8119d3d31b6e57b167e09c81dfa877eada3bcb35 # v2
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build-script: build:website:fast
|
||||
build-script: build:website:en
|
||||
clean-script: clear:website # see https://github.com/facebook/docusaurus/pull/6838
|
||||
pattern: '{website/build/assets/js/main*js,website/build/assets/js/runtime~main*js,website/build/assets/css/styles*css,website/.docusaurus/globalData.json,website/.docusaurus/registry.js,website/.docusaurus/routes.js,website/.docusaurus/routesChunkNames.json,website/.docusaurus/site-metadata.json,website/.docusaurus/codeTranslations.json,website/.docusaurus/i18n.json,website/.docusaurus/docusaurus.config.mjs,website/build/index.html,website/build/docs.html,website/build/docs/**/*.html,website/build/blog.html,website/build/blog/**/*.html}'
|
||||
# HTML files: exclude versioned docs pages, tags pages, html redirect files
|
||||
exclude: '{website/build/docs/?.?.?/**/*.html,website/build/docs/next/**/*.html,website/build/blog/tags/**/*.html,**/*.html.html}'
|
||||
pattern: '{website/build/assets/js/main*js,website/build/assets/css/styles*css,website/.docusaurus/globalData.json,website/build/index.html,website/build/blog/index.html,website/build/blog/**/introducing-docusaurus/*,website/build/docs/index.html,website/build/docs/installation/index.html,website/build/tests/docs/index.html,website/build/tests/docs/standalone/index.html}'
|
||||
strip-hash: '\.([^;]\w{7})\.'
|
||||
minimum-change-threshold: 30
|
||||
compression: none
|
||||
comment-key: DOCUSAURUS_INFRA_${{ matrix.DOCUSAURUS_INFRA }}
|
||||
env:
|
||||
DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }}
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
|
||||
# Ensures build times stay under reasonable thresholds
|
||||
build-time:
|
||||
name: Build Time Perf
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
DOCUSAURUS_INFRA: ['SLOWER', 'FASTER']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
|
||||
# Ensure build with a cold cache does not increase too much
|
||||
- name: Build (cold cache)
|
||||
run: yarn build:website:fast
|
||||
timeout-minutes: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 3 || 2 }}
|
||||
env:
|
||||
DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }}
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
run: yarn workspace website build --locale en
|
||||
timeout-minutes: 8
|
||||
|
||||
# Ensure build with a warm cache does not increase too much
|
||||
- name: Build (warm cache)
|
||||
run: yarn build:website:fast
|
||||
# Temporary: upper value for Rspack until incremental cache works better
|
||||
timeout-minutes: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 1 || 2 }}
|
||||
env:
|
||||
DOCUSAURUS_SLOWER: ${{ matrix.DOCUSAURUS_INFRA == 'SLOWER' && 'true' || 'false' }}
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
|
||||
run: yarn workspace website build --locale en
|
||||
timeout-minutes: 2
|
||||
# TODO post a GitHub comment with build with perf warnings?
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
name: Canary Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- docusaurus-v**
|
||||
paths:
|
||||
- .github/workflows/canary-release.yml
|
||||
- package.json
|
||||
- packages/**
|
||||
|
||||
permissions:
|
||||
|
|
@ -20,13 +17,13 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
with:
|
||||
fetch-depth: 0 # Needed to get the commit number with "git rev-list --count HEAD"
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
node-version: '18'
|
||||
cache: yarn
|
||||
- name: Prepare git
|
||||
run: |
|
||||
|
|
@ -41,7 +38,7 @@ jobs:
|
|||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
- name: Publish Canary release
|
||||
run: |
|
||||
yarn canary
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@4e94bd11f71e507f7f87df81788dff88d1dacbfb # 4.31.0
|
||||
uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a # 2.13.4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@4e94bd11f71e507f7f87df81788dff88d1dacbfb # 4.31.0
|
||||
uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a # 2.13.4
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
name: Continuous Releases
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- docusaurus-v**
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Continuous Releases
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
|
||||
- name: Build packages
|
||||
run: yarn build:packages
|
||||
|
||||
- name: Initialize fresh templates
|
||||
run: |
|
||||
yarn create-docusaurus template/docusaurus-classic-js classic --javascript -p npm
|
||||
yarn create-docusaurus template/docusaurus-classic-ts classic --typescript -p npm
|
||||
|
||||
- name: Release
|
||||
run: npx pkg-pr-new@0.0.20 publish './packages/*' --template './template/*' --compact --comment=off
|
||||
|
|
@ -13,6 +13,6 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Dependency Review
|
||||
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # 4.8.2
|
||||
uses: actions/dependency-review-action@6c5ccdad469c9f8a2996bfecaec55a631a347034 # 3.1.0
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
name: Lighthouse Report
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- main
|
||||
- docusaurus-v**
|
||||
|
|
@ -21,23 +21,22 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
node-version: 18
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Build website fast
|
||||
run: yarn build:website:fast
|
||||
|
||||
- name: Audit URLs using Lighthouse
|
||||
id: lighthouse_audit
|
||||
uses: treosh/lighthouse-ci-action@fcd65974f7c4c2bf0ee9d09b84d2489183c29726 # 12.6.1
|
||||
uses: treosh/lighthouse-ci-action@03becbfc543944dd6e7534f7ff768abb8a296826 # 10.1.0
|
||||
with:
|
||||
urls: |
|
||||
http://localhost:3000
|
||||
|
|
@ -53,7 +52,7 @@ jobs:
|
|||
|
||||
- name: Format lighthouse score
|
||||
id: format_lighthouse_score
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # 8.0.0
|
||||
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
|
|
@ -65,7 +64,7 @@ jobs:
|
|||
|
||||
- name: Add Lighthouse stats as comment
|
||||
id: comment_to_pr
|
||||
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # 2.9.4
|
||||
uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd # 2.8.0
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
number: ${{ github.event.pull_request.number }}
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ jobs:
|
|||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
|
||||
- name: AutoFix Format
|
||||
run: yarn format
|
||||
|
|
@ -39,9 +39,6 @@ jobs:
|
|||
- name: AutoFix Spelling
|
||||
run: yarn lint:spelling:fix
|
||||
|
||||
- name: Print Diff
|
||||
run: git diff
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
|
||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: 'refactor: apply lint autofix'
|
||||
|
|
|
|||
|
|
@ -20,25 +20,20 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
node-version: '18'
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn install --frozen-lockfile || yarn install --frozen-lockfile || yarn install --frozen-lockfile
|
||||
run: yarn
|
||||
# run: yarn install --immutable # Fails if yarn.lock is modified (unfortunately only works for Yarn 2, and --frozen-lockfile is not the same!)
|
||||
- name: Check immutable yarn.lock
|
||||
run: git diff --exit-code
|
||||
|
||||
- name: Check for suspicious yarn.lock
|
||||
# for allowed aliases, see https://github.com/yargs/cliui/pull/139/files#r1670711112
|
||||
run: yarn lockfile-lint --path yarn.lock --type yarn --allowed-hosts yarn --validate-https --validate-package-names --validate-integrity --empty-hostname=false --allowed-package-name-aliases react-loadable react-helmet-async string-width-cjs strip-ansi-cjs wrap-ansi-cjs
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
echo "::add-matcher::.github/workflows/cspell-problem-matcher.json"
|
||||
yarn lint:ci
|
||||
|
||||
- name: Prettier Code
|
||||
run: yarn format:diff
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
node-version: '16'
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
- name: Test
|
||||
run: yarn test website/src/data/__tests__/user.test.ts
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ on:
|
|||
- yarn.lock
|
||||
- jest.config.mjs
|
||||
- packages/**
|
||||
- tsconfig.*.json
|
||||
- tsconfig.json
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
|
@ -20,7 +20,7 @@ on:
|
|||
- yarn.lock
|
||||
- jest.config.mjs
|
||||
- packages/**
|
||||
- tsconfig.*.json
|
||||
- tsconfig.json
|
||||
- admin/verdaccio.yaml
|
||||
- .github/workflows/tests-e2e.yml
|
||||
|
||||
|
|
@ -38,21 +38,21 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['20.0', '20', '22', '24', '25.1']
|
||||
node: ['18.0', '18', '20']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
- name: Generate test-website project against main branch
|
||||
run: yarn test:build:website -s
|
||||
- name: Install test-website project with Yarn v1
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn install
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
npm_config_registry: http://localhost:4873
|
||||
|
|
@ -62,58 +62,9 @@ jobs:
|
|||
env:
|
||||
E2E_TEST: true
|
||||
- name: Build test-website project
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: yarn build --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
run: yarn build
|
||||
working-directory: ../test-website
|
||||
|
||||
yarn-v1-windows:
|
||||
name: E2E — Yarn v1 Windows
|
||||
timeout-minutes: 30
|
||||
runs-on: windows-8-core
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Use Node.js LTS
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
- name: Generate test-website project against main branch
|
||||
# Not using test-release.sh => no verdaccio docker image on Windows
|
||||
# run: bash ./admin/scripts/test-release.sh -s
|
||||
run: yarn create-docusaurus test-website-in-workspace classic --typescript
|
||||
- name: Install test-website project with Yarn v1
|
||||
run: yarn || yarn || yarn
|
||||
working-directory: test-website-in-workspace
|
||||
- name: Start test-website project
|
||||
run: yarn start --no-open
|
||||
working-directory: test-website-in-workspace
|
||||
env:
|
||||
E2E_TEST: true
|
||||
- name: Build test-website project
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: yarn build --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
working-directory: test-website-in-workspace
|
||||
- name: Upload Website artifact
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: website-e2e-windows
|
||||
path: test-website-in-workspace/build
|
||||
|
||||
yarn-berry:
|
||||
name: E2E — Yarn Berry
|
||||
timeout-minutes: 30
|
||||
|
|
@ -124,14 +75,14 @@ jobs:
|
|||
variant: [-s, -st]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Use Node.js LTS
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js 18
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
node-version: '18'
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
- name: Generate test-website project with ${{ matrix.variant }} against main branch
|
||||
run: yarn test:build:website ${{ matrix.variant }}
|
||||
- name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }}
|
||||
|
|
@ -147,44 +98,29 @@ jobs:
|
|||
# https://yarnpkg.com/features/pnp#fallback-mode
|
||||
yarn config set pnpFallbackMode none
|
||||
|
||||
yarn || yarn || yarn
|
||||
yarn install
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
YARN_ENABLE_IMMUTABLE_INSTALLS: false # Yarn berry should create the lockfile, despite CI env
|
||||
- name: Install missing dependencies
|
||||
if: matrix.variant == '-st' && matrix.nodeLinker == 'pnp'
|
||||
run: |
|
||||
# These dependencies are referenced in the init project, not by our packages
|
||||
yarn add @docusaurus/theme-classic @docusaurus/types @types/node
|
||||
yarn config set packageExtensions --json '{ "unified@^9.2.2": { "dependencies": { "@types/unist": "^2.0.6" } } }'
|
||||
working-directory: ../test-website
|
||||
- name: Start test-website project
|
||||
run: yarn start --no-open
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
E2E_TEST: true
|
||||
- name: TypeCheck website
|
||||
- name: Type check
|
||||
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
|
||||
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
|
||||
working-directory: ../test-website
|
||||
run: yarn typecheck
|
||||
- name: TypeCheck website - min version - v5.1
|
||||
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
|
||||
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
|
||||
working-directory: ../test-website
|
||||
run: |
|
||||
yarn add typescript@5.1.6 --exact
|
||||
yarn typecheck
|
||||
- name: TypeCheck website - max version - Latest
|
||||
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
|
||||
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
|
||||
working-directory: ../test-website
|
||||
run: |
|
||||
yarn add typescript@latest --exact
|
||||
yarn typecheck
|
||||
|
||||
- name: Build test-website project
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: yarn build --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
run: yarn build
|
||||
working-directory: ../test-website
|
||||
|
||||
npm:
|
||||
|
|
@ -193,38 +129,28 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Use Node.js LTS
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js 18
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
node-version: '18'
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
- name: Generate test-website project against main branch
|
||||
run: yarn test:build:website -st
|
||||
run: yarn test:build:website -s
|
||||
- name: Install test-website project with npm
|
||||
run: npm install
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
npm_config_registry: http://localhost:4873
|
||||
- name: TypeCheck website
|
||||
working-directory: ../test-website
|
||||
run: yarn typecheck
|
||||
- name: Start test-website project
|
||||
run: npm run start -- --no-open
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
E2E_TEST: true
|
||||
- name: Build test-website project
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: npm run build -- --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
run: npm run build
|
||||
working-directory: ../test-website
|
||||
|
||||
pnpm:
|
||||
|
|
@ -233,38 +159,29 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Use Node.js LTS
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js 18
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
node-version: '18'
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
- name: Generate test-website project against main branch
|
||||
run: yarn test:build:website -st
|
||||
run: yarn test:build:website -s
|
||||
- name: Install test-website project with pnpm
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
pnpm install
|
||||
# Fix some peer dependencies errors
|
||||
pnpm add @algolia/client-search @types/react@17 typescript
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
npm_config_registry: http://localhost:4873
|
||||
- name: TypeCheck website
|
||||
working-directory: ../test-website
|
||||
run: yarn typecheck
|
||||
- name: Start test-website project
|
||||
run: pnpm start --no-open
|
||||
working-directory: ../test-website
|
||||
env:
|
||||
E2E_TEST: true
|
||||
- name: Build test-website project
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: pnpm run build --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=300'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
run: pnpm run build
|
||||
working-directory: ../test-website
|
||||
|
|
|
|||
|
|
@ -26,14 +26,14 @@ jobs:
|
|||
variant: ['js', 'ts']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Set up Node LTS
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: lts/*
|
||||
node-version: '18'
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
|
||||
# Swizzle all the theme components
|
||||
- name: Swizzle (${{matrix.action}} - ${{matrix.variant}})
|
||||
|
|
@ -43,4 +43,4 @@ jobs:
|
|||
run: yarn build:website:fast
|
||||
# Ensure swizzled site still typechecks
|
||||
- name: TypeCheck website
|
||||
run: yarn workspace website typecheck --project tsconfig.skipLibCheck.json
|
||||
run: yarn workspace website typecheck
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ on:
|
|||
- yarn.lock
|
||||
- jest.config.mjs
|
||||
- packages/**
|
||||
- tsconfig.*.json
|
||||
- .github/workflows/tests-windows.yml
|
||||
- tsconfig.json
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
|
|
@ -27,19 +26,18 @@ jobs:
|
|||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['20.0', '20', '22', '24', '25.1']
|
||||
node: ['18.0', '18', '20']
|
||||
steps:
|
||||
- name: Support longpaths
|
||||
run: git config --system core.longpaths true
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn || yarn || yarn # 3 attempts to avoid timeout errors...
|
||||
- name: Docusaurus Jest Tests
|
||||
run: yarn test
|
||||
- name: Create a deep path
|
||||
|
|
@ -54,24 +52,5 @@ jobs:
|
|||
run: yarn workspace website test:swizzle:wrap:ts
|
||||
- name: Docusaurus Build
|
||||
run: yarn build:website:fast
|
||||
env:
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
|
||||
- name: TypeCheck website
|
||||
# see https://github.com/facebook/docusaurus/pull/10486
|
||||
run: yarn workspace website typecheck
|
||||
- name: TypeCheck website - min version - v5.1
|
||||
run: |
|
||||
yarn add typescript@5.1.6 --exact -D -W --ignore-scripts
|
||||
|
||||
# DocSearch@4/ai@5 doesn't support TS 5.1 (with skipLibCheck=false)
|
||||
jq '.resolutions."@docsearch/react" = "^3.9.0"' package.json > package.json.tmp && mv -Force package.json.tmp package.json
|
||||
yarn add @docsearch/react@^3.9.0 --exact -D -W --ignore-scripts
|
||||
|
||||
yarn workspace website typecheck
|
||||
- name: TypeCheck website - max version - Latest
|
||||
# For latest TS there are often lib check errors, so we disable it
|
||||
# Details: https://github.com/facebook/docusaurus/pull/10486
|
||||
run: |
|
||||
yarn add typescript@latest --exact -D -W --ignore-scripts
|
||||
yarn workspace website typecheck --project tsconfig.skipLibCheck.json
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ on:
|
|||
- yarn.lock
|
||||
- jest.config.mjs
|
||||
- packages/**
|
||||
- tsconfig.*.json
|
||||
- .github/workflows/tests.yml
|
||||
- tsconfig.json
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
|
|
@ -27,48 +26,22 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['20.0', '20', '22', '24', '25.1']
|
||||
node: ['18.0', '18', '20']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn
|
||||
run: yarn
|
||||
- name: Test
|
||||
run: yarn test
|
||||
- name: TypeCheck website
|
||||
run: yarn workspace website typecheck
|
||||
- name: Remove Theme Internal Re-export
|
||||
run: yarn workspace @docusaurus/theme-common removeThemeInternalReexport
|
||||
- name: Docusaurus Build
|
||||
# We build 2 locales to ensure a localized site doesn't leak memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10599
|
||||
run: yarn build:website:fast --locale en --locale fr
|
||||
env:
|
||||
# Our website should build even with limited memory
|
||||
# See https://github.com/facebook/docusaurus/pull/10590
|
||||
NODE_OPTIONS: '--max-old-space-size=450'
|
||||
DOCUSAURUS_PERF_LOGGER: 'true'
|
||||
- name: Docusaurus site CSS order
|
||||
run: yarn workspace website test:css-order
|
||||
|
||||
- name: TypeCheck website
|
||||
# see https://github.com/facebook/docusaurus/pull/10486
|
||||
run: yarn workspace website typecheck
|
||||
- name: TypeCheck website - min version - v5.1
|
||||
run: |
|
||||
yarn add typescript@5.1.6 --exact -D -W --ignore-scripts
|
||||
|
||||
# DocSearch@4/ai@5 doesn't support TS 5.1 (with skipLibCheck=false)
|
||||
jq '.resolutions."@docsearch/react" = "^3.9.0"' package.json > package.json.tmp && mv -f package.json.tmp package.json
|
||||
yarn add @docsearch/react@^3.9.0 --exact -D -W --ignore-scripts
|
||||
|
||||
yarn workspace website typecheck
|
||||
- name: TypeCheck website - max version - Latest
|
||||
# For latest TS there are often lib check errors, so we disable it
|
||||
# Details: https://github.com/facebook/docusaurus/pull/10486
|
||||
run: |
|
||||
yarn add typescript@latest --exact -D -W --ignore-scripts
|
||||
yarn workspace website typecheck --project tsconfig.skipLibCheck.json
|
||||
run: yarn build:website:fast
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ package-lock.json
|
|||
.eslintcache
|
||||
|
||||
yarn-error.log
|
||||
website/build
|
||||
build
|
||||
coverage
|
||||
.docusaurus
|
||||
.cache-loader
|
||||
|
|
@ -38,17 +38,8 @@ website/_dogfooding/_swizzle_theme_tests
|
|||
|
||||
CrowdinTranslations_*.zip
|
||||
|
||||
website/.cpu-prof
|
||||
|
||||
website/i18n/**/*
|
||||
#!website/i18n/fr
|
||||
#!website/i18n/fr/**/*
|
||||
|
||||
.netlify
|
||||
|
||||
website/rspack-tracing.json
|
||||
website/rspack-tracing.pftrace
|
||||
website/bundler-cpu-profile.json
|
||||
website/profile.json.gz
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,12 @@
|
|||
dist
|
||||
node_modules
|
||||
.yarn
|
||||
**/build/**
|
||||
build
|
||||
coverage
|
||||
.docusaurus
|
||||
.idea
|
||||
|
||||
.svg
|
||||
*.svg
|
||||
|
||||
jest/vendor
|
||||
|
||||
argos/test-results
|
||||
|
||||
packages/lqip-loader/lib/
|
||||
packages/docusaurus/lib/
|
||||
packages/docusaurus-*/lib/*
|
||||
|
|
@ -32,5 +26,3 @@ website/static/katex/katex.min.css
|
|||
|
||||
website/changelog
|
||||
website/_dogfooding/_swizzle_theme_tests
|
||||
website/_dogfooding/_asset-tests/badSyntax.js
|
||||
website/_dogfooding/_asset-tests/badSyntax.css
|
||||
|
|
|
|||
|
|
@ -13,6 +13,5 @@ packages/docusaurus-*/lib/*
|
|||
packages/create-docusaurus/lib/*
|
||||
packages/create-docusaurus/templates/
|
||||
website/static/katex/katex.min.css
|
||||
website/_dogfooding/_asset-tests/badSyntax.css
|
||||
|
||||
jest/vendor
|
||||
|
|
|
|||
6757
CHANGELOG-v2.md
6757
CHANGELOG-v2.md
File diff suppressed because it is too large
Load Diff
8210
CHANGELOG.md
8210
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
|
|
@ -1,3 +1,3 @@
|
|||
# Code of Conduct
|
||||
|
||||
Meta has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated.
|
||||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ The [Open Source Guides](https://opensource.guide/) website has a collection of
|
|||
|
||||
## Code of Conduct
|
||||
|
||||
Meta has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
|
||||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
|
||||
|
||||
## Get Involved
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ There are many ways to contribute to Docusaurus, and many of them do not involve
|
|||
- Read through the [Docusaurus docs](https://docusaurus.io/docs/installation). If you find anything that is confusing or can be improved, you can click "Edit this page" at the bottom of most docs, which takes you to the GitHub interface to make and propose changes.
|
||||
- Take a look at the [features requested](https://github.com/facebook/docusaurus/labels/feature) by others in the community and consider opening a pull request if you see something you want to work on.
|
||||
|
||||
Contributions are very welcome. If you think you need help planning your contribution, please ping us on X at [@docusaurus](https://x.com/docusaurus) and let us know you are looking for a bit of help.
|
||||
Contributions are very welcome. If you think you need help planning your contribution, please ping us on Twitter at [@docusaurus](https://twitter.com/docusaurus) and let us know you are looking for a bit of help.
|
||||
|
||||
### Join our Discord Channel
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ If you're only fixing a bug, it's fine to submit a pull request right away but w
|
|||
|
||||
### Security Bugs
|
||||
|
||||
Meta has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.
|
||||
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.
|
||||
|
||||
### Feature requests
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ Apart from the `good first issue`, the following labels are also worth looking a
|
|||
- [`help wanted`](https://github.com/facebook/docusaurus/labels/help%20wanted): if you have specific knowledge in one domain, working on these issues can make your expertise shine.
|
||||
- [`status: accepting pr`](https://github.com/facebook/docusaurus/labels/status%3A%20accepting%20pr): community contributors can feel free to claim any of these.
|
||||
|
||||
If you want to work on any of these issues, just drop a message saying "I am working on this". **You do not need to ask for assignment to work on any issue explicitly marked as welcoming external contributions.** However, don't "cookie lick", or squat on an issue without actually sending a PR. You are automatically considered as giving up if you don't **send a PR within seven days after your comment**, and the issue automatically becomes up for grabs again.
|
||||
If you want to work on any of these issues, just drop a message saying "I'd like to work on this", and we will assign the issue to you and update the issue's status as "claimed". **You are expected to send a pull request within seven days** after that, so we can still delegate the issue to someone else if you are unavailable.
|
||||
|
||||
Alternatively, when opening an issue, you can also click the "self service" checkbox to indicate that you'd like to work on the issue yourself, which will also make us see the issue as "claimed".
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ This is also auto-fixable with the `header/header` ESLint rule.
|
|||
|
||||
### Contributor License Agreement (CLA)
|
||||
|
||||
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Meta open source project, you're good to go. If you are submitting a pull request for the first time, the Meta GitHub Bot will reply with a link to the CLA form. You may also [complete your CLA here](https://code.facebook.com/cla).
|
||||
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, the Facebook GitHub Bot will reply with a link to the CLA form. You may also [complete your CLA here](https://code.facebook.com/cla).
|
||||
|
||||
After you have signed the CLA, the CLA bot would automatically update the PR status. There's no need to open a new PR.
|
||||
|
||||
|
|
@ -214,16 +214,6 @@ After you have signed the CLA, the CLA bot would automatically update the PR sta
|
|||
|
||||
If it happens that you were unavailable and your PR gets closed, feel free to reopen once it's ready! We are still happy to review it, help you complete it, and eventually merge it.
|
||||
|
||||
### AI-assisted PRs
|
||||
|
||||
We welcome the use of AI tools for authoring PRs, and we love to see people pushing the boundaries of AI capabilities. The core team actively uses different AI tools in our development process. However, we are aware that **many people are sending entirely AI-generated PRs as a low-effort way to farm OSS contributions**, so please be mindful of the following etiquette to show your respect for our time and our codebase:
|
||||
|
||||
- **Be transparent**: If a significant portion of your code is AI generated, please indicate that in your PR description.
|
||||
- **Be accountable**: You are responsible for the code you submit, regardless of whether it was generated by AI or written by you. You should be able to explain every line of the code, ensure all tests pass, and address our reviews.
|
||||
- **Be reasonable**: Sometimes we receive 1k LOC PRs that are obviously AI-generated and implement unsolicited features. Please note that significant changes require prior communication and approval from the team in the form of an issue.
|
||||
|
||||
We retain the right to close any PR that we deem as unproductive or low-effort, even when we agree with the spirit of the change.
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
When adding a new breaking change, follow this template in your pull request:
|
||||
|
|
@ -237,10 +227,6 @@ When adding a new breaking change, follow this template in your pull request:
|
|||
- **Severity (number of people affected x effort)**:
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> Breaking changes should be discussed in the issue tracker before being implemented.
|
||||
|
||||
### What Happens Next?
|
||||
|
||||
The core Docusaurus team will be monitoring pull requests. Do help us by keeping pull requests consistent by following the guidelines above.
|
||||
|
|
|
|||
32
README.md
32
README.md
|
|
@ -1,16 +1,10 @@
|
|||
<div align="center">
|
||||
<h1 align="center">
|
||||
Docusaurus
|
||||
<br />
|
||||
<br />
|
||||
<a href="https://docusaurus.io">
|
||||
<img src="https://docusaurus.io/img/slash-introducing.svg" alt="Docusaurus">
|
||||
</a>
|
||||
</h1>
|
||||
</div>
|
||||
<h1 align="center">
|
||||
<p align="center">Docusaurus</p>
|
||||
<a href="https://docusaurus.io"><img src="https://docusaurus.io/img/slash-introducing.svg" alt="Docusaurus"></a>
|
||||
</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://x.com/docusaurus"><img src="https://img.shields.io/twitter/follow/docusaurus.svg?style=social" align="right" alt="Twitter Follow" /></a>
|
||||
<a href="https://twitter.com/docusaurus"><img src="https://img.shields.io/twitter/follow/docusaurus.svg?style=social" align="right" alt="Twitter Follow" /></a>
|
||||
<a href="#backers" alt="sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/backers/badge.svg" /></a>
|
||||
<a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/sponsors/badge.svg" /></a>
|
||||
<a href="https://www.npmjs.com/package/@docusaurus/core"><img src="https://img.shields.io/npm/v/@docusaurus/core.svg?style=flat" alt="npm version"></a>
|
||||
|
|
@ -20,13 +14,17 @@
|
|||
<a href= "https://github.com/prettier/prettier"><img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg"></a>
|
||||
<a href="#license"><img src="https://img.shields.io/github/license/sourcerer-io/hall-of-fame.svg?colorB=ff0000"></a>
|
||||
<a href="https://github.com/facebook/jest"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg" alt="Tested with Jest"></a>
|
||||
<a href="https://argos-ci.com" target="_blank" rel="noreferrer noopener" aria-label="Covered by Argos"><img src="https://argos-ci.com/badge.svg" alt="Covered by Argos" width="133" height="20" /></a>
|
||||
<a href="https://gitpod.io/#https://github.com/facebook/docusaurus"><img src="https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod" alt="Gitpod Ready-to-Code"/></a>
|
||||
<a href="https://app.netlify.com/sites/docusaurus-2/deploys"><img src="https://api.netlify.com/api/v1/badges/9e1ff559-4405-4ebe-8718-5e21c0774bc8/deploy-status" alt="Netlify Status"></a>
|
||||
<a href="https://meercode.io/facebook/docusaurus"><img src="https://meercode.io/badge/facebook/docusaurus?type=ci-score" alt="CI Score"></a>
|
||||
<a href="https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Ffacebook%2Fdocusaurus%2Ftree%2Fmain%2Fexamples%2Fclassic&project-name=my-docusaurus-site&repo-name=my-docusaurus-site"><img src="https://vercel.com/button" alt="Deploy with Vercel"/></a>
|
||||
<a href="https://app.netlify.com/start/deploy?repository=https://github.com/slorber/docusaurus-starter"><img src="https://www.netlify.com/img/deploy/button.svg" alt="Deploy to Netlify"></a>
|
||||
</p>
|
||||
|
||||
> **We are working hard on Docusaurus v2. If you are new to Docusaurus, try using the new version instead of v1. See the [Docusaurus v2 website](https://docusaurus.io/) for more details.**
|
||||
|
||||
> Docusaurus v1 doc is available at [v1.docusaurus.io](https://v1.docusaurus.io) and code is available on branch [docusaurus-v1](https://github.com/facebook/docusaurus/tree/docusaurus-v1)
|
||||
|
||||
## Introduction
|
||||
|
||||
Docusaurus is a project for building, deploying, and maintaining open source project websites easily.
|
||||
|
|
@ -45,7 +43,7 @@ Short on time? Check out our [5-minute tutorial ⏱️](https://tutorial.docusau
|
|||
|
||||
- **Customizable**
|
||||
|
||||
> While Docusaurus ships with the key pages and sections you need to get started, including a home page, a docs section, a [blog](https://docusaurus.io/docs/blog), and additional support pages, it is also [customizable](https://docusaurus.io/docs/creating-pages) to ensure you have a site that is [uniquely yours](https://docusaurus.io/docs/styling-layout).
|
||||
> While Docusaurus ships with the key pages and sections you need to get started, including a home page, a docs section, a [blog](https://docusaurus.io/docs/blog), and additional support pages, it is also [customizable](https://docusaurus.io/docs/creating-pages) as well to ensure you have a site that is [uniquely yours](https://docusaurus.io/docs/styling-layout).
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
@ -59,11 +57,11 @@ npm init docusaurus@latest
|
|||
|
||||
## Contributing
|
||||
|
||||
We've released Docusaurus because it helps us better scale and supports the many OSS projects at Meta. We hope that other organizations can benefit from the project. We are thankful for any contributions from the community.
|
||||
We've released Docusaurus because it helps us better scale and supports the many OSS projects at Facebook. We hope that other organizations can benefit from the project. We are thankful for any contributions from the community.
|
||||
|
||||
### [Code of Conduct](https://code.fb.com/codeofconduct)
|
||||
|
||||
Meta has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
|
||||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
|
||||
|
||||
### Contributing guide
|
||||
|
||||
|
|
@ -80,7 +78,7 @@ We have a few channels for contact:
|
|||
- [Discord](https://discord.gg/docusaurus):
|
||||
- `#general` for those using Docusaurus.
|
||||
- `#contributors` for those wanting to contribute to the Docusaurus core.
|
||||
- [@docusaurus](https://x.com/docusaurus) X
|
||||
- [@docusaurus](https://twitter.com/docusaurus) on Twitter
|
||||
- [GitHub Issues](https://github.com/facebook/docusaurus/issues)
|
||||
|
||||
## Contributors
|
||||
|
|
@ -120,4 +118,4 @@ The Docusaurus documentation (e.g., `.md` files in the `/docs` folder) is [Creat
|
|||
|
||||
[](https://rocketvalidator.com/)
|
||||
|
||||
[Rocket Validator](https://rocketvalidator.com/) helps us find [HTML markup and accessibility issues](https://rocketvalidator.com/stats/docusaurus.io).
|
||||
[Rocket Validator](https://rocketvalidator.com/) helps us find HTML markup or accessibility issues.
|
||||
|
|
|
|||
|
|
@ -31,27 +31,38 @@ async function getTsconfigFiles(): Promise<TsconfigFile[]> {
|
|||
}
|
||||
|
||||
const tsconfigSchema = Joi.object({
|
||||
extends: Joi.valid(
|
||||
'../../tsconfig.base.json',
|
||||
'../../tsconfig.base.client.json',
|
||||
extends: '../../tsconfig.json',
|
||||
compilerOptions: Joi.alternatives().conditional(
|
||||
Joi.object({noEmit: true}).unknown(),
|
||||
{
|
||||
then: Joi.object({
|
||||
noEmit: Joi.valid(true).required(),
|
||||
incremental: Joi.forbidden(),
|
||||
tsBuildInfoFile: Joi.forbidden(),
|
||||
outDir: Joi.forbidden(),
|
||||
}).unknown(),
|
||||
otherwise: Joi.object({
|
||||
noEmit: Joi.valid(false).required(),
|
||||
incremental: Joi.valid(true).required(),
|
||||
rootDir: Joi.valid('src').required(),
|
||||
outDir: Joi.valid('lib').required(),
|
||||
}).unknown(),
|
||||
},
|
||||
),
|
||||
}).unknown();
|
||||
|
||||
describe('tsconfig files', () => {
|
||||
it('contain all required fields', async () => {
|
||||
const tsconfigFiles = await getTsconfigFiles();
|
||||
|
||||
tsconfigFiles
|
||||
// Ignore noEmit configs
|
||||
.forEach((file) => {
|
||||
try {
|
||||
Joi.attempt(file.content, tsconfigSchema);
|
||||
} catch (e) {
|
||||
(
|
||||
e as Error
|
||||
).message += `\n${file.file} does not match the required schema.`;
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
tsconfigFiles.forEach((file) => {
|
||||
try {
|
||||
Joi.attempt(file.content, tsconfigSchema);
|
||||
} catch (e) {
|
||||
(
|
||||
e as Error
|
||||
).message += `\n${file.file} does not match the required schema.`;
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ const CookieName = 'DocusaurusPlaygroundName';
|
|||
|
||||
const PlaygroundConfigs = {
|
||||
codesandbox:
|
||||
'https://codesandbox.io/p/sandbox/github/facebook/docusaurus/tree/main/examples/classic?file=%2FREADME.md&privacy=public',
|
||||
'https://codesandbox.io/p/sandbox/github/facebook/docusaurus/tree/main/examples/classic?file=%2FREADME.md',
|
||||
'codesandbox-ts':
|
||||
'https://codesandbox.io/p/sandbox/github/facebook/docusaurus/tree/main/examples/classic-typescript?file=%2FREADME.md&privacy=public',
|
||||
'https://codesandbox.io/p/sandbox/github/facebook/docusaurus/tree/main/examples/classic-typescript?file=%2FREADME.md',
|
||||
|
||||
// Slow to load
|
||||
// stackblitz: 'https://stackblitz.com/github/facebook/docusaurus/tree/main/examples/classic',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "new.docusaurus.io",
|
||||
"version": "3.9.2",
|
||||
"version": "3.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "npx --package netlify-cli netlify dev"
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ yarn serve
|
|||
|
||||
This local test step is optional because it will be run by the CI on your release PR ([see](https://github.com/facebook/docusaurus/pull/2954/checks?check_run_id=780871959))
|
||||
|
||||
### 3. Update the changelog
|
||||
### 3. Update the v2 changelog
|
||||
|
||||
The changelog uses GitHub labels to classify each pull request. Use the GitHub interface to assign each newly merged pull request to a GitHub label starting with `pr:`, otherwise the PR won't appear in the changelog.
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ Not all labels will appear in the changelog—some are designed not to. However,
|
|||
is:pr is:merged sort:updated-desc -label:"pr: breaking change","pr: new feature","pr: bug fix","pr: performance","pr: polish","pr: documentation","pr: maintenance","pr: internal","pr: dependencies","pr: showcase"
|
||||
```
|
||||
|
||||
[Check tags of all recently merged Pull-Requests](https://github.com/facebook/docusaurus/pulls?q=is%3Apr+is%3Amerged+sort%3Aupdated-desc+-label%3A%22pr%3A+breaking+change%22%2C%22pr%3A+new+feature%22%2C%22pr%3A+bug+fix%22%2C%22pr%3A+performance%22%2C%22pr%3A+polish%22%2C%22pr%3A+documentation%22%2C%22pr%3A+maintenance%22%2C%22pr%3A+internal%22%2C%22pr%3A+dependencies%22%2C%22pr%3A+showcase%22%2C%22pr%3A+ignore%22%2C%22pr%3A+translations%22+)
|
||||
[Check tags of all recently merged Pull-Requests](https://github.com/facebook/docusaurus/pulls?q=is%3Apr+is%3Amerged+sort%3Aupdated-desc+-label%3A%22pr%3A+breaking+change%22%2C%22pr%3A+new+feature%22%2C%22pr%3A+bug+fix%22%2C%22pr%3A+performance%22%2C%22pr%3A+polish%22%2C%22pr%3A+documentation%22%2C%22pr%3A+maintenance%22%2C%22pr%3A+internal%22%2C%22pr%3A+dependencies%22%2C%22pr%3A+showcase%22)
|
||||
|
||||
Some general principles about the labeling process:
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ If all accesses are available, build all the necessary packages, and then run th
|
|||
|
||||
```sh
|
||||
yarn build:packages
|
||||
yarn lerna publish --force-publish --exact 2.0.0-beta.0
|
||||
yarn lerna publish --exact 2.0.0-beta.0
|
||||
```
|
||||
|
||||
This command does a few things:
|
||||
|
|
@ -218,7 +218,7 @@ Create a separate branch/PR and run `yarn examples:generate`
|
|||
|
||||
### 9. Notify people about new release (optional but desirable)
|
||||
|
||||
After new release, it is cool to notify our users about this in the Discord chat (`#announcements` channel) and write summaries on X using the following templates.
|
||||
After new release, it is cool to notify our users about this in the Discord chat (`#announcements` channel) and write summaries on Twitter using the following templates.
|
||||
|
||||
For Discord:
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ A new version %VER% is available now! 🎉
|
|||
See release notes at the following link https://github.com/facebook/docusaurus/releases/tag/%VER%
|
||||
```
|
||||
|
||||
For X:
|
||||
For Twitter:
|
||||
|
||||
```
|
||||
💥 A new version %VER% is available now! 💥
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
// @ts-check
|
||||
|
||||
/** @typedef {Record<'performance' | 'accessibility' | 'best-practices' | 'seo', number>} LighthouseSummary */
|
||||
/** @typedef {Record<'performance' | 'accessibility' | 'best-practices' | 'seo' | 'pwa', number>} LighthouseSummary */
|
||||
|
||||
/** @type {Record<keyof LighthouseSummary, string>} */
|
||||
const summaryKeys = {
|
||||
|
|
@ -15,6 +15,7 @@ const summaryKeys = {
|
|||
accessibility: 'Accessibility',
|
||||
'best-practices': 'Best Practices',
|
||||
seo: 'SEO',
|
||||
pwa: 'PWA',
|
||||
};
|
||||
|
||||
/** @param {number} rawScore */
|
||||
|
|
@ -41,23 +42,16 @@ function createURL(url) {
|
|||
* @param {Object} param0
|
||||
* @param {string} param0.url
|
||||
* @param {LighthouseSummary} param0.summary
|
||||
* @param {string | undefined} param0.reportUrl
|
||||
* @return {string}
|
||||
* @param {string} param0.reportUrl
|
||||
*/
|
||||
const createMarkdownTableRow = ({url, summary, reportUrl}) => {
|
||||
const columns = [
|
||||
`[${createURL(url).pathname}](${url})`,
|
||||
|
||||
const createMarkdownTableRow = ({url, summary, reportUrl}) =>
|
||||
[
|
||||
`| [${createURL(url).pathname}](${url})`,
|
||||
.../** @type {(keyof LighthouseSummary)[]} */ (
|
||||
Object.keys(summaryKeys)
|
||||
).map((k) => scoreEntry(summary[k])),
|
||||
|
||||
// See https://github.com/facebook/docusaurus/pull/10527
|
||||
reportUrl ? `[Report](${reportUrl})` : `Report N/A`,
|
||||
];
|
||||
|
||||
return `| ${columns.join(' | ')} |`;
|
||||
};
|
||||
`[Report](${reportUrl}) |`,
|
||||
].join(' | ');
|
||||
|
||||
const createMarkdownTableHeader = () => [
|
||||
['| URL', ...Object.values(summaryKeys), 'Report |'].join(' | '),
|
||||
|
|
@ -71,15 +65,18 @@ const createMarkdownTableHeader = () => [
|
|||
* @param {Record<string, string>} param0.links
|
||||
* @param {{url: string, summary: LighthouseSummary}[]} param0.results
|
||||
*/
|
||||
export default function formatLighthouseReport({results, links}) {
|
||||
const createLighthouseReport = ({results, links}) => {
|
||||
const tableHeader = createMarkdownTableHeader();
|
||||
const tableBody = results.map((result) => {
|
||||
const {url, summary} = result;
|
||||
const reportUrl = /** @type {string | undefined} */ (links[result.url]);
|
||||
const testUrl = /** @type {string} */ (
|
||||
Object.keys(links).find((key) => key === result.url)
|
||||
);
|
||||
const reportPublicUrl = /** @type {string} */ (links[testUrl]);
|
||||
|
||||
return createMarkdownTableRow({
|
||||
url,
|
||||
summary,
|
||||
reportUrl,
|
||||
url: testUrl,
|
||||
summary: result.summary,
|
||||
reportUrl: reportPublicUrl,
|
||||
});
|
||||
});
|
||||
const comment = [
|
||||
|
|
@ -90,4 +87,6 @@ export default function formatLighthouseReport({results, links}) {
|
|||
'',
|
||||
];
|
||||
return comment.join('\n');
|
||||
}
|
||||
};
|
||||
|
||||
export default createLighthouseReport;
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ async function generateTemplateExample(template) {
|
|||
// Run the docusaurus script to create the template in the examples folder
|
||||
const command = template.endsWith('-typescript')
|
||||
? template.replace('-typescript', ' -- --typescript')
|
||||
: `${template} -- --javascript`;
|
||||
|
||||
: template;
|
||||
shell.exec(
|
||||
// We use the published init script on purpose, because the local init is
|
||||
// too new and could generate upcoming/unavailable config options.
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ import fs from 'fs-extra';
|
|||
import path from 'path';
|
||||
import {fileURLToPath} from 'url';
|
||||
import {program} from 'commander';
|
||||
import {logger} from '@docusaurus/logger';
|
||||
import logger from '@docusaurus/logger';
|
||||
import sharp from 'sharp';
|
||||
import {imageSizeFromFile} from 'image-size/fromFile';
|
||||
import imageSize from 'image-size';
|
||||
|
||||
// You can use it as:
|
||||
//
|
||||
|
|
@ -64,7 +64,7 @@ program
|
|||
|
||||
await Promise.all(
|
||||
images.map(async (imgPath) => {
|
||||
const {width, height} = await imageSizeFromFile(imgPath);
|
||||
const {width, height} = imageSize(imgPath);
|
||||
const targetWidth =
|
||||
options.width ?? (imgPath.includes(showcasePath) ? 640 : 1000);
|
||||
const targetHeight =
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@
|
|||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
rm -rf ../test-website
|
||||
set -euo pipefail
|
||||
|
||||
CUSTOM_REGISTRY_URL="http://localhost:4873"
|
||||
NEW_VERSION="$(node -p "require('./packages/docusaurus/package.json').version")-NEW"
|
||||
|
|
@ -53,11 +51,8 @@ git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --
|
|||
# The website is generated outside the repo to minimize chances of yarn resolving the wrong version
|
||||
cd ..
|
||||
|
||||
echo Generating test-website in `pwd`
|
||||
|
||||
# Build skeleton website with new version
|
||||
npm_config_registry="$CUSTOM_REGISTRY_URL" npx --yes --loglevel silly create-docusaurus@"$NEW_VERSION" test-website classic --javascript $EXTRA_OPTS
|
||||
|
||||
npm_config_registry="$CUSTOM_REGISTRY_URL" npx create-docusaurus@"$NEW_VERSION" test-website classic $EXTRA_OPTS
|
||||
|
||||
# Stop Docker container
|
||||
if [[ -z "${KEEP_CONTAINER:-true}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
# test-bad-package
|
||||
|
||||
This package declares a wrong React version on purpose (16.14.0)
|
||||
|
||||
The goal is to test that the MD/MDX content of this package can still be imported/rendered by our website.
|
||||
|
||||
See related issue https://github.com/facebook/docusaurus/issues/9027
|
||||
|
||||
---
|
||||
|
||||
import {version as ReactVersion} from 'react';
|
||||
import {version as ReactDOMVersion} from 'react-dom';
|
||||
|
||||
export function TestComponent() {
|
||||
const expectedVersion = 19;
|
||||
if (!ReactVersion.startsWith(`${expectedVersion}`)) {
|
||||
throw new Error(
|
||||
`'test-bad-package/README.mdx' is rendered with bad React version: ${ReactVersion}`,
|
||||
);
|
||||
}
|
||||
if (!ReactVersion.startsWith(`${expectedVersion}`)) {
|
||||
throw new Error(
|
||||
`'test-bad-package/README.mdx' is rendered with bad React-DOM version: ${ReactDOMVersion}`,
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<div>React version: {ReactVersion}</div>
|
||||
<div>React DOM version: {ReactDOMVersion}</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
<TestComponent />
|
||||
|
||||
---
|
||||
|
||||
## MDX Components work:
|
||||
|
||||
<details>
|
||||
<summary>Summary</summary>
|
||||
|
||||
Details
|
||||
|
||||
</details>
|
||||
|
||||
```js
|
||||
const age = 42;
|
||||
```
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"name": "test-bad-package",
|
||||
"version": "3.9.2",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@mdx-js/react": "1.0.1",
|
||||
"react": "16.14.0",
|
||||
"react-dom": "16.14.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
{
|
||||
"name": "argos",
|
||||
"version": "3.9.2",
|
||||
"version": "3.1.0",
|
||||
"description": "Argos visual diff tests",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"screenshot": "playwright test",
|
||||
"upload": "npx @argos-ci/cli upload ./screenshots/chromium",
|
||||
"upload": "npx @argos-ci/cli upload ./screenshots",
|
||||
"report": "playwright show-report"
|
||||
},
|
||||
"dependencies": {
|
||||
"@argos-ci/playwright": "^2.0.0",
|
||||
"@playwright/test": "^1.48.1",
|
||||
"cheerio": "1.0.0-rc.12"
|
||||
"@argos-ci/playwright": "^1.0.1",
|
||||
"@playwright/test": "^1.36.1",
|
||||
"cheerio": "^1.0.0-rc.12"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import * as fs from 'fs';
|
|||
import {test} from '@playwright/test';
|
||||
import {argosScreenshot} from '@argos-ci/playwright';
|
||||
import * as cheerio from 'cheerio';
|
||||
import type {Page} from '@playwright/test';
|
||||
|
||||
const siteUrl = 'http://localhost:3000';
|
||||
const sitemapPath = '../website/build/sitemap.xml';
|
||||
|
|
@ -41,28 +40,8 @@ function isBlacklisted(pathname: string) {
|
|||
'/feature-requests',
|
||||
// Flaky because of dynamic canary version fetched from npm
|
||||
'/community/canary',
|
||||
// Flaky because of screenshots being taken dynamically
|
||||
'/showcase',
|
||||
// Long blog post with many image carousels, often timeouts
|
||||
'/blog/2022/08/01/announcing-docusaurus-2.0',
|
||||
|
||||
// DOGFOOD TESTS
|
||||
// React key errors:
|
||||
'/tests/docs/tests/toc-partials',
|
||||
// Console errors
|
||||
'/tests/pages/diagrams',
|
||||
'/tests/pages/markdown-tests-md',
|
||||
'/tests/pages/react-18',
|
||||
// Flaky because of hydration error
|
||||
'/tests/blog/archive',
|
||||
'/tests/pages/code-block-tests',
|
||||
'/tests/pages/embeds',
|
||||
// Flaky because of hydration error with docusaurus serve + .html
|
||||
'/tests/blog/x/y/z.html',
|
||||
'/tests/docs/dummy.html',
|
||||
// Cause weird docusaurus serve errors:
|
||||
'/tests/docs/tests/ascii/%C3%A6%C3%B8%C3%A5',
|
||||
'/tests/docs/tests/ascii/folder/%C3%A6%C3%B8%C3%A5',
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
@ -70,13 +49,6 @@ 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/docs/tests/category-links') ||
|
||||
pathname.startsWith('/tests/docs/tests/visibility') ||
|
||||
pathname.startsWith('/tests/blog/page/') ||
|
||||
pathname.startsWith('/tests/blog/tags/') ||
|
||||
// manually excluded urls
|
||||
BlacklistedPathnames.includes(pathname)
|
||||
);
|
||||
|
|
@ -89,12 +61,9 @@ function getPathnames(): string[] {
|
|||
(pathname) => !isBlacklisted(pathname),
|
||||
);
|
||||
pathnames.sort();
|
||||
/*
|
||||
console.log('Pathnames:\n', JSON.stringify(pathnames, null, 2));
|
||||
console.log('Pathnames before filtering', pathnamesUnfiltered.length);
|
||||
console.log('Pathnames after filtering', pathnames.length);
|
||||
|
||||
*/
|
||||
return pathnames;
|
||||
}
|
||||
|
||||
|
|
@ -122,48 +91,8 @@ function waitForDocusaurusHydration() {
|
|||
return document.documentElement.dataset.hasHydrated === 'true';
|
||||
}
|
||||
|
||||
// Ensure that Docusaurus site pages do not emit unexpected errors/warnings
|
||||
// See https://github.com/microsoft/playwright/issues/27277
|
||||
// TODO this shouldn't be the responsibility of Argos tests to do this
|
||||
// but this is convenient to do this here for now
|
||||
function throwOnConsole(page: Page) {
|
||||
const typesToCheck = ['error', 'warning'];
|
||||
|
||||
const ignoreMessages = [
|
||||
// TODO this fetch error message is unexpected and should be fixed
|
||||
// it's already happening in main branch
|
||||
'Failed to load resource: the server responded with a status of 404 (Not Found)',
|
||||
|
||||
// Warning because react-live not supporting React automatic JSX runtime
|
||||
// See https://github.com/FormidableLabs/react-live/issues/405
|
||||
'Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance',
|
||||
|
||||
// TODO weird problem related to KaTeX fonts refusing to decode?
|
||||
// on /docs/markdown-features/math-equations
|
||||
'Failed to decode downloaded font: http://localhost:3000/katex/fonts/',
|
||||
'OTS parsing error: Failed to convert WOFF 2.0 font to SFNT',
|
||||
|
||||
// Mermaid warning, see https://github.com/mermaid-js/mermaid/issues/6031
|
||||
'Do not assign mappings to elements without corresponding data',
|
||||
];
|
||||
|
||||
page.on('console', (message) => {
|
||||
if (!typesToCheck.includes(message.type())) {
|
||||
return;
|
||||
}
|
||||
if (ignoreMessages.some((msg) => message.text().includes(msg))) {
|
||||
return;
|
||||
}
|
||||
throw new Error(`Docusaurus site page unexpectedly logged something to the browser console
|
||||
Type=${message.type()}
|
||||
Text=${message.text()}
|
||||
Location=${message.location().url}`);
|
||||
});
|
||||
}
|
||||
|
||||
function createPathnameTest(pathname: string) {
|
||||
test(`pathname ${pathname}`, async ({page}) => {
|
||||
throwOnConsole(page);
|
||||
const url = siteUrl + pathname;
|
||||
await page.goto(url);
|
||||
await page.waitForFunction(waitForDocusaurusHydration);
|
||||
|
|
@ -173,10 +102,6 @@ function createPathnameTest(pathname: string) {
|
|||
});
|
||||
}
|
||||
|
||||
// Allow parallel execution within a single test file
|
||||
// See https://playwright.dev/docs/test-parallel
|
||||
test.describe.configure({mode: 'parallel'});
|
||||
|
||||
test.describe('Docusaurus site screenshots', () => {
|
||||
const pathnames = getPathnames();
|
||||
pathnames.forEach(createPathnameTest);
|
||||
|
|
|
|||
|
|
@ -20,19 +20,6 @@ languages_mapping: &languages_mapping
|
|||
two_letters_code:
|
||||
pt-BR: pt-BR
|
||||
|
||||
# Crowdin regularly update their MDX parser
|
||||
# Unfortunately, their v2 parser is more "MDX compliant" and thus can't parse
|
||||
# Docusaurus MDX files correctly due to our custom {#headingId} syntax.
|
||||
# Adding this type param permits using their older v1.2 parser.
|
||||
# Note: you can find the version of a file using browser DevTools
|
||||
# The source file icons will have a class such as "file_type_mdx_v1_2"
|
||||
#
|
||||
# TODO fix our headingId syntax
|
||||
# providing an explicit type is annoying and not future-proof
|
||||
# there's a risk that when adding an image in /docs, it will be parsed as mdx
|
||||
# and duplicating source file configs for various extensions is not great either
|
||||
mdx_file_type: &mdx_file_type mdx_v1_2
|
||||
|
||||
#
|
||||
# Files configuration
|
||||
#
|
||||
|
|
@ -40,33 +27,18 @@ files:
|
|||
- source: /website/i18n/en/**/*
|
||||
translation: /website/i18n/%two_letters_code%/**/%original_file_name%
|
||||
languages_mapping: *languages_mapping
|
||||
|
||||
- source: /website/docs/**/*.mdx
|
||||
translation: /website/i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%
|
||||
languages_mapping: *languages_mapping
|
||||
type: *mdx_file_type
|
||||
- source: /website/docs/**/*
|
||||
translation: /website/i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%
|
||||
languages_mapping: *languages_mapping
|
||||
ignore: [/**/*.mdx]
|
||||
|
||||
- source: /website/versioned_docs/**/*.mdx
|
||||
translation: /website/i18n/%two_letters_code%/docusaurus-plugin-content-docs/**/%original_file_name%
|
||||
languages_mapping: *languages_mapping
|
||||
type: *mdx_file_type
|
||||
- source: /website/versioned_docs/**/*
|
||||
translation: /website/i18n/%two_letters_code%/docusaurus-plugin-content-docs/**/%original_file_name%
|
||||
languages_mapping: *languages_mapping
|
||||
ignore: [/**/*.mdx]
|
||||
|
||||
- source: /website/community/**/*
|
||||
translation: /website/i18n/%two_letters_code%/docusaurus-plugin-content-docs-community/current/**/%original_file_name%
|
||||
languages_mapping: *languages_mapping
|
||||
|
||||
- source: /website/versioned_docs/**/*
|
||||
translation: /website/i18n/%two_letters_code%/docusaurus-plugin-content-docs/**/%original_file_name%
|
||||
languages_mapping: *languages_mapping
|
||||
- source: /website/blog/**/*
|
||||
translation: /website/i18n/%two_letters_code%/docusaurus-plugin-content-blog/**/%original_file_name%
|
||||
languages_mapping: *languages_mapping
|
||||
|
||||
- source: /website/src/pages/**/*
|
||||
translation: /website/i18n/%two_letters_code%/docusaurus-plugin-content-pages/**/%original_file_name%
|
||||
ignore: [/**/*.js, /**/*.jsx, /**/*.ts, /**/*.tsx, /**/*.css]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
These example projects are generated with the init CLI:
|
||||
|
||||
```bash
|
||||
```
|
||||
npx @docusaurus/init@latest init examples/<templateName> <templateName>`
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -2,40 +2,40 @@
|
|||
|
||||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
|
||||
|
||||
## Installation
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
$ yarn
|
||||
```
|
||||
|
||||
## Local Development
|
||||
### Local Development
|
||||
|
||||
```bash
|
||||
yarn start
|
||||
```
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
|
||||
|
||||
## Build
|
||||
### Build
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
```
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||
|
||||
## Deployment
|
||||
### Deployment
|
||||
|
||||
Using SSH:
|
||||
|
||||
```bash
|
||||
USE_SSH=true yarn deploy
|
||||
```
|
||||
$ USE_SSH=true yarn deploy
|
||||
```
|
||||
|
||||
Not using SSH:
|
||||
|
||||
```bash
|
||||
GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
|
||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
slug: first-blog-post
|
||||
title: First Blog Post
|
||||
authors: [slorber, yangshun]
|
||||
authors:
|
||||
name: Gao Wei
|
||||
title: Docusaurus Core Team
|
||||
url: https://github.com/wgao19
|
||||
image_url: https://github.com/wgao19.png
|
||||
tags: [hola, docusaurus]
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet...
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
slug: long-blog-post
|
||||
title: Long Blog Post
|
||||
authors: yangshun
|
||||
authors: endi
|
||||
tags: [hello, docusaurus]
|
||||
---
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ This is the summary of a very long blog post,
|
|||
|
||||
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
|
||||
|
||||
<!-- truncate -->
|
||||
<!--truncate-->
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
||||
|
|
|
|||
|
|
@ -11,14 +11,10 @@ Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/mar
|
|||
|
||||
Use the power of React to create interactive blog posts.
|
||||
|
||||
:::
|
||||
|
||||
{/* truncate */}
|
||||
|
||||
For example, use JSX to create an interactive button:
|
||||
|
||||
```js
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
```
|
||||
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
|
||||
:::
|
||||
|
|
|
|||
|
|
@ -7,10 +7,6 @@ tags: [facebook, hello, docusaurus]
|
|||
|
||||
[Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog).
|
||||
|
||||
Here are a few tips you might find useful.
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
Simply add Markdown files (or folders) to the `blog` directory.
|
||||
|
||||
Regular blog authors can be added to `authors.yml`.
|
||||
|
|
|
|||
|
|
@ -1,25 +1,17 @@
|
|||
endi:
|
||||
name: Endilie Yacop Sucipto
|
||||
title: Maintainer of Docusaurus
|
||||
url: https://github.com/endiliey
|
||||
image_url: https://github.com/endiliey.png
|
||||
|
||||
yangshun:
|
||||
name: Yangshun Tay
|
||||
title: Ex-Meta Staff Engineer, Co-founder GreatFrontEnd
|
||||
url: https://linkedin.com/in/yangshun
|
||||
title: Front End Engineer @ Facebook
|
||||
url: https://github.com/yangshun
|
||||
image_url: https://github.com/yangshun.png
|
||||
page: true
|
||||
socials:
|
||||
x: yangshunz
|
||||
linkedin: yangshun
|
||||
github: yangshun
|
||||
newsletter: https://www.greatfrontend.com
|
||||
|
||||
slorber:
|
||||
name: Sébastien Lorber
|
||||
title: Docusaurus maintainer
|
||||
url: https://sebastienlorber.com
|
||||
image_url: https://github.com/slorber.png
|
||||
page:
|
||||
# customize the url of the author page at /blog/authors/<permalink>
|
||||
permalink: '/all-sebastien-lorber-articles'
|
||||
socials:
|
||||
x: sebastienlorber
|
||||
linkedin: sebastienlorber
|
||||
github: slorber
|
||||
newsletter: https://thisweekinreact.com
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
facebook:
|
||||
label: Facebook
|
||||
permalink: /facebook
|
||||
description: Facebook tag description
|
||||
|
||||
hello:
|
||||
label: Hello
|
||||
permalink: /hello
|
||||
description: Hello tag description
|
||||
|
||||
docusaurus:
|
||||
label: Docusaurus
|
||||
permalink: /docusaurus
|
||||
description: Docusaurus tag description
|
||||
|
||||
hola:
|
||||
label: Hola
|
||||
permalink: /hola
|
||||
description: Hola tag description
|
||||
|
|
@ -14,7 +14,7 @@ Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new
|
|||
|
||||
### What you'll need
|
||||
|
||||
- [Node.js](https://nodejs.org/en/download/) version 20.0 or above:
|
||||
- [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
|
||||
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.
|
||||
|
||||
## Generate a new site
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ tags: [greetings]
|
|||
|
||||
Congratulations, you have made your first post!
|
||||
|
||||
Feel free to play around and edit this post as much as you like.
|
||||
Feel free to play around and edit this post as much you like.
|
||||
```
|
||||
|
||||
A new blog post is now available at [http://localhost:3000/blog/greetings](http://localhost:3000/blog/greetings).
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@ You can reference images relative to the current file as well. This is particula
|
|||
|
||||
Markdown code blocks are supported with Syntax highlighting.
|
||||
|
||||
````md
|
||||
```jsx title="src/components/HelloDocusaurus.js"
|
||||
function HelloDocusaurus() {
|
||||
return <h1>Hello, Docusaurus!</h1>;
|
||||
}
|
||||
```
|
||||
````
|
||||
```jsx title="src/components/HelloDocusaurus.js"
|
||||
function HelloDocusaurus() {
|
||||
return (
|
||||
<h1>Hello, Docusaurus!</h1>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
```jsx title="src/components/HelloDocusaurus.js"
|
||||
function HelloDocusaurus() {
|
||||
|
|
@ -79,19 +79,17 @@ function HelloDocusaurus() {
|
|||
|
||||
Docusaurus has a special syntax to create admonitions and callouts:
|
||||
|
||||
```md
|
||||
:::tip My tip
|
||||
:::tip My tip
|
||||
|
||||
Use this awesome feature option
|
||||
Use this awesome feature option
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
:::danger Take care
|
||||
:::danger Take care
|
||||
|
||||
This action is dangerous
|
||||
This action is dangerous
|
||||
|
||||
:::
|
||||
```
|
||||
:::
|
||||
|
||||
:::tip My tip
|
||||
|
||||
|
|
|
|||
|
|
@ -2,18 +2,11 @@ import {themes as prismThemes} from 'prism-react-renderer';
|
|||
import type {Config} from '@docusaurus/types';
|
||||
import type * as Preset from '@docusaurus/preset-classic';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
const config: Config = {
|
||||
title: 'My Site',
|
||||
tagline: 'Dinosaurs are cool',
|
||||
favicon: 'img/favicon.ico',
|
||||
|
||||
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
|
||||
future: {
|
||||
v4: true, // Improve compatibility with the upcoming Docusaurus v4
|
||||
},
|
||||
|
||||
// Set the production url of your site here
|
||||
url: 'https://your-docusaurus-site.example.com',
|
||||
// Set the /<baseUrl>/ pathname under which your site is served
|
||||
|
|
@ -26,6 +19,7 @@ const config: Config = {
|
|||
projectName: 'docusaurus', // Usually your repo name.
|
||||
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
|
||||
// Even if you don't use internationalization, you can use this field to set
|
||||
// useful metadata like html lang. For example, if your site is Chinese, you
|
||||
|
|
@ -48,18 +42,10 @@ const config: Config = {
|
|||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
feedOptions: {
|
||||
type: ['rss', 'atom'],
|
||||
xslt: true,
|
||||
},
|
||||
// Please change this to your repo.
|
||||
// Remove this to remove the "edit this page" links.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||
// Useful options to enforce blogging best practices
|
||||
onInlineTags: 'warn',
|
||||
onInlineAuthors: 'warn',
|
||||
onUntruncatedBlogPosts: 'warn',
|
||||
},
|
||||
theme: {
|
||||
customCss: './src/css/custom.css',
|
||||
|
|
@ -71,9 +57,6 @@ const config: Config = {
|
|||
themeConfig: {
|
||||
// Replace with your project's social card
|
||||
image: 'img/docusaurus-social-card.jpg',
|
||||
colorMode: {
|
||||
respectPrefersColorScheme: true,
|
||||
},
|
||||
navbar: {
|
||||
title: 'My Site',
|
||||
logo: {
|
||||
|
|
@ -119,8 +102,8 @@ const config: Config = {
|
|||
href: 'https://discordapp.com/invite/docusaurus',
|
||||
},
|
||||
{
|
||||
label: 'X',
|
||||
href: 'https://x.com/docusaurus',
|
||||
label: 'Twitter',
|
||||
href: 'https://twitter.com/docusaurus',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,19 +16,19 @@
|
|||
"dev": "docusaurus start"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.9.2",
|
||||
"@docusaurus/preset-classic": "3.9.2",
|
||||
"@docusaurus/core": "3.0.0",
|
||||
"@docusaurus/preset-classic": "3.0.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
"clsx": "^1.2.1",
|
||||
"prism-react-renderer": "^2.1.0",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.9.2",
|
||||
"@docusaurus/tsconfig": "3.9.2",
|
||||
"@docusaurus/types": "3.9.2",
|
||||
"typescript": "~5.6.2"
|
||||
"@docusaurus/module-type-aliases": "3.0.0",
|
||||
"@docusaurus/tsconfig": "3.0.0",
|
||||
"@docusaurus/types": "3.0.0",
|
||||
"typescript": "~5.2.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0"
|
||||
"node": ">=18.0"
|
||||
},
|
||||
"description": "Docusaurus example project (classic-typescript template)"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import type {ReactNode} from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Heading from '@theme/Heading';
|
||||
import styles from './styles.module.css';
|
||||
|
|
@ -6,7 +5,7 @@ import styles from './styles.module.css';
|
|||
type FeatureItem = {
|
||||
title: string;
|
||||
Svg: React.ComponentType<React.ComponentProps<'svg'>>;
|
||||
description: ReactNode;
|
||||
description: JSX.Element;
|
||||
};
|
||||
|
||||
const FeatureList: FeatureItem[] = [
|
||||
|
|
@ -56,7 +55,7 @@ function Feature({title, Svg, description}: FeatureItem) {
|
|||
);
|
||||
}
|
||||
|
||||
export default function HomepageFeatures(): ReactNode {
|
||||
export default function HomepageFeatures(): JSX.Element {
|
||||
return (
|
||||
<section className={styles.features}>
|
||||
<div className="container">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import type {ReactNode} from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
|
|
@ -29,7 +28,7 @@ function HomepageHeader() {
|
|||
);
|
||||
}
|
||||
|
||||
export default function Home(): ReactNode {
|
||||
export default function Home(): JSX.Element {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<Layout
|
||||
|
|
|
|||
|
|
@ -3,6 +3,5 @@
|
|||
"extends": "@docusaurus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [".docusaurus", "build"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,40 +2,40 @@
|
|||
|
||||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
|
||||
|
||||
## Installation
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
$ yarn
|
||||
```
|
||||
|
||||
## Local Development
|
||||
### Local Development
|
||||
|
||||
```bash
|
||||
yarn start
|
||||
```
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
|
||||
|
||||
## Build
|
||||
### Build
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
```
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||
|
||||
## Deployment
|
||||
### Deployment
|
||||
|
||||
Using SSH:
|
||||
|
||||
```bash
|
||||
USE_SSH=true yarn deploy
|
||||
```
|
||||
$ USE_SSH=true yarn deploy
|
||||
```
|
||||
|
||||
Not using SSH:
|
||||
|
||||
```bash
|
||||
GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
|
||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
slug: first-blog-post
|
||||
title: First Blog Post
|
||||
authors: [slorber, yangshun]
|
||||
authors:
|
||||
name: Gao Wei
|
||||
title: Docusaurus Core Team
|
||||
url: https://github.com/wgao19
|
||||
image_url: https://github.com/wgao19.png
|
||||
tags: [hola, docusaurus]
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet...
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
slug: long-blog-post
|
||||
title: Long Blog Post
|
||||
authors: yangshun
|
||||
authors: endi
|
||||
tags: [hello, docusaurus]
|
||||
---
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ This is the summary of a very long blog post,
|
|||
|
||||
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
|
||||
|
||||
<!-- truncate -->
|
||||
<!--truncate-->
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
||||
|
|
|
|||
|
|
@ -11,14 +11,10 @@ Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/mar
|
|||
|
||||
Use the power of React to create interactive blog posts.
|
||||
|
||||
:::
|
||||
|
||||
{/* truncate */}
|
||||
|
||||
For example, use JSX to create an interactive button:
|
||||
|
||||
```js
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
```
|
||||
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
|
||||
:::
|
||||
|
|
|
|||
|
|
@ -7,10 +7,6 @@ tags: [facebook, hello, docusaurus]
|
|||
|
||||
[Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog).
|
||||
|
||||
Here are a few tips you might find useful.
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
Simply add Markdown files (or folders) to the `blog` directory.
|
||||
|
||||
Regular blog authors can be added to `authors.yml`.
|
||||
|
|
|
|||
|
|
@ -1,25 +1,17 @@
|
|||
endi:
|
||||
name: Endilie Yacop Sucipto
|
||||
title: Maintainer of Docusaurus
|
||||
url: https://github.com/endiliey
|
||||
image_url: https://github.com/endiliey.png
|
||||
|
||||
yangshun:
|
||||
name: Yangshun Tay
|
||||
title: Ex-Meta Staff Engineer, Co-founder GreatFrontEnd
|
||||
url: https://linkedin.com/in/yangshun
|
||||
title: Front End Engineer @ Facebook
|
||||
url: https://github.com/yangshun
|
||||
image_url: https://github.com/yangshun.png
|
||||
page: true
|
||||
socials:
|
||||
x: yangshunz
|
||||
linkedin: yangshun
|
||||
github: yangshun
|
||||
newsletter: https://www.greatfrontend.com
|
||||
|
||||
slorber:
|
||||
name: Sébastien Lorber
|
||||
title: Docusaurus maintainer
|
||||
url: https://sebastienlorber.com
|
||||
image_url: https://github.com/slorber.png
|
||||
page:
|
||||
# customize the url of the author page at /blog/authors/<permalink>
|
||||
permalink: '/all-sebastien-lorber-articles'
|
||||
socials:
|
||||
x: sebastienlorber
|
||||
linkedin: sebastienlorber
|
||||
github: slorber
|
||||
newsletter: https://thisweekinreact.com
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
facebook:
|
||||
label: Facebook
|
||||
permalink: /facebook
|
||||
description: Facebook tag description
|
||||
|
||||
hello:
|
||||
label: Hello
|
||||
permalink: /hello
|
||||
description: Hello tag description
|
||||
|
||||
docusaurus:
|
||||
label: Docusaurus
|
||||
permalink: /docusaurus
|
||||
description: Docusaurus tag description
|
||||
|
||||
hola:
|
||||
label: Hola
|
||||
permalink: /hola
|
||||
description: Hola tag description
|
||||
|
|
@ -14,7 +14,7 @@ Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new
|
|||
|
||||
### What you'll need
|
||||
|
||||
- [Node.js](https://nodejs.org/en/download/) version 20.0 or above:
|
||||
- [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
|
||||
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.
|
||||
|
||||
## Generate a new site
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ tags: [greetings]
|
|||
|
||||
Congratulations, you have made your first post!
|
||||
|
||||
Feel free to play around and edit this post as much as you like.
|
||||
Feel free to play around and edit this post as much you like.
|
||||
```
|
||||
|
||||
A new blog post is now available at [http://localhost:3000/blog/greetings](http://localhost:3000/blog/greetings).
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@ You can reference images relative to the current file as well. This is particula
|
|||
|
||||
Markdown code blocks are supported with Syntax highlighting.
|
||||
|
||||
````md
|
||||
```jsx title="src/components/HelloDocusaurus.js"
|
||||
function HelloDocusaurus() {
|
||||
return <h1>Hello, Docusaurus!</h1>;
|
||||
}
|
||||
```
|
||||
````
|
||||
```jsx title="src/components/HelloDocusaurus.js"
|
||||
function HelloDocusaurus() {
|
||||
return (
|
||||
<h1>Hello, Docusaurus!</h1>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
```jsx title="src/components/HelloDocusaurus.js"
|
||||
function HelloDocusaurus() {
|
||||
|
|
@ -79,19 +79,17 @@ function HelloDocusaurus() {
|
|||
|
||||
Docusaurus has a special syntax to create admonitions and callouts:
|
||||
|
||||
```md
|
||||
:::tip My tip
|
||||
:::tip My tip
|
||||
|
||||
Use this awesome feature option
|
||||
Use this awesome feature option
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
:::danger Take care
|
||||
:::danger Take care
|
||||
|
||||
This action is dangerous
|
||||
This action is dangerous
|
||||
|
||||
:::
|
||||
```
|
||||
:::
|
||||
|
||||
:::tip My tip
|
||||
|
||||
|
|
|
|||
|
|
@ -6,19 +6,12 @@
|
|||
|
||||
import {themes as prismThemes} from 'prism-react-renderer';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: 'My Site',
|
||||
tagline: 'Dinosaurs are cool',
|
||||
favicon: 'img/favicon.ico',
|
||||
|
||||
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
|
||||
future: {
|
||||
v4: true, // Improve compatibility with the upcoming Docusaurus v4
|
||||
},
|
||||
|
||||
// Set the production url of your site here
|
||||
url: 'https://your-docusaurus-site.example.com',
|
||||
// Set the /<baseUrl>/ pathname under which your site is served
|
||||
|
|
@ -31,6 +24,7 @@ const config = {
|
|||
projectName: 'docusaurus', // Usually your repo name.
|
||||
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
|
||||
// Even if you don't use internationalization, you can use this field to set
|
||||
// useful metadata like html lang. For example, if your site is Chinese, you
|
||||
|
|
@ -54,18 +48,10 @@ const config = {
|
|||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
feedOptions: {
|
||||
type: ['rss', 'atom'],
|
||||
xslt: true,
|
||||
},
|
||||
// Please change this to your repo.
|
||||
// Remove this to remove the "edit this page" links.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||
// Useful options to enforce blogging best practices
|
||||
onInlineTags: 'warn',
|
||||
onInlineAuthors: 'warn',
|
||||
onUntruncatedBlogPosts: 'warn',
|
||||
},
|
||||
theme: {
|
||||
customCss: './src/css/custom.css',
|
||||
|
|
@ -79,9 +65,6 @@ const config = {
|
|||
({
|
||||
// Replace with your project's social card
|
||||
image: 'img/docusaurus-social-card.jpg',
|
||||
colorMode: {
|
||||
respectPrefersColorScheme: true,
|
||||
},
|
||||
navbar: {
|
||||
title: 'My Site',
|
||||
logo: {
|
||||
|
|
@ -127,8 +110,8 @@ const config = {
|
|||
href: 'https://discordapp.com/invite/docusaurus',
|
||||
},
|
||||
{
|
||||
label: 'X',
|
||||
href: 'https://x.com/docusaurus',
|
||||
label: 'Twitter',
|
||||
href: 'https://twitter.com/docusaurus',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -15,17 +15,17 @@
|
|||
"dev": "docusaurus start"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.9.2",
|
||||
"@docusaurus/preset-classic": "3.9.2",
|
||||
"@docusaurus/core": "3.0.0",
|
||||
"@docusaurus/preset-classic": "3.0.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
"clsx": "^1.2.1",
|
||||
"prism-react-renderer": "^2.1.0",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.9.2",
|
||||
"@docusaurus/types": "3.9.2"
|
||||
"@docusaurus/module-type-aliases": "3.0.0",
|
||||
"@docusaurus/types": "3.0.0"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0"
|
||||
"node": ">=18.0"
|
||||
},
|
||||
"description": "Docusaurus example project"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
// @ts-check
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
|
|
@ -11,9 +7,11 @@
|
|||
The sidebars can be generated from the filesystem, or explicitly defined here.
|
||||
|
||||
Create as many sidebars as you want.
|
||||
|
||||
@type {import('@docusaurus/plugin-content-docs').SidebarsConfig}
|
||||
*/
|
||||
|
||||
// @ts-check
|
||||
|
||||
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
||||
const sidebars = {
|
||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -32,16 +32,15 @@ const ignorePatterns = [
|
|||
export default {
|
||||
rootDir: fileURLToPath(new URL('.', import.meta.url)),
|
||||
verbose: true,
|
||||
// Default 5s timeout often fails on Windows :s,
|
||||
// see https://github.com/facebook/docusaurus/pull/8259
|
||||
testTimeout: 15000,
|
||||
setupFiles: ['./jest/setup.js'],
|
||||
testEnvironmentOptions: {
|
||||
url: 'https://docusaurus.io/',
|
||||
},
|
||||
testEnvironment: 'node',
|
||||
testPathIgnorePatterns: ignorePatterns,
|
||||
watchPathIgnorePatterns: ['/\\.docusaurus'],
|
||||
// Default 5s timeout often fails on Windows :s,
|
||||
// see https://github.com/facebook/docusaurus/pull/8259
|
||||
testTimeout: 15000,
|
||||
coveragePathIgnorePatterns: [
|
||||
...ignorePatterns,
|
||||
// We also ignore all package entry points
|
||||
|
|
|
|||
|
|
@ -12,3 +12,8 @@ declare module 'to-vfile' {
|
|||
|
||||
export function read(path: string, encoding?: string): Promise<VFile>;
|
||||
}
|
||||
|
||||
declare module '@testing-utils/git' {
|
||||
const createTempRepo: typeof import('./utils/git').createTempRepo;
|
||||
export {createTempRepo};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ function normalizePaths<T>(value: T): T {
|
|||
(val) => val.split(cwdReal).join('<PROJECT_ROOT>'),
|
||||
(val) => val.split(cwd).join('<PROJECT_ROOT>'),
|
||||
|
||||
// Replace temp directory with <TEMP_DIR>
|
||||
// Replace home directory with <TEMP_DIR>
|
||||
(val) => val.split(tempDirReal).join('<TEMP_DIR>'),
|
||||
(val) => val.split(tempDir).join('<TEMP_DIR>'),
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import shell from 'shelljs';
|
||||
|
||||
class Git {
|
||||
constructor(private dir: string) {
|
||||
const res = shell.exec('git init', {cwd: dir, silent: true});
|
||||
if (res.code !== 0) {
|
||||
throw new Error(`git init exited with code ${res.code}.
|
||||
stderr: ${res.stderr}
|
||||
stdout: ${res.stdout}`);
|
||||
}
|
||||
// Doesn't matter currently
|
||||
shell.exec('git config user.email "test@jc-verse.com"', {
|
||||
cwd: dir,
|
||||
silent: true,
|
||||
});
|
||||
shell.exec('git config user.name "Test"', {cwd: dir, silent: true});
|
||||
|
||||
shell.exec('git commit --allow-empty -m "First commit"', {
|
||||
cwd: dir,
|
||||
silent: true,
|
||||
});
|
||||
}
|
||||
commit(msg: string, date: string, author: string): void {
|
||||
const addRes = shell.exec('git add .', {cwd: this.dir, silent: true});
|
||||
const commitRes = shell.exec(
|
||||
`git commit -m "${msg}" --date "${date}T00:00:00Z" --author "${author}"`,
|
||||
{
|
||||
cwd: this.dir,
|
||||
env: {GIT_COMMITTER_DATE: `${date}T00:00:00Z`},
|
||||
silent: true,
|
||||
},
|
||||
);
|
||||
if (addRes.code !== 0) {
|
||||
throw new Error(`git add exited with code ${addRes.code}.
|
||||
stderr: ${addRes.stderr}
|
||||
stdout: ${addRes.stdout}`);
|
||||
}
|
||||
if (commitRes.code !== 0) {
|
||||
throw new Error(`git commit exited with code ${commitRes.code}.
|
||||
stderr: ${commitRes.stderr}
|
||||
stdout: ${commitRes.stdout}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This function is sync so the same mock repo can be shared across tests
|
||||
export function createTempRepo(): {repoDir: string; git: Git} {
|
||||
const repoDir = fs.mkdtempSync(path.join(os.tmpdir(), 'git-test-repo'));
|
||||
|
||||
const git = new Git(repoDir);
|
||||
|
||||
return {repoDir, git};
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "3.9.2",
|
||||
"version": "3.1.0",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"useNx": false,
|
||||
|
|
@ -13,8 +13,7 @@
|
|||
"pr: polish": ":nail_care: Polish",
|
||||
"pr: documentation": ":memo: Documentation",
|
||||
"pr: dependencies": ":robot: Dependencies",
|
||||
"pr: maintenance": ":wrench: Maintenance",
|
||||
"pr: translations": ":globe_with_meridians: Translations"
|
||||
"pr: maintenance": ":wrench: Maintenance"
|
||||
},
|
||||
"cacheDir": ".changelog"
|
||||
}
|
||||
|
|
|
|||
47
package.json
47
package.json
|
|
@ -9,13 +9,11 @@
|
|||
"website",
|
||||
"test-website-in-workspace",
|
||||
"packages/create-docusaurus/templates/*",
|
||||
"admin/test-bad-package",
|
||||
"admin/new.docusaurus.io"
|
||||
],
|
||||
"scripts": {
|
||||
"start": "yarn build:packages && yarn start:website",
|
||||
"start:website": "yarn workspace website start",
|
||||
"start:website:profile": "DOCUSAURUS_BUNDLER_CPU_PROFILE=true DOCUSAURUS_RSPACK_TRACE=true yarn workspace website start",
|
||||
"start:website:baseUrl": "yarn workspace website start:baseUrl",
|
||||
"start:website:blogOnly": "yarn workspace website start:blogOnly",
|
||||
"start:website:deployPreview": "cross-env NETLIFY=true CONTEXT='deploy-preview' yarn workspace website start",
|
||||
|
|
@ -23,17 +21,13 @@
|
|||
"build": "yarn build:packages && yarn build:website",
|
||||
"build:packages": "lerna run build --no-private",
|
||||
"build:website": "yarn workspace website build",
|
||||
"build:website:profile": "DOCUSAURUS_BUNDLER_CPU_PROFILE=true DOCUSAURUS_RSPACK_TRACE=true yarn workspace website build",
|
||||
"build:website:baseUrl": "yarn workspace website build:baseUrl",
|
||||
"build:website:blogOnly": "yarn workspace website build:blogOnly",
|
||||
"build:website:deployPreview:testWrap": "yarn workspace website test:swizzle:wrap:ts",
|
||||
"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:rsdoctor": "yarn workspace website build:fast:rsdoctor",
|
||||
"build:website:en": "yarn workspace website build --locale en",
|
||||
"profile:bundle:cpu": "yarn workspace website profile:bundle:cpu:profile",
|
||||
"profile:bundle:samply": "yarn workspace website profile:bundle:samply",
|
||||
"clear:website": "yarn workspace website clear",
|
||||
"serve:website": "yarn workspace website serve",
|
||||
"serve:website:baseUrl": "serve website",
|
||||
|
|
@ -44,16 +38,13 @@
|
|||
"crowdin:upload:website": "crowdin upload sources --config ./crowdin-v2.yaml",
|
||||
"crowdin:download": "crowdin download --config ./crowdin-v2.yaml",
|
||||
"crowdin:download:website": "yarn crowdin:download --language fr --language ko --language pt-BR --language zh-CN --language ja",
|
||||
"argos": "yarn argos:build && yarn argos:screenshot",
|
||||
"argos:build": "cross-env DOCUSAURUS_ARGOS_BUILD=true yarn build:website:fast --dev",
|
||||
"argos:screenshot": "yarn workspace argos screenshot",
|
||||
"canary": "yarn canary:bumpVersion && yarn canary:publish",
|
||||
"canary:getCoreVersion": "node -p \"require('./packages/docusaurus/package.json').version\"",
|
||||
"canary:version": "echo `yarn --silent canary:getCoreVersion`-canary-`git rev-list --count HEAD`+`git rev-parse --short HEAD`",
|
||||
"canary:version": "echo 0.0.0-`git rev-list --count HEAD`+`git rev-parse --short HEAD`",
|
||||
"canary:bumpVersion": "yarn lerna version `yarn --silent canary:version` --exact --no-push --yes",
|
||||
"canary:publish": "yarn lerna publish from-package --dist-tag canary --yes --no-verify-access",
|
||||
"changelog": "lerna-changelog",
|
||||
"postinstall": "patch-package && yarn lock:update && yarn build:packages",
|
||||
"postinstall": "yarn lock:update && yarn build:packages",
|
||||
"prepare": "husky install",
|
||||
"format": "prettier --write .",
|
||||
"format:diff": "prettier --list-different .",
|
||||
|
|
@ -62,7 +53,7 @@
|
|||
"lint:js": "eslint --cache --report-unused-disable-directives \"**/*.{js,jsx,ts,tsx,mjs}\"",
|
||||
"lint:js:fix": "yarn lint:js --fix",
|
||||
"lint:spelling": "cspell \"**\" --no-progress --show-context --show-suggestions",
|
||||
"lint:spelling:fix": "yarn rimraf project-words.txt && echo \"# Project Words - DO NOT TOUCH - This is updated through CI\" >> project-words.txt && yarn -s lint:spelling --words-only --unique --no-exit-code --no-summary \"**\" | cross-env LC_ALL=C sort --ignore-case >> project-words.txt",
|
||||
"lint:spelling:fix": "yarn rimraf project-words.txt && echo \"# Project Words - DO NOT TOUCH - This is updated through CI\" >> project-words.txt && yarn -s lint:spelling --words-only --unique --no-exit-code --no-summary \"**\" | sort --ignore-case >> project-words.txt",
|
||||
"lint:style": "stylelint \"**/*.css\"",
|
||||
"lint:style:fix": "yarn lint:style --fix",
|
||||
"lerna": "lerna",
|
||||
|
|
@ -76,23 +67,23 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@crowdin/cli": "^3.13.0",
|
||||
"@prettier/plugin-xml": "^2.2.0",
|
||||
"@swc/core": "^1.7.14",
|
||||
"@swc/jest": "^0.2.36",
|
||||
"@swc/core": "1.2.197",
|
||||
"@swc/jest": "^0.2.26",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/lodash": "^4.14.197",
|
||||
"@types/node": "^18.16.19",
|
||||
"@types/prompts": "^2.4.4",
|
||||
"@types/react": "^18.2.15",
|
||||
"@types/react-dev-utils": "^9.0.11",
|
||||
"@types/react-test-renderer": "^18.0.0",
|
||||
"@types/semver": "^7.5.0",
|
||||
"@types/shelljs": "^0.8.12",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"cspell": "^8.18.1",
|
||||
"cspell": "^8.1.0",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
|
|
@ -101,25 +92,22 @@
|
|||
"eslint-plugin-jest": "^27.2.3",
|
||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-compiler": "^19.0.0-beta-40c6c23-20250301",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-regexp": "^1.15.0",
|
||||
"husky": "^8.0.3",
|
||||
"image-size": "^2.0.2",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"jest-serializer-ansi-escapes": "^3.0.0",
|
||||
"image-size": "^1.0.2",
|
||||
"jest": "^29.6.1",
|
||||
"jest-environment-jsdom": "^29.6.1",
|
||||
"jest-serializer-ansi-escapes": "^2.0.1",
|
||||
"jest-serializer-react-helmet-async": "^1.0.21",
|
||||
"lerna": "^6.6.2",
|
||||
"lerna-changelog": "^2.2.0",
|
||||
"lint-staged": "~13.2.3",
|
||||
"lockfile-lint": "^4.14.0",
|
||||
"lint-staged": "^13.2.3",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"patch-package": "^8.0.0",
|
||||
"postinstall-postinstall": "^2.1.0",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier": "^2.8.4",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"react-helmet-async": "^1.3.0",
|
||||
"react-test-renderer": "^18.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"sharp": "^0.32.3",
|
||||
|
|
@ -127,7 +115,6 @@
|
|||
"stylelint": "^14.16.1",
|
||||
"stylelint-config-prettier": "^9.0.5",
|
||||
"stylelint-config-standard": "^29.0.0",
|
||||
"typescript": "~5.8.2"
|
||||
},
|
||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||
"typescript": "~5.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ For Docusaurus maintainers, templates can be tested with:
|
|||
```bash
|
||||
cd `git rev-parse --show-toplevel` # Back to repo root
|
||||
rm -rf test-website
|
||||
yarn create-docusaurus test-website classic --javascript
|
||||
yarn create-docusaurus test-website classic
|
||||
cd test-website
|
||||
yarn start
|
||||
```
|
||||
|
|
@ -37,7 +37,7 @@ Use the following to test the templates against local packages:
|
|||
```bash
|
||||
cd `git rev-parse --show-toplevel` # Back to repo root
|
||||
rm -rf test-website-in-workspace
|
||||
yarn create-docusaurus test-website-in-workspace classic --javascript
|
||||
yarn create-docusaurus test-website-in-workspace classic
|
||||
cd test-website-in-workspace
|
||||
yarn build
|
||||
yarn start
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
import path from 'path';
|
||||
import {createRequire} from 'module';
|
||||
import {logger} from '@docusaurus/logger';
|
||||
import logger from '@docusaurus/logger';
|
||||
import semver from 'semver';
|
||||
import {program} from 'commander';
|
||||
|
||||
|
|
@ -38,7 +38,6 @@ program
|
|||
'Do not run package manager immediately after scaffolding',
|
||||
)
|
||||
.option('-t, --typescript', 'Use the TypeScript template variant')
|
||||
.option('-j, --javascript', 'Use the JavaScript template variant')
|
||||
.option(
|
||||
'-g, --git-strategy <strategy>',
|
||||
`Only used if the template is a git repository.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "create-docusaurus",
|
||||
"version": "3.9.2",
|
||||
"version": "3.1.0",
|
||||
"description": "Create Docusaurus apps easily.",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
|
|
@ -22,14 +22,14 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@docusaurus/logger": "3.9.2",
|
||||
"@docusaurus/utils": "3.9.2",
|
||||
"@docusaurus/logger": "3.1.0",
|
||||
"@docusaurus/utils": "3.1.0",
|
||||
"commander": "^5.1.0",
|
||||
"execa": "^5.1.1",
|
||||
"fs-extra": "^11.1.1",
|
||||
"lodash": "^4.17.21",
|
||||
"prompts": "^2.4.2",
|
||||
"semver": "^7.5.4",
|
||||
"shelljs": "^0.8.5",
|
||||
"supports-color": "^9.4.0",
|
||||
"tslib": "^2.6.0"
|
||||
},
|
||||
|
|
@ -37,6 +37,6 @@
|
|||
"@types/supports-color": "^8.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0"
|
||||
"node": ">=18.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,36 +9,19 @@ import fs from 'fs-extra';
|
|||
import {fileURLToPath} from 'url';
|
||||
import path from 'path';
|
||||
import _ from 'lodash';
|
||||
import {logger} from '@docusaurus/logger';
|
||||
import execa from 'execa';
|
||||
import logger from '@docusaurus/logger';
|
||||
import shell from 'shelljs';
|
||||
import prompts, {type Choice} from 'prompts';
|
||||
import supportsColor from 'supports-color';
|
||||
import {escapeShellArg} from '@docusaurus/utils';
|
||||
|
||||
// TODO remove dependency on large @docusaurus/utils
|
||||
// would be better to have a new smaller @docusaurus/utils-cli package
|
||||
import {askPreferredLanguage} from '@docusaurus/utils';
|
||||
|
||||
type LanguagesOptions = {
|
||||
javascript?: boolean;
|
||||
typescript?: boolean;
|
||||
};
|
||||
|
||||
type CLIOptions = LanguagesOptions & {
|
||||
type CLIOptions = {
|
||||
packageManager?: PackageManager;
|
||||
skipInstall?: boolean;
|
||||
typescript?: boolean;
|
||||
gitStrategy?: GitStrategy;
|
||||
};
|
||||
|
||||
async function getLanguage(options: LanguagesOptions) {
|
||||
if (options.typescript) {
|
||||
return 'typescript';
|
||||
}
|
||||
if (options.javascript) {
|
||||
return 'javascript';
|
||||
}
|
||||
return askPreferredLanguage();
|
||||
}
|
||||
|
||||
// Only used in the rare, rare case of running globally installed create +
|
||||
// using --skip-install. We need a default name to show the tip text
|
||||
const defaultPackageManager = 'npm';
|
||||
|
|
@ -73,9 +56,9 @@ function findPackageManagerFromUserAgent(): PackageManager | undefined {
|
|||
}
|
||||
|
||||
async function askForPackageManagerChoice(): Promise<PackageManager> {
|
||||
const hasYarn = (await execa.command('yarn --version')).exitCode === 0;
|
||||
const hasPnpm = (await execa.command('pnpm --version')).exitCode === 0;
|
||||
const hasBun = (await execa.command('bun --version')).exitCode === 0;
|
||||
const hasYarn = shell.exec('yarn --version', {silent: true}).code === 0;
|
||||
const hasPnpm = shell.exec('pnpm --version', {silent: true}).code === 0;
|
||||
const hasBun = shell.exec('bun --version', {silent: true}).code === 0;
|
||||
|
||||
if (!hasYarn && !hasPnpm && !hasBun) {
|
||||
return 'npm';
|
||||
|
|
@ -170,14 +153,11 @@ async function readTemplates(): Promise<Template[]> {
|
|||
async function copyTemplate(
|
||||
template: Template,
|
||||
dest: string,
|
||||
language: 'javascript' | 'typescript',
|
||||
typescript: boolean,
|
||||
): Promise<void> {
|
||||
await fs.copy(path.join(templatesDir, 'shared'), dest);
|
||||
|
||||
const sourcePath =
|
||||
language === 'typescript' ? template.tsVariantPath! : template.path;
|
||||
|
||||
await fs.copy(sourcePath, dest, {
|
||||
await fs.copy(typescript ? template.tsVariantPath! : template.path, dest, {
|
||||
// Symlinks don't exist in published npm packages anymore, so this is only
|
||||
// to prevent errors during local testing
|
||||
filter: async (filePath) => !(await fs.lstat(filePath)).isSymbolicLink(),
|
||||
|
|
@ -203,33 +183,6 @@ function createTemplateChoices(templates: Template[]): Choice[] {
|
|||
];
|
||||
}
|
||||
|
||||
async function askTemplateChoice({
|
||||
templates,
|
||||
cliOptions,
|
||||
}: {
|
||||
templates: Template[];
|
||||
cliOptions: CLIOptions;
|
||||
}) {
|
||||
return cliOptions.gitStrategy
|
||||
? 'Git repository'
|
||||
: (
|
||||
(await prompts(
|
||||
{
|
||||
type: 'select',
|
||||
name: 'template',
|
||||
message: 'Select a template below...',
|
||||
choices: createTemplateChoices(templates),
|
||||
},
|
||||
{
|
||||
onCancel() {
|
||||
logger.error('A choice is required.');
|
||||
process.exit(1);
|
||||
},
|
||||
},
|
||||
)) as {template: Template | 'Git repository' | 'Local template'}
|
||||
).template;
|
||||
}
|
||||
|
||||
function isValidGitRepoUrl(gitRepoUrl: string): boolean {
|
||||
return ['https://', 'git@'].some((item) => gitRepoUrl.startsWith(item));
|
||||
}
|
||||
|
|
@ -273,10 +226,7 @@ async function getSiteName(
|
|||
return 'A website name is required.';
|
||||
}
|
||||
const dest = path.resolve(rootDir, siteName);
|
||||
if (siteName === '.' && (await fs.readdir(dest)).length > 0) {
|
||||
return logger.interpolate`Directory not empty at path=${dest}!`;
|
||||
}
|
||||
if (siteName !== '.' && (await fs.pathExists(dest))) {
|
||||
if (await fs.pathExists(dest)) {
|
||||
return logger.interpolate`Directory already exists at path=${dest}!`;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -310,7 +260,7 @@ type Source =
|
|||
| {
|
||||
type: 'template';
|
||||
template: Template;
|
||||
language: 'javascript' | 'typescript';
|
||||
typescript: boolean;
|
||||
}
|
||||
| {
|
||||
type: 'git';
|
||||
|
|
@ -322,193 +272,166 @@ type Source =
|
|||
path: string;
|
||||
};
|
||||
|
||||
async function createTemplateSource({
|
||||
template,
|
||||
cliOptions,
|
||||
}: {
|
||||
template: Template;
|
||||
cliOptions: CLIOptions;
|
||||
}): Promise<Source> {
|
||||
const language = await getLanguage(cliOptions);
|
||||
if (language === 'typescript' && !template.tsVariantPath) {
|
||||
logger.error`Template name=${template.name} doesn't provide a TypeScript variant.`;
|
||||
process.exit(1);
|
||||
}
|
||||
return {
|
||||
type: 'template',
|
||||
template,
|
||||
language,
|
||||
};
|
||||
}
|
||||
|
||||
async function getTemplateSource({
|
||||
templateName,
|
||||
templates,
|
||||
cliOptions,
|
||||
}: {
|
||||
templateName: string;
|
||||
templates: Template[];
|
||||
cliOptions: CLIOptions;
|
||||
}): Promise<Source> {
|
||||
const template = templates.find((t) => t.name === templateName);
|
||||
if (!template) {
|
||||
logger.error('Invalid template.');
|
||||
process.exit(1);
|
||||
}
|
||||
return createTemplateSource({template, cliOptions});
|
||||
}
|
||||
|
||||
// Get the template source explicitly requested by the user provided cli option
|
||||
async function getUserProvidedSource({
|
||||
reqTemplate,
|
||||
templates,
|
||||
cliOptions,
|
||||
}: {
|
||||
reqTemplate: string;
|
||||
templates: Template[];
|
||||
cliOptions: CLIOptions;
|
||||
}): Promise<Source> {
|
||||
if (isValidGitRepoUrl(reqTemplate)) {
|
||||
if (
|
||||
cliOptions.gitStrategy &&
|
||||
!gitStrategies.includes(cliOptions.gitStrategy)
|
||||
) {
|
||||
logger.error`Invalid git strategy: name=${
|
||||
cliOptions.gitStrategy
|
||||
}. Value must be one of ${gitStrategies.join(', ')}.`;
|
||||
process.exit(1);
|
||||
}
|
||||
return {
|
||||
type: 'git',
|
||||
url: reqTemplate,
|
||||
strategy: cliOptions.gitStrategy ?? 'deep',
|
||||
};
|
||||
}
|
||||
if (await fs.pathExists(path.resolve(reqTemplate))) {
|
||||
return {
|
||||
type: 'local',
|
||||
path: path.resolve(reqTemplate),
|
||||
};
|
||||
}
|
||||
return getTemplateSource({
|
||||
templateName: reqTemplate,
|
||||
templates,
|
||||
cliOptions,
|
||||
});
|
||||
}
|
||||
|
||||
async function askGitRepositorySource({
|
||||
cliOptions,
|
||||
}: {
|
||||
cliOptions: CLIOptions;
|
||||
}): Promise<Source> {
|
||||
const {gitRepoUrl} = (await prompts(
|
||||
{
|
||||
type: 'text',
|
||||
name: 'gitRepoUrl',
|
||||
validate: (url?: string) => {
|
||||
if (url && isValidGitRepoUrl(url)) {
|
||||
return true;
|
||||
}
|
||||
return logger.red('Invalid repository URL');
|
||||
},
|
||||
message: logger.interpolate`Enter a repository URL from GitHub, Bitbucket, GitLab, or any other public repo.
|
||||
(e.g: url=${'https://github.com/ownerName/repoName.git'})`,
|
||||
},
|
||||
{
|
||||
onCancel() {
|
||||
logger.error('A git repo URL is required.');
|
||||
process.exit(1);
|
||||
},
|
||||
},
|
||||
)) as {gitRepoUrl: string};
|
||||
let strategy = cliOptions.gitStrategy;
|
||||
if (!strategy) {
|
||||
({strategy} = (await prompts(
|
||||
{
|
||||
type: 'select',
|
||||
name: 'strategy',
|
||||
message: 'How should we clone this repo?',
|
||||
choices: [
|
||||
{title: 'Deep clone: preserve full history', value: 'deep'},
|
||||
{title: 'Shallow clone: clone with --depth=1', value: 'shallow'},
|
||||
{
|
||||
title: 'Copy: do a shallow clone, but do not create a git repo',
|
||||
value: 'copy',
|
||||
},
|
||||
{
|
||||
title: 'Custom: enter your custom git clone command',
|
||||
value: 'custom',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
onCancel() {
|
||||
logger.info`Falling back to name=${'deep'}`;
|
||||
},
|
||||
},
|
||||
)) as {strategy?: GitStrategy});
|
||||
}
|
||||
return {
|
||||
type: 'git',
|
||||
url: gitRepoUrl,
|
||||
strategy: strategy ?? 'deep',
|
||||
};
|
||||
}
|
||||
|
||||
async function askLocalSource(): Promise<Source> {
|
||||
const {templateDir} = (await prompts(
|
||||
{
|
||||
type: 'text',
|
||||
name: 'templateDir',
|
||||
validate: async (dir?: string) => {
|
||||
if (dir) {
|
||||
const fullDir = path.resolve(dir);
|
||||
if (await fs.pathExists(fullDir)) {
|
||||
return true;
|
||||
}
|
||||
return logger.red(
|
||||
logger.interpolate`path=${fullDir} does not exist.`,
|
||||
);
|
||||
}
|
||||
return logger.red('Please enter a valid path.');
|
||||
},
|
||||
message:
|
||||
'Enter a local folder path, relative to the current working directory.',
|
||||
},
|
||||
{
|
||||
onCancel() {
|
||||
logger.error('A file path is required.');
|
||||
process.exit(1);
|
||||
},
|
||||
},
|
||||
)) as {templateDir: string};
|
||||
return {
|
||||
type: 'local',
|
||||
path: templateDir,
|
||||
};
|
||||
}
|
||||
|
||||
async function getSource(
|
||||
reqTemplate: string | undefined,
|
||||
templates: Template[],
|
||||
cliOptions: CLIOptions,
|
||||
): Promise<Source> {
|
||||
if (reqTemplate) {
|
||||
return getUserProvidedSource({reqTemplate, templates, cliOptions});
|
||||
if (isValidGitRepoUrl(reqTemplate)) {
|
||||
if (
|
||||
cliOptions.gitStrategy &&
|
||||
!gitStrategies.includes(cliOptions.gitStrategy)
|
||||
) {
|
||||
logger.error`Invalid git strategy: name=${
|
||||
cliOptions.gitStrategy
|
||||
}. Value must be one of ${gitStrategies.join(', ')}.`;
|
||||
process.exit(1);
|
||||
}
|
||||
return {
|
||||
type: 'git',
|
||||
url: reqTemplate,
|
||||
strategy: cliOptions.gitStrategy ?? 'deep',
|
||||
};
|
||||
} else if (await fs.pathExists(path.resolve(reqTemplate))) {
|
||||
return {
|
||||
type: 'local',
|
||||
path: path.resolve(reqTemplate),
|
||||
};
|
||||
}
|
||||
const template = templates.find((t) => t.name === reqTemplate);
|
||||
if (!template) {
|
||||
logger.error('Invalid template.');
|
||||
process.exit(1);
|
||||
}
|
||||
if (cliOptions.typescript && !template.tsVariantPath) {
|
||||
logger.error`Template name=${reqTemplate} doesn't provide the TypeScript variant.`;
|
||||
process.exit(1);
|
||||
}
|
||||
return {
|
||||
type: 'template',
|
||||
template,
|
||||
typescript: cliOptions.typescript ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
const template = await askTemplateChoice({templates, cliOptions});
|
||||
const template = cliOptions.gitStrategy
|
||||
? 'Git repository'
|
||||
: (
|
||||
(await prompts(
|
||||
{
|
||||
type: 'select',
|
||||
name: 'template',
|
||||
message: 'Select a template below...',
|
||||
choices: createTemplateChoices(templates),
|
||||
},
|
||||
{
|
||||
onCancel() {
|
||||
logger.error('A choice is required.');
|
||||
process.exit(1);
|
||||
},
|
||||
},
|
||||
)) as {template: Template | 'Git repository' | 'Local template'}
|
||||
).template;
|
||||
if (template === 'Git repository') {
|
||||
return askGitRepositorySource({cliOptions});
|
||||
const {gitRepoUrl} = (await prompts(
|
||||
{
|
||||
type: 'text',
|
||||
name: 'gitRepoUrl',
|
||||
validate: (url?: string) => {
|
||||
if (url && isValidGitRepoUrl(url)) {
|
||||
return true;
|
||||
}
|
||||
return logger.red('Invalid repository URL');
|
||||
},
|
||||
message: logger.interpolate`Enter a repository URL from GitHub, Bitbucket, GitLab, or any other public repo.
|
||||
(e.g: url=${'https://github.com/ownerName/repoName.git'})`,
|
||||
},
|
||||
{
|
||||
onCancel() {
|
||||
logger.error('A git repo URL is required.');
|
||||
process.exit(1);
|
||||
},
|
||||
},
|
||||
)) as {gitRepoUrl: string};
|
||||
let strategy = cliOptions.gitStrategy;
|
||||
if (!strategy) {
|
||||
({strategy} = (await prompts(
|
||||
{
|
||||
type: 'select',
|
||||
name: 'strategy',
|
||||
message: 'How should we clone this repo?',
|
||||
choices: [
|
||||
{title: 'Deep clone: preserve full history', value: 'deep'},
|
||||
{title: 'Shallow clone: clone with --depth=1', value: 'shallow'},
|
||||
{
|
||||
title: 'Copy: do a shallow clone, but do not create a git repo',
|
||||
value: 'copy',
|
||||
},
|
||||
{
|
||||
title: 'Custom: enter your custom git clone command',
|
||||
value: 'custom',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
onCancel() {
|
||||
logger.info`Falling back to name=${'deep'}`;
|
||||
},
|
||||
},
|
||||
)) as {strategy?: GitStrategy});
|
||||
}
|
||||
return {
|
||||
type: 'git',
|
||||
url: gitRepoUrl,
|
||||
strategy: strategy ?? 'deep',
|
||||
};
|
||||
} else if (template === 'Local template') {
|
||||
const {templateDir} = (await prompts(
|
||||
{
|
||||
type: 'text',
|
||||
name: 'templateDir',
|
||||
validate: async (dir?: string) => {
|
||||
if (dir) {
|
||||
const fullDir = path.resolve(dir);
|
||||
if (await fs.pathExists(fullDir)) {
|
||||
return true;
|
||||
}
|
||||
return logger.red(
|
||||
logger.interpolate`path=${fullDir} does not exist.`,
|
||||
);
|
||||
}
|
||||
return logger.red('Please enter a valid path.');
|
||||
},
|
||||
message:
|
||||
'Enter a local folder path, relative to the current working directory.',
|
||||
},
|
||||
{
|
||||
onCancel() {
|
||||
logger.error('A file path is required.');
|
||||
process.exit(1);
|
||||
},
|
||||
},
|
||||
)) as {templateDir: string};
|
||||
return {
|
||||
type: 'local',
|
||||
path: templateDir,
|
||||
};
|
||||
}
|
||||
if (template === 'Local template') {
|
||||
return askLocalSource();
|
||||
let useTS = cliOptions.typescript;
|
||||
if (!useTS && template.tsVariantPath) {
|
||||
({useTS} = (await prompts({
|
||||
type: 'confirm',
|
||||
name: 'useTS',
|
||||
message:
|
||||
'This template is available in TypeScript. Do you want to use the TS variant?',
|
||||
initial: false,
|
||||
})) as {useTS?: boolean});
|
||||
}
|
||||
return createTemplateSource({
|
||||
return {
|
||||
type: 'template',
|
||||
template,
|
||||
cliOptions,
|
||||
});
|
||||
typescript: useTS ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
async function updatePkg(pkgPath: string, obj: {[key: string]: unknown}) {
|
||||
|
|
@ -529,14 +452,16 @@ export default async function init(
|
|||
getSiteName(reqName, rootDir),
|
||||
]);
|
||||
const dest = path.resolve(rootDir, siteName);
|
||||
|
||||
const source = await getSource(reqTemplate, templates, cliOptions);
|
||||
|
||||
logger.info('Creating new Docusaurus project...');
|
||||
|
||||
if (source.type === 'git') {
|
||||
const gitCommand = await getGitCommand(source.strategy);
|
||||
if ((await execa(gitCommand, [source.url, dest])).exitCode !== 0) {
|
||||
const gitCloneCommand = `${gitCommand} ${escapeShellArg(
|
||||
source.url,
|
||||
)} ${escapeShellArg(dest)}`;
|
||||
if (shell.exec(gitCloneCommand).code !== 0) {
|
||||
logger.error`Cloning Git template failed!`;
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
@ -545,7 +470,7 @@ export default async function init(
|
|||
}
|
||||
} else if (source.type === 'template') {
|
||||
try {
|
||||
await copyTemplate(source.template, dest, source.language);
|
||||
await copyTemplate(source.template, dest, source.typescript);
|
||||
} catch (err) {
|
||||
logger.error`Copying Docusaurus template name=${source.template.name} failed!`;
|
||||
throw err;
|
||||
|
|
@ -586,27 +511,24 @@ export default async function init(
|
|||
const cdpath = path.relative('.', dest);
|
||||
const pkgManager = await getPackageManager(dest, cliOptions);
|
||||
if (!cliOptions.skipInstall) {
|
||||
process.chdir(dest);
|
||||
shell.cd(dest);
|
||||
logger.info`Installing dependencies with name=${pkgManager}...`;
|
||||
// ...
|
||||
|
||||
if (
|
||||
(
|
||||
await execa.command(
|
||||
pkgManager === 'yarn'
|
||||
? 'yarn'
|
||||
: pkgManager === 'bun'
|
||||
? 'bun install'
|
||||
: `${pkgManager} install --color always`,
|
||||
{
|
||||
env: {
|
||||
...process.env,
|
||||
// Force coloring the output
|
||||
...(supportsColor.stdout ? {FORCE_COLOR: '1'} : {}),
|
||||
},
|
||||
shell.exec(
|
||||
pkgManager === 'yarn'
|
||||
? 'yarn'
|
||||
: pkgManager === 'bun'
|
||||
? 'bun install'
|
||||
: `${pkgManager} install --color always`,
|
||||
{
|
||||
env: {
|
||||
...process.env,
|
||||
// Force coloring the output, since the command is invoked by
|
||||
// shelljs, which is not an interactive shell
|
||||
...(supportsColor.stdout ? {FORCE_COLOR: '1'} : {}),
|
||||
},
|
||||
)
|
||||
).exitCode !== 0
|
||||
},
|
||||
).code !== 0
|
||||
) {
|
||||
logger.error('Dependency installation failed.');
|
||||
logger.info`The site directory has already been created, and you can retry by typing:
|
||||
|
|
|
|||
|
|
@ -2,18 +2,11 @@ import {themes as prismThemes} from 'prism-react-renderer';
|
|||
import type {Config} from '@docusaurus/types';
|
||||
import type * as Preset from '@docusaurus/preset-classic';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
const config: Config = {
|
||||
title: 'My Site',
|
||||
tagline: 'Dinosaurs are cool',
|
||||
favicon: 'img/favicon.ico',
|
||||
|
||||
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
|
||||
future: {
|
||||
v4: true, // Improve compatibility with the upcoming Docusaurus v4
|
||||
},
|
||||
|
||||
// Set the production url of your site here
|
||||
url: 'https://your-docusaurus-site.example.com',
|
||||
// Set the /<baseUrl>/ pathname under which your site is served
|
||||
|
|
@ -26,6 +19,7 @@ const config: Config = {
|
|||
projectName: 'docusaurus', // Usually your repo name.
|
||||
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
|
||||
// Even if you don't use internationalization, you can use this field to set
|
||||
// useful metadata like html lang. For example, if your site is Chinese, you
|
||||
|
|
@ -48,18 +42,10 @@ const config: Config = {
|
|||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
feedOptions: {
|
||||
type: ['rss', 'atom'],
|
||||
xslt: true,
|
||||
},
|
||||
// Please change this to your repo.
|
||||
// Remove this to remove the "edit this page" links.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||
// Useful options to enforce blogging best practices
|
||||
onInlineTags: 'warn',
|
||||
onInlineAuthors: 'warn',
|
||||
onUntruncatedBlogPosts: 'warn',
|
||||
},
|
||||
theme: {
|
||||
customCss: './src/css/custom.css',
|
||||
|
|
@ -71,9 +57,6 @@ const config: Config = {
|
|||
themeConfig: {
|
||||
// Replace with your project's social card
|
||||
image: 'img/docusaurus-social-card.jpg',
|
||||
colorMode: {
|
||||
respectPrefersColorScheme: true,
|
||||
},
|
||||
navbar: {
|
||||
title: 'My Site',
|
||||
logo: {
|
||||
|
|
@ -119,8 +102,8 @@ const config: Config = {
|
|||
href: 'https://discordapp.com/invite/docusaurus',
|
||||
},
|
||||
{
|
||||
label: 'X',
|
||||
href: 'https://x.com/docusaurus',
|
||||
label: 'Twitter',
|
||||
href: 'https://twitter.com/docusaurus',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus-2-classic-typescript-template",
|
||||
"version": "3.9.2",
|
||||
"version": "3.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
|
@ -15,19 +15,19 @@
|
|||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.9.2",
|
||||
"@docusaurus/preset-classic": "3.9.2",
|
||||
"@docusaurus/core": "3.1.0",
|
||||
"@docusaurus/preset-classic": "3.1.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.9.2",
|
||||
"@docusaurus/tsconfig": "3.9.2",
|
||||
"@docusaurus/types": "3.9.2",
|
||||
"typescript": "~5.6.2"
|
||||
"@docusaurus/module-type-aliases": "3.1.0",
|
||||
"@docusaurus/tsconfig": "3.1.0",
|
||||
"@docusaurus/types": "3.1.0",
|
||||
"typescript": "~5.2.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
@ -42,6 +42,6 @@
|
|||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0"
|
||||
"node": ">=18.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import type {ReactNode} from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Heading from '@theme/Heading';
|
||||
import styles from './styles.module.css';
|
||||
|
|
@ -6,7 +5,7 @@ import styles from './styles.module.css';
|
|||
type FeatureItem = {
|
||||
title: string;
|
||||
Svg: React.ComponentType<React.ComponentProps<'svg'>>;
|
||||
description: ReactNode;
|
||||
description: JSX.Element;
|
||||
};
|
||||
|
||||
const FeatureList: FeatureItem[] = [
|
||||
|
|
@ -56,7 +55,7 @@ function Feature({title, Svg, description}: FeatureItem) {
|
|||
);
|
||||
}
|
||||
|
||||
export default function HomepageFeatures(): ReactNode {
|
||||
export default function HomepageFeatures(): JSX.Element {
|
||||
return (
|
||||
<section className={styles.features}>
|
||||
<div className="container">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import type {ReactNode} from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
|
|
@ -29,7 +28,7 @@ function HomepageHeader() {
|
|||
);
|
||||
}
|
||||
|
||||
export default function Home(): ReactNode {
|
||||
export default function Home(): JSX.Element {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<Layout
|
||||
|
|
|
|||
|
|
@ -3,6 +3,5 @@
|
|||
"extends": "@docusaurus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [".docusaurus", "build"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,19 +6,12 @@
|
|||
|
||||
import {themes as prismThemes} from 'prism-react-renderer';
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: 'My Site',
|
||||
tagline: 'Dinosaurs are cool',
|
||||
favicon: 'img/favicon.ico',
|
||||
|
||||
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
|
||||
future: {
|
||||
v4: true, // Improve compatibility with the upcoming Docusaurus v4
|
||||
},
|
||||
|
||||
// Set the production url of your site here
|
||||
url: 'https://your-docusaurus-site.example.com',
|
||||
// Set the /<baseUrl>/ pathname under which your site is served
|
||||
|
|
@ -31,6 +24,7 @@ const config = {
|
|||
projectName: 'docusaurus', // Usually your repo name.
|
||||
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
|
||||
// Even if you don't use internationalization, you can use this field to set
|
||||
// useful metadata like html lang. For example, if your site is Chinese, you
|
||||
|
|
@ -54,18 +48,10 @@ const config = {
|
|||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
feedOptions: {
|
||||
type: ['rss', 'atom'],
|
||||
xslt: true,
|
||||
},
|
||||
// Please change this to your repo.
|
||||
// Remove this to remove the "edit this page" links.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
||||
// Useful options to enforce blogging best practices
|
||||
onInlineTags: 'warn',
|
||||
onInlineAuthors: 'warn',
|
||||
onUntruncatedBlogPosts: 'warn',
|
||||
},
|
||||
theme: {
|
||||
customCss: './src/css/custom.css',
|
||||
|
|
@ -79,9 +65,6 @@ const config = {
|
|||
({
|
||||
// Replace with your project's social card
|
||||
image: 'img/docusaurus-social-card.jpg',
|
||||
colorMode: {
|
||||
respectPrefersColorScheme: true,
|
||||
},
|
||||
navbar: {
|
||||
title: 'My Site',
|
||||
logo: {
|
||||
|
|
@ -127,8 +110,8 @@ const config = {
|
|||
href: 'https://discordapp.com/invite/docusaurus',
|
||||
},
|
||||
{
|
||||
label: 'X',
|
||||
href: 'https://x.com/docusaurus',
|
||||
label: 'Twitter',
|
||||
href: 'https://twitter.com/docusaurus',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus-2-classic-template",
|
||||
"version": "3.9.2",
|
||||
"version": "3.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
|
@ -14,17 +14,17 @@
|
|||
"write-heading-ids": "docusaurus write-heading-ids"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.9.2",
|
||||
"@docusaurus/preset-classic": "3.9.2",
|
||||
"@docusaurus/core": "3.1.0",
|
||||
"@docusaurus/preset-classic": "3.1.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.9.2",
|
||||
"@docusaurus/types": "3.9.2"
|
||||
"@docusaurus/module-type-aliases": "3.1.0",
|
||||
"@docusaurus/types": "3.1.0"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
@ -39,6 +39,6 @@
|
|||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0"
|
||||
"node": ">=18.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
// @ts-check
|
||||
|
||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
||||
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
|
|
@ -11,9 +7,11 @@
|
|||
The sidebars can be generated from the filesystem, or explicitly defined here.
|
||||
|
||||
Create as many sidebars as you want.
|
||||
|
||||
@type {import('@docusaurus/plugin-content-docs').SidebarsConfig}
|
||||
*/
|
||||
|
||||
// @ts-check
|
||||
|
||||
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
||||
const sidebars = {
|
||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
|
||||
|
|
|
|||
|
|
@ -2,40 +2,40 @@
|
|||
|
||||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
|
||||
|
||||
## Installation
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
$ yarn
|
||||
```
|
||||
|
||||
## Local Development
|
||||
### Local Development
|
||||
|
||||
```bash
|
||||
yarn start
|
||||
```
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
|
||||
|
||||
## Build
|
||||
### Build
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
```
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||
|
||||
## Deployment
|
||||
### Deployment
|
||||
|
||||
Using SSH:
|
||||
|
||||
```bash
|
||||
USE_SSH=true yarn deploy
|
||||
```
|
||||
$ USE_SSH=true yarn deploy
|
||||
```
|
||||
|
||||
Not using SSH:
|
||||
|
||||
```bash
|
||||
GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
|
||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
slug: first-blog-post
|
||||
title: First Blog Post
|
||||
authors: [slorber, yangshun]
|
||||
authors:
|
||||
name: Gao Wei
|
||||
title: Docusaurus Core Team
|
||||
url: https://github.com/wgao19
|
||||
image_url: https://github.com/wgao19.png
|
||||
tags: [hola, docusaurus]
|
||||
---
|
||||
|
||||
Lorem ipsum dolor sit amet...
|
||||
|
||||
<!-- truncate -->
|
||||
|
||||
...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
slug: long-blog-post
|
||||
title: Long Blog Post
|
||||
authors: yangshun
|
||||
authors: endi
|
||||
tags: [hello, docusaurus]
|
||||
---
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ This is the summary of a very long blog post,
|
|||
|
||||
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
|
||||
|
||||
<!-- truncate -->
|
||||
<!--truncate-->
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
|
||||
|
||||
|
|
|
|||
|
|
@ -11,14 +11,10 @@ Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/mar
|
|||
|
||||
Use the power of React to create interactive blog posts.
|
||||
|
||||
:::
|
||||
|
||||
{/* truncate */}
|
||||
|
||||
For example, use JSX to create an interactive button:
|
||||
|
||||
```js
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
```
|
||||
|
||||
<button onClick={() => alert('button clicked!')}>Click me!</button>
|
||||
|
||||
:::
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue