Skip to content

Commit

Permalink
Merge branch 'main' into update-home-icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Apr 20, 2022
2 parents d354b32 + 20f333b commit 77382bc
Show file tree
Hide file tree
Showing 161 changed files with 1,009 additions and 1,057 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-blog-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- name: Set up Node
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: '16'
cache: yarn
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/build-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- name: Set up Node
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: '16'
cache: yarn
- uses: preactjs/compressed-size-action@8119d3d31b6e57b167e09c81dfa877eada3bcb35 # v2
- name: Track build size changes
uses: preactjs/compressed-size-action@8119d3d31b6e57b167e09c81dfa877eada3bcb35 # v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
build-script: build:website:en
Expand All @@ -45,8 +48,8 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
- uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
cache: yarn
- name: Installation
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/canary-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ jobs:
name: Publish Canary
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
with:
fetch-depth: 0 # Needed to get the commit number with "git rev-list --count HEAD"
- name: Set up Node
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: '16'
cache: yarn
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
- javascript

steps:
- name: Checkout repository
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3

- name: Initialize CodeQL
uses: github/codeql-action/init@883476649888a9e8e219d5b2e6b789dc024f690c # v1
uses: github/codeql-action/init@1ed1437484560351c5be56cf73a48a279d116b78 # v1
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@883476649888a9e8e219d5b2e6b789dc024f690c # v1
uses: github/codeql-action/analyze@1ed1437484560351c5be56cf73a48a279d116b78 # v1
7 changes: 4 additions & 3 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Dependency Review'
name: Dependency Review
on: [pull_request]

