Skip to content

Commit

Permalink
Merge branch 'main' into massoudmaboudi/iammassoud-add-showcase
Browse files Browse the repository at this point in the history
  • Loading branch information
massoudmaboudi committed May 20, 2022
1 parent 90de14d commit 9aa3f3b
Show file tree
Hide file tree
Showing 464 changed files with 2,288 additions and 2,198 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ examples/
packages/lqip-loader/lib/
packages/docusaurus/lib/
packages/docusaurus-*/lib/*
packages/docusaurus-*/lib-next/
packages/eslint-plugin/lib/
packages/stylelint-copyright/lib/
copyUntypedFiles.mjs

packages/create-docusaurus/lib/*
packages/create-docusaurus/templates/facebook
Expand Down
30 changes: 29 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,35 @@ module.exports = {
],
},
],
'import/order': OFF,
'import/order': [
WARNING,
{
groups: [
'builtin',
'external',
'internal',
['parent', 'sibling', 'index'],
'type',
],
pathGroups: [
{pattern: '@jest/globals', group: 'builtin', position: 'before'},
{pattern: 'react', group: 'builtin', position: 'before'},
{pattern: 'fs-extra', group: 'builtin'},
{pattern: 'lodash', group: 'external', position: 'before'},
{pattern: 'clsx', group: 'external', position: 'before'},
// 'Bit weird to not use the `import/internal-regex` option, but this
// way, we can make `import type { Props } from "@theme/*"` appear
// before `import styles from "styles.module.css"`, which is what we
// always did. This should be removable once we stop using ambient
// module declarations for theme aliases.
{pattern: '@theme/**', group: 'internal'},
{pattern: '@site/**', group: 'internal'},
{pattern: '@theme-init/**', group: 'internal'},
{pattern: '@theme-original/**', group: 'internal'},
],
pathGroupsExcludedImportTypes: [],
},
],
'import/prefer-default-export': OFF,

'jest/consistent-test-it': WARNING,
Expand Down
12 changes: 7 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
# Make GitHub not index certain files in the languages overview
# See https://github.com/github/linguist/blob/master/docs/overrides.md
# generated files' diff will be minimized
**/__fixtures__/** linguist-generated
.husky/** linguist-vendored
jest/** linguist-vendored
admin/** linguist-documentation
website/** linguist-documentation
**/__fixtures__/** linguist-generated
examples/** linguist-generated
.husky/** linguist-vendored
jest/** linguist-vendored
admin/** linguist-documentation
website/** linguist-documentation
packages/create-docusaurus/templates/** linguist-vendored
2 changes: 1 addition & 1 deletion .github/workflows/build-blog-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Set up Node
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: '16'
cache: yarn
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Set up Node
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: '16'
cache: yarn
Expand All @@ -55,7 +55,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
- uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
cache: yarn
- name: Installation
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/canary-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
fetch-depth: 0 # Needed to get the commit number with "git rev-list --count HEAD"
- name: Set up Node
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: '16'
cache: yarn
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3

- name: Initialize CodeQL
uses: github/codeql-action/init@75b4f1c4669133dc294b06c2794e969efa2e5316 # v2
uses: github/codeql-action/init@2f58583a1b24a7d3c7034f6bf9fa506d23b1183b # v2
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@75b4f1c4669133dc294b06c2794e969efa2e5316 # v2
uses: github/codeql-action/analyze@2f58583a1b24a7d3c7034f6bf9fa506d23b1183b # v2
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b #v3
- name: Dependency Review
uses: actions/dependency-review-action@3f943b86c9a289f4e632c632695e2e0898d9d67d # v1
uses: actions/dependency-review-action@39e692fa323107ef86d8fdac0067ce647f239bd7 # v1
4 changes: 2 additions & 2 deletions .github/workflows/lighthouse-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ jobs:
PR_NUMBER: ${{ github.event.pull_request.number}}
- name: Format lighthouse score
id: format_lighthouse_score
uses: actions/github-script@9ac08808f993958e9de277fe43a64532a609130e # v6
uses: actions/github-script@7a5c598405937d486b0331594b5da2b14db670da # v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const results = ${{ steps.lighthouse_audit.outputs.manifest }}
const links = ${{ steps.lighthouse_audit.outputs.links }}
const createLighthouseReport = (await import(`${process.env.GITHUB_WORKSPACE}/admin/scripts/format-lighthouse-score.mjs`)).default;
const createLighthouseReport = (await import(`${process.env.GITHUB_WORKSPACE}/admin/scripts/formatLighthouseReport.js`)).default;
const comment = createLighthouseReport({ results, links });
core.setOutput("comment", comment);
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Set up Node
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: '16'
cache: yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/showcase-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Set up Node
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: '16'
cache: yarn
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: ${{ matrix.node }}
cache: yarn
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Use Node.js 16
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: '16'
cache: yarn
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Use Node.js 16
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: '16'
cache: yarn
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Use Node.js 16
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: '16'
cache: yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-swizzle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Set up Node
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: '16'
cache: yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: ${{ matrix.node }}
- name: Installation
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3
with:
node-version: ${{ matrix.node }}
cache: yarn
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ packages/docusaurus/lib/
packages/docusaurus-*/lib/*
packages/eslint-plugin/lib/
packages/stylelint-copyright/lib/
packages/docusaurus-*/lib-next/

