Skip to content

Commit

Permalink
Merge branch 'main' into Xebec19/main
Browse files Browse the repository at this point in the history
  • Loading branch information
OzakIOne committed Jul 26, 2024
2 parents 5454916 + 026a317 commit 64538d5
Show file tree
Hide file tree
Showing 2,148 changed files with 232,967 additions and 195,572 deletions.
4 changes: 3 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"website/src/data/users.tsx",
"website/src/data/tweets.tsx",
"website/docusaurus.config.localized.json",
"website/_dogfooding/_pages tests/diagrams.mdx",
"*.xyz",
"*.docx",
"*.xslt",
Expand All @@ -37,5 +38,6 @@
"*.min.*",
"jest/vendor"
],
"ignoreRegExpList": ["Email", "Urls", "#[\\w-]*"]
"ignoreRegExpList": ["Email", "Urls", "#[\\w-]*"],
"enableFiletypes": ["mdx"]
}
67 changes: 48 additions & 19 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ const OFF = 0;
const WARNING = 1;
const ERROR = 2;

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/**',
// 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/**',
];

module.exports = {
Expand All @@ -32,7 +34,7 @@ module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
// tsconfigRootDir: __dirname,
// project: ['./tsconfig.json', './website/tsconfig.json'],
// project: ['./tsconfig.base.json', './website/tsconfig.base.json'],
},
globals: {
JSX: true,
Expand Down Expand Up @@ -85,13 +87,14 @@ 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': [WARNING, {allowElseIf: true}],
'no-else-return': OFF,
'no-empty': [WARNING, {allowEmptyCatch: true}],
'no-lonely-if': WARNING,
'no-nested-ternary': WARNING,
Expand Down Expand Up @@ -203,7 +206,10 @@ module.exports = {
})),
],
'no-template-curly-in-string': WARNING,
'no-unused-expressions': [WARNING, {allowTaggedTemplates: true}],
'no-unused-expressions': [
WARNING,
{allowTaggedTemplates: true, allowShortCircuit: true},
],
'no-useless-escape': WARNING,
'no-void': [ERROR, {allowAsStatement: true}],
'prefer-destructuring': WARNING,
Expand Down Expand Up @@ -344,10 +350,7 @@ module.exports = {
ERROR,
{'ts-expect-error': 'allow-with-description'},
],
'@typescript-eslint/consistent-indexed-object-style': [
WARNING,
'index-signature',
],
'@typescript-eslint/consistent-indexed-object-style': OFF,
'@typescript-eslint/consistent-type-imports': [
WARNING,
{disallowTypeAnnotations: false},
Expand Down Expand Up @@ -407,7 +410,33 @@ module.exports = {
'no-restricted-imports': [
'error',
{
patterns: ClientRestrictedImportPatterns,
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,
],
},
],
},
Expand All @@ -419,7 +448,7 @@ module.exports = {
'no-restricted-imports': [
'error',
{
patterns: ClientRestrictedImportPatterns.concat(
patterns: LodashImportPatterns.concat(
// Prevents relative imports between React theme components
[
'../**',
Expand Down
18 changes: 5 additions & 13 deletions .github/workflows/argos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,16 @@ 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.ref_name == 'main' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Argos')) }}
if: ${{ (github.event_name != 'pull_request' && 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@v3
with:
# A minimal fetch-depth of 2 is required
# to automatically detect branch in @argos-ci/cli
fetch-depth: 2
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 16
node-version: 20

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand All @@ -45,11 +41,7 @@ jobs:
run: npx playwright install --with-deps chromium

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

- name: Take Argos screenshots
run: yarn argos:screenshot

- name: Upload Argos screenshots
continue-on-error: true
run: yarn argos:upload
6 changes: 3 additions & 3 deletions .github/workflows/build-blog-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '16'
node-version: 20
cache: yarn
- name: Installation
run: yarn
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/build-hash-router.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '18'
cache: yarn
- name: Installation
run: yarn

- name: Build Hash Router
run: yarn build:website:fast
env:
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@v4
with:
name: website-hash-router-archive
path: website/build

#- name: Upload Website Pages artifact
# uses: actions/upload-pages-artifact@v3
# 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@v4
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@v4
24 changes: 14 additions & 10 deletions .github/workflows/build-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '16'
node-version: 20
cache: yarn
- name: Track build size changes
uses: preactjs/compressed-size-action@8119d3d31b6e57b167e09c81dfa877eada3bcb35 # v2
uses: preactjs/compressed-size-action@f780fd104362cfce9e118f9198df2ee37d12946c # v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
build-script: build:website:en
build-script: build:website:fast
clean-script: clear:website # see https://github.com/facebook/docusaurus/pull/6838
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}'
pattern: '{website/build/assets/js/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}'
strip-hash: '\.([^;]\w{7})\.'
minimum-change-threshold: 30
compression: none
Expand All @@ -57,20 +59,22 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
cache: yarn
- name: Installation
run: yarn

# Ensure build with a cold cache does not increase too much
- name: Build (cold cache)
run: yarn workspace website build --locale en
run: yarn build:website:fast
timeout-minutes: 8

# Ensure build with a warm cache does not increase too much
- name: Build (warm cache)
run: yarn workspace website build --locale en
run: yarn build:website:fast
timeout-minutes: 2
# TODO post a GitHub comment with build with perf warnings?
6 changes: 3 additions & 3 deletions .github/workflows/canary-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
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@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '16'
node-version: 20
cache: yarn
- name: Prepare git
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Initialize CodeQL
uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a # 2.13.4
uses: github/codeql-action/init@2d790406f505036ef40ecba973cc774a50395aac # 3.25.13
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a # 2.13.4
uses: github/codeql-action/analyze@2d790406f505036ef40ecba973cc774a50395aac # 3.25.13
4 changes: 2 additions & 2 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Dependency Review
uses: actions/dependency-review-action@f6fff72a3217f580d5afd49a46826795305b63c7 # 3.0.8
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # 4.3.4
Loading

0 comments on commit 64538d5

Please sign in to comment.