permissions:
Expand All @@ -8,6 +8,7 @@ jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 #v3
- name: 'Dependency Review'
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 #v3
- name: Dependency Review
uses: actions/dependency-review-action@3f943b86c9a289f4e632c632695e2e0898d9d67d # v1
5 changes: 3 additions & 2 deletions .github/workflows/lighthouse-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ jobs:
name: Lighthouse Report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- name: Wait for the Netlify Preview
uses: jakepartusch/wait-for-netlify-action@7dcdeb40c6bc3710a8099702a1fa1ce2c5e322a6 # v1
uses: jakepartusch/wait-for-netlify-action@7ccf91c9ba3d64aa4389c0d3adcba0a6e77e5421 # v1
id: netlify
with:
site_name: docusaurus-2
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- name: Set up Node
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: '16'
cache: yarn
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/showcase-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- name: Set up Node
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: '16'
cache: yarn
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ jobs:
matrix:
node: ['14', '16', '17']
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: ${{ matrix.node }}
cache: yarn
Expand Down Expand Up @@ -62,9 +63,10 @@ jobs:
- variant: -st
nodeLinker: pnp
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- name: Use Node.js 16
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: '16'
cache: yarn
Expand Down Expand Up @@ -107,9 +109,10 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 #v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 #v3
- name: Use Node.js 16
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: '16'
cache: yarn
Expand All @@ -136,9 +139,10 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 #v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 #v3
- name: Use Node.js 16
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: '16'
cache: yarn
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/tests-swizzle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ jobs:
action: ['eject', 'wrap']
variant: ['js', 'ts']
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- name: Use Node.js
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- name: Set up Node
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: 14
node-version: '16'
cache: yarn
- name: Installation
run: yarn
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ jobs:
steps:
- name: Support longpaths
run: git config --system core.longpaths true
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: ${{ matrix.node }}
- name: Installation
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ jobs:
matrix:
node: ['14', '16', '17']
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3
with:
node-version: ${{ matrix.node }}
cache: yarn
Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,13 @@ Short on time? Check out our [5-minute tutorial ⏱️](https://tutorial.docusau
## Installation

Use the initialization cli to create your site:
Use the initialization CLI to create your site:

```bash
npm init docusaurus@latest [name] [template]
npm init docusaurus@latest
```

Example:

```bash
npm init docusaurus@latest my-website classic
```
[Read the docs](https://docusaurus.io/docs/installation) for any further information.

## Contributing

Expand Down
6 changes: 1 addition & 5 deletions __tests__/validate-package-json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ type PackageJsonFile = {

async function getPackagesJsonFiles(): Promise<PackageJsonFile[]> {
const files = await Globby('packages/*/package.json');

return Promise.all(
files.map(async (file) => ({
file,
content: JSON.parse(await fs.readFile(file, 'utf8')),
})),
files.map((file) => fs.readJSON(file).then((content) => ({file, content}))),
);
}

Expand Down
9 changes: 6 additions & 3 deletions admin/new.docusaurus.io/functionUtils/playgroundUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ const PlaygroundConfigs = {
codesandbox:
'https://codesandbox.io/s/github/facebook/docusaurus/tree/main/examples/classic',

// stackblitz: 'https://stackblitz.com/fork/docusaurus', // not updated
// stackblitz: 'https://stackblitz.com/github/facebook/docusaurus/tree/main/examples/classic', // slow to load
stackblitz: 'https://stackblitz.com/github/facebook/docusaurus/tree/starter', // dedicated branch: faster load
// Not updated
// stackblitz: 'https://stackblitz.com/fork/docusaurus',
// Slow to load
// stackblitz: 'https://stackblitz.com/github/facebook/docusaurus/tree/main/examples/classic',
// Dedicated branch: faster load
stackblitz: 'https://stackblitz.com/github/facebook/docusaurus/tree/starter',
};

const PlaygroundDocumentationUrl = 'https://docusaurus.io/docs/playground';
Expand Down
2 changes: 1 addition & 1 deletion admin/new.docusaurus.io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"@netlify/functions": "^1.0.0"
},
"devDependencies": {
"netlify-cli": "^9.16.4"
"netlify-cli": "^9.16.6"
}
}
28 changes: 13 additions & 15 deletions admin/scripts/generateExamples.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,26 @@ async function generateTemplateExample(template) {
`generating ${template} template for codesandbox in the examples folder...`,
);

// run the docusaurus script to create the template in the examples folder
// Run the docusaurus script to create the template in the examples folder
const command = template.endsWith('-typescript')
? template.replace('-typescript', ' -- --typescript')
: template;
shell.exec(
// /!\ we use the published init script on purpose,
// because using the local init script is too early and could generate
// upcoming/unavailable config options. Remember CodeSandbox templates
// will use the published version, not the repo version
// We use the published init script on purpose, because the local init is
// too new and could generate upcoming/unavailable config options.
// Remember CodeSandbox templates will use the published version,
// not the repo version.
`npm init docusaurus@latest examples/${template} ${command}`,
);

// read the content of the package.json
const templatePackageJson = JSON.parse(
await fs.readFile(`examples/${template}/package.json`, 'utf8'),
const templatePackageJson = await fs.readJSON(
`examples/${template}/package.json`,
);

// attach the dev script which would be used in code sandbox by default
// Attach the dev script which would be used in code sandbox by default
templatePackageJson.scripts.dev = 'docusaurus start';

// these example projects are not meant to be published to npm
// These example projects are not meant to be published to npm
templatePackageJson.private = true;

// Make sure package.json name is not "examples-classic". The package.json
Expand All @@ -58,13 +57,12 @@ async function generateTemplateExample(template) {
? 'Docusaurus example project'
: `Docusaurus example project (${template} template)`;

// rewrite the package.json file with the new edit
await fs.writeFile(
`./examples/${template}/package.json`,
`${JSON.stringify(templatePackageJson, null, 2)}\n`,
);

// create sandbox.config.json file at the root of template
// Create sandbox/stackblitz config file at the root of template
const codeSandboxConfig = {
infiniteLoopProtection: true,
hardReloadOnChange: true,
Expand Down Expand Up @@ -162,15 +160,15 @@ console.log(`
# Generate examples start!
`);

// delete the examples directories if they exists
// Delete the examples directories if they exist
console.log(`-------
## Removing example folders...
`);
await fs.rm('./examples/classic', {recursive: true, force: true});
await fs.rm('./examples/classic-typescript', {recursive: true, force: true});
await fs.rm('./examples/facebook', {recursive: true, force: true});

// get the list of all available templates
// Get the list of all available templates
console.log(`
-------
## Generate example folders...
Expand All @@ -187,7 +185,7 @@ console.log('Committing changes');
shell.exec('git add examples');
shell.exec("git commit -am 'update examples' --allow-empty");

// update starters
// Update starters
console.log(`
-------
# Updating starter repos and branches ...
Expand Down
7 changes: 3 additions & 4 deletions jest/snapshotPathNormalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,23 @@ function normalizePaths<T>(value: T): T {
(val) => val.split(homeDirReal).join('<HOME_DIR>'),
(val) => val.split(homeDir).join('<HOME_DIR>'),

// handle HOME_DIR nested inside TEMP_DIR
// Handle HOME_DIR nested inside TEMP_DIR
(val) =>
val
.split(`<TEMP_DIR>${path.sep + homeRelativeToTemp}`)
.join('<HOME_DIR>'),
(val) =>
val
.split(`<TEMP_DIR>${path.sep + homeRelativeToTempReal}`)
.join('<HOME_DIR>'), // untested
.join('<HOME_DIR>'),
(val) =>
val
.split(`<TEMP_DIR>${path.sep + homeRealRelativeToTempReal}`)
.join('<HOME_DIR>'),
(val) =>
val
.split(`<TEMP_DIR>${path.sep + homeRealRelativeToTemp}`)
.join('<HOME_DIR>'), // untested
.join('<HOME_DIR>'),

// Replace the Docusaurus version with a stub
(val) => val.split(version).join('<CURRENT_VERSION>'),
Expand Down Expand Up @@ -134,7 +134,6 @@ function normalizePaths<T>(value: T): T {
}

function shouldUpdate(value: unknown) {
// return true if value is different from normalized value
return typeof value === 'string' && normalizePaths(value) !== value;
}

Expand Down
Loading

0 comments on commit 77382bc

Please sign in to comment.