website/netlifyDeployPreview/*
website/changelog
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ coverage
packages/lqip-loader/lib/
packages/docusaurus/lib/
packages/docusaurus-*/lib/*
packages/docusaurus-*/lib-next/
packages/create-docusaurus/lib/*
packages/create-docusaurus/templates/*/docusaurus.config.js
packages/eslint-plugin/lib/
Expand Down
1 change: 0 additions & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ examples/
packages/lqip-loader/lib/
packages/docusaurus/lib/
packages/docusaurus-*/lib/*
packages/docusaurus-*/lib-next/
packages/create-docusaurus/lib/*
packages/create-docusaurus/templates/
website/static/katex/katex.min.css
6 changes: 4 additions & 2 deletions __tests__/validate-package-json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import {Globby} from '@docusaurus/utils';
import fs from 'fs-extra';
import {Globby} from '@docusaurus/utils';

type PackageJsonFile = {
file: string;
Expand Down Expand Up @@ -62,7 +62,9 @@ describe('packages', () => {
const packageJsonFiles = await getPackagesJsonFiles();

packageJsonFiles
.filter((packageJsonFile) => packageJsonFile.content.name.startsWith('@'))
.filter((packageJsonFile) =>
packageJsonFile.content.name?.startsWith('@'),
)
.forEach((packageJsonFile) => {
if (packageJsonFile) {
// Unfortunately jest custom message do not exist in loops,
Expand Down
66 changes: 66 additions & 0 deletions __tests__/validate-tsconfig.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* 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 {Globby} from '@docusaurus/utils';
import {Joi} from '@docusaurus/utils-validation';

type TsconfigFile = {
file: string;
content: {
extends?: string;
compilerOptions: {
[key: string]: unknown;
};
};
};

async function getTsconfigFiles(): Promise<TsconfigFile[]> {
const files = await Globby('packages/*/tsconfig.*');
return Promise.all(
files.map((file) => fs.readJSON(file).then((content) => ({file, content}))),
);
}

const tsconfigSchema = Joi.object({
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(),
module: Joi.valid('commonjs', 'es2020', 'esnext').required(),
}).unknown(),
otherwise: Joi.object({
noEmit: Joi.valid(false).required(),
incremental: Joi.valid(true).required(),
rootDir: Joi.valid('src').required(),
outDir: Joi.valid('lib').required(),
module: Joi.valid('commonjs', 'es2020', 'esnext').required(),
}).unknown(),
},
),
}).unknown();

describe('tsconfig files', () => {
it('contain all required fields', async () => {
const tsconfigFiles = await getTsconfigFiles();
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;
}
});
});
});
3 changes: 1 addition & 2 deletions admin/new.docusaurus.io/functions/codesandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import type {Handler} from '@netlify/functions';

import {createPlaygroundResponse} from '../functionUtils/playgroundUtils';
import type {Handler} from '@netlify/functions';

export const handler: Handler = async function handler() {
return createPlaygroundResponse('codesandbox');
Expand Down
3 changes: 1 addition & 2 deletions admin/new.docusaurus.io/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/

import type {Handler} from '@netlify/functions';

import {
readPlaygroundName,
createPlaygroundResponse,
createPlaygroundDocumentationResponse,
} from '../functionUtils/playgroundUtils';
import type {Handler} from '@netlify/functions';

export const handler: Handler = async (event) => {
const playgroundName = readPlaygroundName(event);
Expand Down
3 changes: 1 addition & 2 deletions admin/new.docusaurus.io/functions/stackblitz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import type {Handler} from '@netlify/functions';

import {createPlaygroundResponse} from '../functionUtils/playgroundUtils';
import type {Handler} from '@netlify/functions';

export const handler: Handler = async function handler() {
return createPlaygroundResponse('stackblitz');
Expand Down
Loading

0 comments on commit 9aa3f3b

Please sign in to comment.