mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-28 17:57:48 +02:00
refactor: rename Git master branch to main (#5345)
* Prepare to renaming master branch to main * Update CONTRIBUTING.md * Update packages/docusaurus-migrate/src/__tests__/__fixtures__/missing_version_website/website/package.json * Update packages/docusaurus-migrate/src/__tests__/__fixtures__/complex_website/website/package.json * Update packages/docusaurus-migrate/src/__tests__/__fixtures__/simple_website/website/package.json * missing master -> main replaces * useless char * For GH Pages org deploy, DEPLOYMENT_BRANCH env is now required * fix versioning page * fix vercel links * update deployment.mdx Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
33a85c71aa
commit
8341527fc9
77 changed files with 230 additions and 206 deletions
2
.github/ISSUE_TEMPLATE/bug.md
vendored
2
.github/ISSUE_TEMPLATE/bug.md
vendored
|
@ -39,7 +39,7 @@ This way we know you've done these steps first.
|
|||
|
||||
(A clear and concise description of what the bug is.)
|
||||
|
||||
### Have you read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/master/CONTRIBUTING.md#reporting-new-issues)?
|
||||
### Have you read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#reporting-new-issues)?
|
||||
|
||||
(Write your answer here.)
|
||||
|
||||
|
|
2
.github/ISSUE_TEMPLATE/feature.md
vendored
2
.github/ISSUE_TEMPLATE/feature.md
vendored
|
@ -15,7 +15,7 @@ labels: 'feature, needs triage'
|
|||
|
||||
(A clear and concise description of what the feature is.)
|
||||
|
||||
### Have you read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/master/CONTRIBUTING.md#reporting-new-issues)?
|
||||
### Have you read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#reporting-new-issues)?
|
||||
|
||||
(Write your answer here.)
|
||||
|
||||
|
|
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -3,7 +3,7 @@ Thank you for sending the PR! We appreciate you spending the time to work on the
|
|||
|
||||
Help us understand your motivation by explaining why you decided to make this change.
|
||||
|
||||
You can learn more about contributing to Docusaurus here: https://github.com/facebook/docusaurus/blob/master/CONTRIBUTING.md
|
||||
You can learn more about contributing to Docusaurus here: https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md
|
||||
|
||||
Happy contributing!
|
||||
|
||||
|
@ -13,7 +13,7 @@ Happy contributing!
|
|||
|
||||
(Write your motivation here.)
|
||||
|
||||
### Have you read the [Contributing Guidelines on pull requests](https://github.com/facebook/docusaurus/blob/master/CONTRIBUTING.md#pull-requests)?
|
||||
### Have you read the [Contributing Guidelines on pull requests](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#pull-requests)?
|
||||
|
||||
(Write your answer here.)
|
||||
|
||||
|
|
4
.github/workflows/canary-release.yml
vendored
4
.github/workflows/canary-release.yml
vendored
|
@ -3,7 +3,7 @@ name: Canary Release
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- 'packages/**'
|
||||
|
||||
|
@ -26,7 +26,7 @@ jobs:
|
|||
git config --global user.name "Docusaurus Canary"
|
||||
git config --global user.email "canary@docusaurus.io"
|
||||
git fetch
|
||||
git checkout master
|
||||
git checkout main
|
||||
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
|
||||
cat .npmrc
|
||||
echo "npm whoami"
|
||||
|
|
6
.github/workflows/lint.yml
vendored
6
.github/workflows/lint.yml
vendored
|
@ -3,7 +3,7 @@ name: Lint
|
|||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
|
@ -15,8 +15,8 @@ jobs:
|
|||
- name: Installation
|
||||
uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
install-command: yarn install
|
||||
# install-command: yarn install --immutable # Fails if yarn.lock is modified (unfortunately only works for Yarn 2, and --frozen-lockfile is not the same!)
|
||||
install-command: yarn install
|
||||
# install-command: 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: Lint
|
||||
|
|
2
.github/workflows/v2-build-blog-only.yml
vendored
2
.github/workflows/v2-build-blog-only.yml
vendored
|
@ -3,7 +3,7 @@ name: V2 Build Blog-only
|
|||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- 'website-1.x/blog/**'
|
||||
- 'packages/docusaurus/**'
|
||||
|
|
3
.github/workflows/v2-build-size-report.yml
vendored
3
.github/workflows/v2-build-size-report.yml
vendored
|
@ -1,4 +1,3 @@
|
|||
|
||||
name: V2 Build Size Report
|
||||
|
||||
on:
|
||||
|
@ -9,7 +8,7 @@ on:
|
|||
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
|
|
3
.github/workflows/v2-build-time-perf.yml
vendored
3
.github/workflows/v2-build-time-perf.yml
vendored
|
@ -3,7 +3,7 @@ name: V2 Build Time Perf
|
|||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'website/docs/**'
|
||||
- 'website-1.x/**'
|
||||
|
@ -31,5 +31,4 @@ jobs:
|
|||
- name: Build (warm cache)
|
||||
run: yarn workspace docusaurus-2-website build --locale en
|
||||
timeout-minutes: 2
|
||||
|
||||
# TODO post a Github comment with build with perf warnings?
|
||||
|
|
4
.github/workflows/v2-lighthouse-report.yml
vendored
4
.github/workflows/v2-lighthouse-report.yml
vendored
|
@ -3,7 +3,7 @@ name: V2 Lighthouse Report
|
|||
on:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
|
@ -25,7 +25,7 @@ jobs:
|
|||
uses: treosh/lighthouse-ci-action@v3
|
||||
with:
|
||||
urls: |
|
||||
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/
|
||||
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/
|
||||
configPath: ./.github/workflows/v2-lighthousesrc.json
|
||||
uploadArtifacts: true
|
||||
temporaryPublicStorage: true
|
||||
|
|
8
.github/workflows/v2-tests-e2e.yml
vendored
8
.github/workflows/v2-tests-e2e.yml
vendored
|
@ -3,10 +3,10 @@ name: V2 Tests E2E
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
|
@ -29,7 +29,7 @@ jobs:
|
|||
uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
install-command: yarn
|
||||
- name: Generate test-website project against master release
|
||||
- name: Generate test-website project against main branch
|
||||
run: |
|
||||
KEEP_CONTAINER=true yarn test:build:v2 -s
|
||||
mv test-website ../test-website
|
||||
|
@ -66,7 +66,7 @@ jobs:
|
|||
with:
|
||||
install-command: yarn
|
||||
|
||||
- name: Generate test-website project against master release
|
||||
- name: Generate test-website project against main branch
|
||||
run: |
|
||||
KEEP_CONTAINER=true yarn test:build:v2 -s
|
||||
mv test-website ../test-website
|
||||
|
|
2
.github/workflows/v2-tests-windows.yml
vendored
2
.github/workflows/v2-tests-windows.yml
vendored
|
@ -3,7 +3,7 @@ name: V2 Windows Tests
|
|||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
|
|
2
.github/workflows/v2-tests.yml
vendored
2
.github/workflows/v2-tests.yml
vendored
|
@ -3,7 +3,7 @@ name: V2 Tests
|
|||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
|
|
|
@ -57,7 +57,7 @@ When a change made on GitHub is approved, it will be checked by our continuous i
|
|||
|
||||
### Branch Organization
|
||||
|
||||
Docusaurus has one primary branches `master` and we use feature branches with deploy previews to deliver new features with pull requests.
|
||||
Docusaurus has one primary branch `main` and we use feature branches with deploy previews to deliver new features with pull requests.
|
||||
|
||||
## Bugs
|
||||
|
||||
|
@ -65,7 +65,7 @@ We use [GitHub Issues](https://github.com/facebook/docusaurus/issues) for our pu
|
|||
|
||||
If you have questions about using Docusaurus, contact the Docusaurus Twitter account at [@docusaurus](https://twitter.com/docusaurus), and we will do our best to answer your questions.
|
||||
|
||||
You can also file issues as [feature requests or enhancements](https://github.com/facebook/docusaurus/labels/feature%20request). If you see anything you'd like to be implemented, create an issue with [feature template](https://raw.githubusercontent.com/facebook/docusaurus/master/.github/ISSUE_TEMPLATE/feature.md)
|
||||
You can also file issues as [feature requests or enhancements](https://github.com/facebook/docusaurus/labels/feature%20request). If you see anything you'd like to be implemented, create an issue with [feature template](https://raw.githubusercontent.com/facebook/docusaurus/main/.github/ISSUE_TEMPLATE/feature.md)
|
||||
|
||||
## Reporting New Issues
|
||||
|
||||
|
@ -125,14 +125,14 @@ Small pull requests are much easier to review and more likely to get merged. Mak
|
|||
|
||||
Please make sure the following is done when submitting a pull request:
|
||||
|
||||
1. Fork [the repository](https://github.com/facebook/docusaurus) and create your branch from `master`.
|
||||
1. Fork [the repository](https://github.com/facebook/docusaurus) and create your branch from `main`.
|
||||
1. Add the copyright notice to the top of any code new files you've added.
|
||||
1. Describe your [**test plan**](#test-plan) in your pull request description. Make sure to [test your changes](https://github.com/facebook/docusaurus/blob/master/admin/testing-changes-on-Docusaurus-itself.md)!
|
||||
1. Describe your [**test plan**](#test-plan) in your pull request description. Make sure to [test your changes](https://github.com/facebook/docusaurus/blob/main/admin/testing-changes-on-Docusaurus-itself.md)!
|
||||
1. Make sure your code lints (`yarn prettier && yarn lint`).
|
||||
1. Make sure your Jest tests pass (`yarn test`).
|
||||
1. If you haven't already, [sign the CLA](https://code.facebook.com/cla).
|
||||
|
||||
All pull requests should be opened against the `master` branch.
|
||||
All pull requests should be opened against the `main` branch.
|
||||
|
||||
#### Test Plan
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ Facebook has adopted a Code of Conduct that we expect project participants to ad
|
|||
|
||||
### Contributing guide
|
||||
|
||||
Read our [contributing guide](https://github.com/facebook/docusaurus/blob/master/CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Docusaurus.
|
||||
Read our [contributing guide](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Docusaurus.
|
||||
|
||||
### Beginner-friendly bugs
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Sometimes you want to test the latest version of Docusaurus on a third-party project via `npm` or `yarn` without having to publish it to npm itself. For example, you may want to use the latest code in `master`.
|
||||
Sometimes you want to test the latest version of Docusaurus on a third-party project via `npm` or `yarn` without having to publish it to npm itself. For example, you may want to use the latest code in `main`.
|
||||
|
||||
> If you want to use Docusaurus to test Docusaurus, see the [testing changes on Docusaurus itself doc](./testing-changes-on-Docusaurus-itself.md)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ const PlaygroundConfigs = {
|
|||
codesandbox: 'https://codesandbox.io/s/docusaurus',
|
||||
|
||||
// stackblitz: 'https://stackblitz.com/fork/docusaurus', // not updated
|
||||
// stackblitz: 'https://stackblitz.com/github/facebook/docusaurus/tree/master/examples/classic', // slow to load
|
||||
// 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
|
||||
};
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@ If you're publishing new v2 versions, 2FA might get in the way as the pin might
|
|||
|
||||
### 1. Git setup
|
||||
|
||||
From the **master branch** (up to date, main repo, not a fork), create a new branch for the release.
|
||||
From the **main branch** (up to date, main repo, not a fork), create a new branch for the release.
|
||||
|
||||
The branch name does not matter much, but you can use the `<your_username>/<version_to_release>` pattern.
|
||||
|
||||
```sh
|
||||
# up to date master
|
||||
git co master
|
||||
# up to date main
|
||||
git co main
|
||||
git pull
|
||||
|
||||
# create a new release branch
|
||||
|
|
|
@ -8,9 +8,9 @@ npx @docusaurus/init@latest init examples/<templateName> <templateName>`
|
|||
|
||||
You can run them in CodeSandbox:
|
||||
|
||||
- [classic](https://codesandbox.io/s/github/facebook/docusaurus/tree/master/examples/classic)
|
||||
- [bootstrap](https://codesandbox.io/s/github/facebook/docusaurus/tree/master/examples/bootstrap)
|
||||
- [facebook](https://codesandbox.io/s/github/facebook/docusaurus/tree/master/examples/facebook)
|
||||
- [classic](https://codesandbox.io/s/github/facebook/docusaurus/tree/main/examples/classic)
|
||||
- [bootstrap](https://codesandbox.io/s/github/facebook/docusaurus/tree/main/examples/bootstrap)
|
||||
- [facebook](https://codesandbox.io/s/github/facebook/docusaurus/tree/main/examples/facebook)
|
||||
|
||||
**Tip**: use the [new.docusaurus.io](https://new.docusaurus.io) shortcut.
|
||||
|
||||
|
|
|
@ -74,14 +74,13 @@ module.exports = {
|
|||
{
|
||||
docs: {
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/blog/',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/blog/',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -91,14 +91,13 @@ module.exports = {
|
|||
docs: {
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/blog/',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/blog/',
|
||||
},
|
||||
theme: {
|
||||
customCss: require.resolve('./src/css/custom.css'),
|
||||
|
|
|
@ -126,14 +126,13 @@ module.exports = {
|
|||
docs: {
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/blog/',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/blog/',
|
||||
},
|
||||
theme: {
|
||||
customCss: require.resolve('./src/css/custom.css'),
|
||||
|
|
|
@ -125,9 +125,9 @@ function updateStarters() {
|
|||
|
||||
function run() {
|
||||
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString();
|
||||
if (branch === 'master') {
|
||||
if (branch === 'main') {
|
||||
throw new Error(
|
||||
"Please don't generate Docusaurus examples from the master branch!\nWe are going to commit during this process!",
|
||||
"Please don't generate Docusaurus examples from the main branch!\nWe are going to commit during this process!",
|
||||
);
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -74,14 +74,13 @@ module.exports = {
|
|||
{
|
||||
docs: {
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/blog/',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/blog/',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -91,14 +91,13 @@ module.exports = {
|
|||
docs: {
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/blog/',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/blog/',
|
||||
},
|
||||
theme: {
|
||||
customCss: require.resolve('./src/css/custom.css'),
|
||||
|
|
|
@ -126,14 +126,13 @@ module.exports = {
|
|||
docs: {
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
},
|
||||
blog: {
|
||||
showReadingTime: true,
|
||||
// Please change this to your repo.
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/blog/',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/blog/',
|
||||
},
|
||||
theme: {
|
||||
customCss: require.resolve('./src/css/custom.css'),
|
||||
|
|
|
@ -24,7 +24,7 @@ const siteConfig = {
|
|||
cname: 'docusaurus.io',
|
||||
noIndex: false,
|
||||
users,
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/docs/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/docs/',
|
||||
headerLinks: [
|
||||
{doc: 'installation', label: 'Docs'},
|
||||
{doc: 'tutorial-setup', label: 'Tutorial'},
|
||||
|
|
|
@ -40,7 +40,7 @@ module.exports = {
|
|||
homePageId: 'installation',
|
||||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/docs/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/docs/',
|
||||
},
|
||||
blog: {},
|
||||
theme: {},
|
||||
|
|
|
@ -24,7 +24,7 @@ const siteConfig = {
|
|||
cname: 'docusaurus.io',
|
||||
noIndex: false,
|
||||
users,
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/docs/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/docs/',
|
||||
headerLinks: [
|
||||
{doc: 'installation', label: 'Docs'},
|
||||
{doc: 'tutorial-setup', label: 'Tutorial'},
|
||||
|
|
|
@ -24,7 +24,7 @@ const siteConfig = {
|
|||
cname: 'docusaurus.io',
|
||||
noIndex: false,
|
||||
users,
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/docs/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/docs/',
|
||||
headerLinks: [
|
||||
{doc: 'installation', label: 'Docs'},
|
||||
{doc: 'tutorial-setup', label: 'Tutorial'},
|
||||
|
|
|
@ -23,7 +23,7 @@ const siteConfig = {
|
|||
cname: 'docusaurus.io',
|
||||
noIndex: true,
|
||||
users,
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/docs/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/docs/',
|
||||
headerLinks: [
|
||||
{doc: 'installation', label: 'Docs'},
|
||||
{doc: 'tutorial-setup', label: 'Tutorial'},
|
||||
|
|
|
@ -671,7 +671,7 @@ function migrateVersionedSidebar(
|
|||
to: `docs/${version}/`,
|
||||
})),
|
||||
{
|
||||
label: 'Master/Unreleased',
|
||||
label: 'Main/Unreleased',
|
||||
to: `docs/next/`,
|
||||
activeBaseRegex: `docs/next/(?!support|team|resources)`,
|
||||
},
|
||||
|
|
|
@ -269,7 +269,7 @@ describe('simple site', () => {
|
|||
test('docs with editUrl', async () => {
|
||||
const {siteDir, context, options, currentVersion} = await loadSite({
|
||||
options: {
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website',
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -290,7 +290,7 @@ describe('simple site', () => {
|
|||
slug: '/foo/bazSlug.html',
|
||||
title: 'baz',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs/foo/baz.md',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/docs/foo/baz.md',
|
||||
description: 'Images',
|
||||
frontMatter: {
|
||||
id: 'baz',
|
||||
|
@ -744,7 +744,7 @@ describe('versioned site', () => {
|
|||
test('translated doc with editUrl', async () => {
|
||||
const {siteDir, context, options, version100} = await loadSite({
|
||||
options: {
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website',
|
||||
// editCurrentVersion: true,
|
||||
},
|
||||
});
|
||||
|
@ -770,14 +770,14 @@ describe('versioned site', () => {
|
|||
source:
|
||||
'@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/versioned_docs/version-1.0.0/hello.md',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/versioned_docs/version-1.0.0/hello.md',
|
||||
});
|
||||
});
|
||||
|
||||
test('translated en doc with editUrl and editCurrentVersion=true', async () => {
|
||||
const {siteDir, context, options, version100} = await loadSite({
|
||||
options: {
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website',
|
||||
editCurrentVersion: true,
|
||||
},
|
||||
});
|
||||
|
@ -803,14 +803,14 @@ describe('versioned site', () => {
|
|||
source:
|
||||
'@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs/hello.md',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/docs/hello.md',
|
||||
});
|
||||
});
|
||||
|
||||
test('translated fr doc with editUrl and editLocalizedFiles=true', async () => {
|
||||
const {siteDir, context, options, version100} = await loadSite({
|
||||
options: {
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website',
|
||||
editLocalizedFiles: true,
|
||||
},
|
||||
locale: 'fr',
|
||||
|
@ -837,14 +837,14 @@ describe('versioned site', () => {
|
|||
source:
|
||||
'@site/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
});
|
||||
});
|
||||
|
||||
test('translated fr doc with editUrl and editLocalizedFiles=true + editCurrentVersion=true', async () => {
|
||||
const {siteDir, context, options, version100} = await loadSite({
|
||||
options: {
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website',
|
||||
editCurrentVersion: true,
|
||||
editLocalizedFiles: true,
|
||||
},
|
||||
|
@ -872,7 +872,7 @@ describe('versioned site', () => {
|
|||
source:
|
||||
'@site/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/i18n/fr/docusaurus-plugin-content-docs/current/hello.md',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/fr/docusaurus-plugin-content-docs/current/hello.md',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -412,7 +412,7 @@ describe('versioned site, pluginId=default', () => {
|
|||
const versionsMetadata = readVersionsMetadata({
|
||||
options: {
|
||||
...defaultOptions,
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
},
|
||||
context: defaultContext,
|
||||
});
|
||||
|
@ -421,30 +421,30 @@ describe('versioned site, pluginId=default', () => {
|
|||
{
|
||||
...vCurrent,
|
||||
versionEditUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/docs',
|
||||
versionEditUrlLocalized:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
},
|
||||
{
|
||||
...v101,
|
||||
versionEditUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/versioned_docs/version-1.0.1',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/versioned_docs/version-1.0.1',
|
||||
versionEditUrlLocalized:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/i18n/en/docusaurus-plugin-content-docs/version-1.0.1',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/version-1.0.1',
|
||||
},
|
||||
{
|
||||
...v100,
|
||||
versionEditUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/versioned_docs/version-1.0.0',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/versioned_docs/version-1.0.0',
|
||||
versionEditUrlLocalized:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/i18n/en/docusaurus-plugin-content-docs/version-1.0.0',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/version-1.0.0',
|
||||
},
|
||||
{
|
||||
...vwithSlugs,
|
||||
versionEditUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/versioned_docs/version-withSlugs',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/versioned_docs/version-withSlugs',
|
||||
versionEditUrlLocalized:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/i18n/en/docusaurus-plugin-content-docs/version-withSlugs',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/version-withSlugs',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
@ -462,7 +462,7 @@ describe('versioned site, pluginId=default', () => {
|
|||
const versionsMetadata = readVersionsMetadata({
|
||||
options: {
|
||||
...defaultOptions,
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
editCurrentVersion: true,
|
||||
},
|
||||
context: defaultContext,
|
||||
|
@ -472,30 +472,30 @@ describe('versioned site, pluginId=default', () => {
|
|||
{
|
||||
...vCurrent,
|
||||
versionEditUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/docs',
|
||||
versionEditUrlLocalized:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
},
|
||||
{
|
||||
...v101,
|
||||
versionEditUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/docs',
|
||||
versionEditUrlLocalized:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
},
|
||||
{
|
||||
...v100,
|
||||
versionEditUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/docs',
|
||||
versionEditUrlLocalized:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
},
|
||||
{
|
||||
...vwithSlugs,
|
||||
versionEditUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/docs',
|
||||
versionEditUrlLocalized:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/current',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
|
|
@ -28,4 +28,4 @@ module.exports = {
|
|||
$ npm swizzle @docusaurus/theme-bootstrap [component name]
|
||||
```
|
||||
|
||||
All components used by this theme can be found [here](https://github.com/facebook/docusaurus/tree/master/packages/docusaurus-theme-bootstrap/src/theme)
|
||||
All components used by this theme can be found [here](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-bootstrap/src/theme)
|
||||
|
|
|
@ -28,4 +28,4 @@ module.exports = {
|
|||
$ npm swizzle @docusaurus/theme-classic [component name]
|
||||
```
|
||||
|
||||
All components used by this theme can be found [here](https://github.com/facebook/docusaurus/tree/master/packages/docusaurus-theme-classic/src/theme)
|
||||
All components used by this theme can be found [here](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-classic/src/theme)
|
||||
|
|
|
@ -103,10 +103,19 @@ This behavior can have SEO impacts and create relative link issues.
|
|||
shell.exit(0);
|
||||
}
|
||||
|
||||
// github.io indicates organization repos that deploy via master. All others use gh-pages.
|
||||
const deploymentBranch =
|
||||
process.env.DEPLOYMENT_BRANCH ||
|
||||
(projectName.indexOf('.github.io') !== -1 ? 'master' : 'gh-pages');
|
||||
// github.io indicates organization repos that deploy via default branch. All others use gh-pages.
|
||||
// Organization deploys looks like:
|
||||
// - Git repo: https://github.com/<organization>/<organization>.github.io
|
||||
// - Site url: https://<organization>.github.io
|
||||
const isGitHubPagesOrganizationDeploy =
|
||||
projectName.indexOf('.github.io') !== -1;
|
||||
if (isGitHubPagesOrganizationDeploy && !process.env.DEPLOYMENT_BRANCH) {
|
||||
throw new Error(`For GitHub pages organization deployments, 'docusaurus deploy' does not assume anymore that 'master' is your default Git branch.
|
||||
Please provide the branch name to deploy to as an environment variable.
|
||||
Try using DEPLOYMENT_BRANCH=main or DEPLOYMENT_BRANCH=master`);
|
||||
}
|
||||
|
||||
const deploymentBranch = process.env.DEPLOYMENT_BRANCH || 'gh-pages';
|
||||
console.log(`${chalk.cyan('deploymentBranch:')} ${deploymentBranch}`);
|
||||
|
||||
const githubHost =
|
||||
|
@ -166,7 +175,7 @@ This behavior can have SEO impacts and create relative link issues.
|
|||
|
||||
// If the default branch is the one we're deploying to, then we'll fail
|
||||
// to create it. This is the case of a cross-repo publish, where we clone
|
||||
// a github.io repo with a default master branch.
|
||||
// a github.io repo with a default branch.
|
||||
const defaultBranch = shell
|
||||
.exec('git rev-parse --abbrev-ref HEAD')
|
||||
.stdout.trim();
|
||||
|
|
|
@ -38,7 +38,7 @@ function formatMessage(message) {
|
|||
}
|
||||
|
||||
// Strip webpack-added headers off errors/warnings
|
||||
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
|
||||
// https://github.com/webpack/webpack/blob/main/lib/ModuleError.js
|
||||
lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
|
||||
|
||||
// Transform parsing error into syntax error
|
||||
|
|
|
@ -22,7 +22,7 @@ exports.dogfoodingPluginInstances = [
|
|||
path: '_dogfooding/_blog tests',
|
||||
routeBasePath: '/tests/blog',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/_dogfooding/_blog-tests',
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/_dogfooding/_blog-tests',
|
||||
postsPerPage: 3,
|
||||
feedOptions: {
|
||||
type: 'all',
|
||||
|
|
|
@ -18,7 +18,7 @@ In 2018, we proposed to rebuild [Docusaurus from the ground up](https://github.c
|
|||
|
||||
D2's killer features are **Dark Mode** and its **superb performance**. D2 has dark mode support out-of-the-box and it is near effortless to create a dark mode-friendly documentation site. Endilie put in great effort into optimizing the performance of the site and a bunch of performance optimization tricks have been done under the hood by default - optimized images, prerendering every route to static HTML and client-side routing thereafter, prefetching assets needed by future navigations whenever the user hovers over a navigation link, etc.
|
||||
|
||||
Last but not least, we implemented a plugins architecture and turned the repo into a [Lerna monorepo](https://github.com/facebook/docusaurus/tree/master/packages). We believe this plugin architecture will be helpful towards building a community and also allowing users to build their own features for their unique use cases.
|
||||
Last but not least, we implemented a plugins architecture and turned the repo into a [Lerna monorepo](https://github.com/facebook/docusaurus/tree/main/packages). We believe this plugin architecture will be helpful towards building a community and also allowing users to build their own features for their unique use cases.
|
||||
|
||||
## GitHub Activity
|
||||
|
||||
|
@ -52,7 +52,7 @@ Yangshun gave a classroom session during F8 about [Using Docusaurus to Create Op
|
|||
|
||||
A few third-party hosting/development services also has first-class integration with a Docusaurus setup:
|
||||
|
||||
- [ZEIT Now deployment](https://github.com/zeit/now-examples/tree/master/docusaurus)
|
||||
- [Vercel deployment](https://github.com/vercel/vercel/tree/main/examples/docusaurus)
|
||||
- [CodeSandbox](https://codesandbox.io/s/docusaurus-template-x3vg9)
|
||||
- [Render](https://render.com/docs/deploy-docusaurus)
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ The goals of the Docusaurus i18n system are:
|
|||
- **Easy to use with [Crowdin](https://crowdin.com/)**: multiple Docusaurus 1 sites use Crowdin, and should be able to migrate to v2
|
||||
- **Good SEO defaults**: we set useful SEO headers like [`hreflang`](https://developers.google.com/search/docs/advanced/crawling/localized-versions) for you
|
||||
- **RTL support**: locales reading right-to-left (Arabic, Hebrew, etc.) are supported and easy to implement
|
||||
- **Default translations**: classic theme labels are translated for you in [many languages](https://github.com/facebook/docusaurus/tree/master/packages/docusaurus-theme-classic/codeTranslations)
|
||||
- **Default translations**: classic theme labels are translated for you in [many languages](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-classic/codeTranslations)
|
||||
|
||||
## Showcase
|
||||
|
||||
|
|
|
@ -140,14 +140,14 @@ Small pull requests are much easier to review and more likely to get merged. Mak
|
|||
|
||||
Please make sure the following is done when submitting a pull request:
|
||||
|
||||
1. Fork [the repository](https://github.com/facebook/docusaurus) and create your branch from `master`.
|
||||
1. Fork [the repository](https://github.com/facebook/docusaurus) and create your branch from `main`.
|
||||
1. Add the copyright notice to the top of any code new files you've added.
|
||||
1. Describe your [test plan](#test-plan) in your pull request description. Make sure to [test your changes](https://github.com/facebook/docusaurus/blob/master/admin/testing-changes-on-Docusaurus-itself.md/)!
|
||||
1. Describe your [test plan](#test-plan) in your pull request description. Make sure to [test your changes](https://github.com/facebook/docusaurus/blob/main/admin/testing-changes-on-Docusaurus-itself.md/)!
|
||||
1. Make sure your code lints (`yarn prettier && yarn lint`).
|
||||
1. Make sure your Jest tests pass (`yarn test`).
|
||||
1. If you haven't already, [sign the CLA](https://code.facebook.com/cla).
|
||||
|
||||
All pull requests should be opened against the `master` branch.
|
||||
All pull requests should be opened against the `main` branch.
|
||||
|
||||
#### Test plan {#test-plan}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ A canary release passes all automated tests, and is used in production by the Do
|
|||
|
||||
## Canary npm dist tag
|
||||
|
||||
For any code-related commit on `master`, the continuous integration will publish a canary release under the `@canary` npm dist tag. It generally takes up to 10 minutes.
|
||||
For any code-related commit on `main`, the continuous integration will publish a canary release under the `@canary` npm dist tag. It generally takes up to 10 minutes.
|
||||
|
||||
You can see on [npm](https://www.npmjs.com/package/@docusaurus/core?activeTab=versions) the current dist tags:
|
||||
|
||||
|
|
|
@ -83,10 +83,10 @@ Most Docusaurus users configure this plugin through the [preset options](#ex-con
|
|||
const config = {
|
||||
path: 'blog',
|
||||
// Simple use-case: string editUrl
|
||||
// editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
// editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
// Advanced use-case: functional editUrl
|
||||
editUrl: ({locale, blogDirPath, blogPath, permalink}) => {
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${blogDirPath}/${blogPath}`;
|
||||
},
|
||||
editLocalizedFiles: false,
|
||||
blogTitle: 'Blog title',
|
||||
|
|
|
@ -109,10 +109,10 @@ Most Docusaurus users configure this plugin through the [preset options](#ex-con
|
|||
const config = {
|
||||
path: 'docs',
|
||||
// Simple use-case: string editUrl
|
||||
// editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
// editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
// Advanced use-case: functional editUrl
|
||||
editUrl: ({versionDocsDirPath, docPath}) =>
|
||||
`https://github.com/facebook/docusaurus/edit/master/website/${versionDocsDirPath}/${docPath}`,
|
||||
`https://github.com/facebook/docusaurus/edit/main/website/${versionDocsDirPath}/${docPath}`,
|
||||
editLocalizedFiles: false,
|
||||
editCurrentVersion: false,
|
||||
routeBasePath: 'docs',
|
||||
|
@ -263,7 +263,7 @@ hide_table_of_contents: false
|
|||
sidebar_label: Markdown
|
||||
sidebar_position: 3
|
||||
pagination_label: Markdown features
|
||||
custom_edit_url: https://github.com/facebook/docusaurus/edit/master/docs/api-doc-markdown.md
|
||||
custom_edit_url: https://github.com/facebook/docusaurus/edit/main/docs/api-doc-markdown.md
|
||||
description: How do I find you when I cannot solve this problem
|
||||
keywords:
|
||||
- docs
|
||||
|
|
|
@ -127,8 +127,8 @@ Optional parameters, also set as environment variables:
|
|||
| Name | Description |
|
||||
| --- | --- |
|
||||
| `USE_SSH` | Set to `true` to use SSH instead of the default HTTPS for the connection to the GitHub repo. |
|
||||
| `DEPLOYMENT_BRANCH` | The branch that the website will be deployed to, defaults to `gh-pages` for normal repos and `master` for repository names ending in `github.io`. |
|
||||
| `CURRENT_BRANCH` | The branch that contains the latest docs changes that will be deployed. Usually, the branch will be `master`, but it could be any branch (default or otherwise) except for `gh-pages`. If nothing is set for this variable, then the current branch will be used. |
|
||||
| `DEPLOYMENT_BRANCH` | The branch that the website will be deployed to, defaults to `gh-pages`. For GitHub Pages Organization repos (`config.projectName` ending in `github.io`), this env variable is required. |
|
||||
| `CURRENT_BRANCH` | The branch that contains the latest docs changes that will be deployed. Usually, the branch will be `main`, but it could be any branch (default or otherwise) except for `gh-pages`. If nothing is set for this variable, then the current branch will be used. |
|
||||
| `GIT_PASS` | Password (or token) of the `git` user (specified by `GIT_USER`). For example, to facilitate non-interactive deployment (e.g. continuous deployment) |
|
||||
|
||||
GitHub enterprise installations should work in the same manner as github.com; you only need to set the organization's GitHub Enterprise host as an environment variable:
|
||||
|
@ -269,7 +269,7 @@ node_js:
|
|||
- '10'
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- main
|
||||
cache:
|
||||
yarn: true
|
||||
script:
|
||||
|
@ -279,7 +279,7 @@ script:
|
|||
- yarn && GIT_USER="${GH_NAME}" yarn deploy
|
||||
```
|
||||
|
||||
Now, whenever a new commit lands in `master`, Travis CI will run your suite of tests and if everything passes, your website will be deployed via the `yarn deploy` script.
|
||||
Now, whenever a new commit lands in `main`, Travis CI will run your suite of tests and if everything passes, your website will be deployed via the `yarn deploy` script.
|
||||
|
||||
### Triggering deployment with Buddy {#triggering-deployment-with-buddy}
|
||||
|
||||
|
@ -312,7 +312,7 @@ After creating this simple pipeline, each new commit pushed to the branch you se
|
|||
|
||||
```yaml title="azure-pipelines.yml"
|
||||
trigger:
|
||||
- master
|
||||
- main
|
||||
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
|
@ -329,7 +329,7 @@ steps:
|
|||
- script: |
|
||||
git config --global user.name "${GH_NAME}"
|
||||
git config --global user.email "${GH_EMAIL}"
|
||||
git checkout -b master
|
||||
git checkout -b main
|
||||
echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc
|
||||
yarn && GIT_USER="${GH_NAME}" yarn deploy
|
||||
env:
|
||||
|
@ -394,7 +394,7 @@ While you set up the site, specify the build commands and directories as follows
|
|||
|
||||
If you did not configure these build options, you may still go to "Site settings" -> "Build and deploy" after your site is created.
|
||||
|
||||
Once properly configured with the above options, your site should deploy and automatically redeploy upon merging to your deploy branch, which defaults to `master`.
|
||||
Once properly configured with the above options, your site should deploy and automatically redeploy upon merging to your deploy branch, which defaults to `main`.
|
||||
|
||||
:::warning
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ To better understand how versioning works and see if it suits your needs, you ca
|
|||
|
||||
```shell
|
||||
website
|
||||
├── sidebars.json # sidebar for master (next) version
|
||||
├── docs # docs directory for master (next) version
|
||||
├── sidebars.json # sidebar for the current docs version
|
||||
├── docs # docs directory for the current docs version
|
||||
│ ├── foo
|
||||
│ │ └── bar.md # https://mysite.com/docs/next/foo/bar
|
||||
│ └── hello.md # https://mysite.com/docs/next/hello
|
||||
|
@ -48,11 +48,19 @@ The table below explains how a versioned file maps to its version and the genera
|
|||
| --------------------------------------- | -------------- | ----------------- |
|
||||
| `versioned_docs/version-1.0.0/hello.md` | 1.0.0 | /docs/1.0.0/hello |
|
||||
| `versioned_docs/version-1.1.0/hello.md` | 1.1.0 (latest) | /docs/hello |
|
||||
| `docs/hello.md` | next | /docs/next/hello |
|
||||
| `docs/hello.md` | current | /docs/next/hello |
|
||||
|
||||
:::tip
|
||||
|
||||
The files in the `docs` directory belong to the `current` docs version.
|
||||
|
||||
By default, the `current` docs version is labelled as `Next` and hosted under `/docs/next/*`, but is entirely configurable to fit your project's release lifecycle.
|
||||
|
||||
:::
|
||||
|
||||
### Tagging a new version {#tagging-a-new-version}
|
||||
|
||||
1. First, make sure your content in the `docs` directory is ready to be frozen as a version. A version always should be based from master.
|
||||
1. First, make sure the current docs version (the `docs` directory) is ready to be frozen.
|
||||
1. Enter a new version number.
|
||||
|
||||
```bash npm2yarn
|
||||
|
@ -72,7 +80,7 @@ When tagging a new version, the document versioning mechanism will:
|
|||
1. Place the new file into the corresponding version folder.
|
||||
1. Include the reference for the new file into the corresponding sidebar file, according to version number.
|
||||
|
||||
**Master docs**
|
||||
**Current version docs**
|
||||
|
||||
```shell
|
||||
# The new file.
|
||||
|
@ -82,7 +90,7 @@ docs/new.md
|
|||
sidebar.js
|
||||
```
|
||||
|
||||
**Older docs**
|
||||
**Older version docs**
|
||||
|
||||
```shell
|
||||
# The new file.
|
||||
|
|
|
@ -484,7 +484,7 @@ module.exports = {
|
|||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
// Link to Github for English docs
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${versionDocsDirPath}/${docPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${versionDocsDirPath}/${docPath}`;
|
||||
},
|
||||
// highlight-end
|
||||
},
|
||||
|
@ -494,7 +494,7 @@ module.exports = {
|
|||
if (locale !== DefaultLocale) {
|
||||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${blogDirPath}/${blogPath}`;
|
||||
},
|
||||
// highlight-start
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ The goals of the Docusaurus i18n system are:
|
|||
- **Easy to use with [Crowdin](https://crowdin.com/)**: multiple Docusaurus v1 sites use Crowdin, and should be able to migrate to v2
|
||||
- **Good SEO defaults**: we set useful SEO headers like [`hreflang`](https://developers.google.com/search/docs/advanced/crawling/localized-versions) for you
|
||||
- **RTL support**: locales reading right-to-left (Arabic, Hebrew, etc.) are supported and easy to implement
|
||||
- **Default translations**: classic theme labels are translated for you in [many languages](https://github.com/facebook/docusaurus/tree/master/packages/docusaurus-theme-classic/codeTranslations)
|
||||
- **Default translations**: classic theme labels are translated for you in [many languages](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-classic/codeTranslations)
|
||||
|
||||
### i18n non-goals {#i18n-non-goals}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ This tutorial will walk you through the basis of the **Docusaurus i18n system**.
|
|||
|
||||
We will add **French** translations to a **newly initialized English Docusaurus website**.
|
||||
|
||||
Initialize a new site with `npx @docusaurus/init@latest init website classic` (like [this one](https://github.com/facebook/docusaurus/tree/master/examples/classic)).
|
||||
Initialize a new site with `npx @docusaurus/init@latest init website classic` (like [this one](https://github.com/facebook/docusaurus/tree/main/examples/classic)).
|
||||
|
||||
## Configure your site {#configure-your-site}
|
||||
|
||||
|
@ -64,7 +64,7 @@ We haven't provided any translation, and the site is **mostly untranslated**.
|
|||
|
||||
Docusaurus provides **default translations** for generic theme labels, such as "Next" and "Previous" for the pagination.
|
||||
|
||||
Please help us complete those **[default translations](https://github.com/facebook/docusaurus/tree/master/packages/docusaurus-theme-classic/codeTranslations)**.
|
||||
Please help us complete those **[default translations](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-classic/codeTranslations)**.
|
||||
|
||||
:::
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ id: installation
|
|||
title: Installation
|
||||
---
|
||||
|
||||
Docusaurus is essentially a set of npm [packages](https://github.com/facebook/docusaurus/tree/master/packages).
|
||||
Docusaurus is essentially a set of npm [packages](https://github.com/facebook/docusaurus/tree/main/packages).
|
||||
|
||||
:::tip
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ yarn-error.log*
|
|||
|
||||
### `README` {#readme}
|
||||
|
||||
The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/master/packages/docusaurus-init/templates/classic/README.md).
|
||||
The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-init/templates/classic/README.md).
|
||||
|
||||
## Site configurations {#site-configurations}
|
||||
|
||||
|
@ -154,7 +154,7 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
We recommend moving the `docs` folder into the `website` folder and that is also the default directory structure in v2. [Now](https://zeit.co/now) supports [Docusaurus project deployments out-of-the-box](https://github.com/zeit/now-examples/tree/master/docusaurus) if the `docs` directory is within the `website`. It is also generally better for the docs to be within the website so that the docs and the rest of the website code are co-located within one `website` directory.
|
||||
We recommend moving the `docs` folder into the `website` folder and that is also the default directory structure in v2. [Vercel](https://vercel.com) supports [Docusaurus project deployments out-of-the-box](https://github.com/vercel/vercel/tree/main/examples/docusaurus) if the `docs` directory is within the `website`. It is also generally better for the docs to be within the website so that the docs and the rest of the website code are co-located within one `website` directory.
|
||||
|
||||
If you are migrating your Docusaurus v1 website, and there are pending documentation pull requests, you can temporarily keep the `/docs` folder to its original place, to avoid producing conflicts.
|
||||
|
||||
|
@ -342,7 +342,7 @@ module.exports = {
|
|||
// Equivalent to `customDocsPath`.
|
||||
path: 'docs',
|
||||
// Equivalent to `editUrl` but should point to `website` dir instead of `website/docs`.
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website',
|
||||
// Equivalent to `docsUrl`.
|
||||
routeBasePath: 'docs',
|
||||
// Remark and Rehype plugins passed to MDX. Replaces `markdownOptions` and `markdownPlugins`.
|
||||
|
@ -551,8 +551,8 @@ export default MyPage;
|
|||
|
||||
The following code could be helpful for migration of various pages:
|
||||
|
||||
- Index page - [Flux](https://github.com/facebook/flux/blob/master/website/src/pages/index.js/) (recommended), [Docusaurus 2](https://github.com/facebook/docusaurus/blob/master/website/src/pages/index.js/), [Hermes](https://github.com/facebook/hermes/blob/master/website/src/pages/index.js/)
|
||||
- Help/Support page - [Docusaurus 2](https://github.com/facebook/docusaurus/blob/master/website/src/pages/help.js/), [Flux](http://facebook.github.io/flux/support)
|
||||
- Index page - [Flux](https://github.com/facebook/flux/blob/master/website/src/pages/index.js/) (recommended), [Docusaurus 2](https://github.com/facebook/docusaurus/blob/main/website/src/pages/index.js/), [Hermes](https://github.com/facebook/hermes/blob/main/website/src/pages/index.js/)
|
||||
- Help/Support page - [Docusaurus 2](https://github.com/facebook/docusaurus/blob/main/website/src/pages/help.js/), [Flux](http://facebook.github.io/flux/support)
|
||||
|
||||
## Content {#content}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ This workflow has not been tested in practice, please report us how good it is.
|
|||
|
||||
This way, you wouldn't need to create a new Crowdin project, transfer the translation memory, apply pre-translations, and try to fix the pre-translations errors.
|
||||
|
||||
You could create a Crowdin branch for Docusaurus v2, where you upload the v2 sources, and merge the Crowdin branch to master once ready.
|
||||
You could create a Crowdin branch for Docusaurus v2, where you upload the v2 sources, and merge the Crowdin branch to main once ready.
|
||||
|
||||
### Use Git instead of Crowdin {#use-git-instead-of-crowdin}
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ module.exports = {
|
|||
blog: {
|
||||
routeBasePath: '/',
|
||||
path: 'blog',
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
postsPerPage: 3,
|
||||
feedOptions: {
|
||||
type: 'all',
|
||||
|
|
|
@ -112,7 +112,7 @@ const TwitterSvg =
|
|||
if (locale !== 'en') {
|
||||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${versionDocsDirPath}/${docPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${versionDocsDirPath}/${docPath}`;
|
||||
},
|
||||
editCurrentVersion: true,
|
||||
sidebarPath: require.resolve('./sidebarsCommunity.js'),
|
||||
|
@ -239,7 +239,7 @@ const TwitterSvg =
|
|||
// We want users to submit doc updates to the upstream/next version!
|
||||
// Otherwise we risk losing the update on the next release.
|
||||
const nextVersionDocsDirPath = 'docs';
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${nextVersionDocsDirPath}/${docPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${nextVersionDocsDirPath}/${docPath}`;
|
||||
},
|
||||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
|
@ -267,7 +267,7 @@ const TwitterSvg =
|
|||
if (locale !== 'en') {
|
||||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${blogDirPath}/${blogPath}`;
|
||||
},
|
||||
postsPerPage: 3,
|
||||
feedOptions: {
|
||||
|
|
|
@ -979,7 +979,7 @@ const Users: User[] = [
|
|||
description: 'The GraphQL client that scales with you',
|
||||
preview: require('./showcase/relay.png'),
|
||||
website: 'https://relay.dev/',
|
||||
source: 'https://github.com/facebook/relay/tree/master/website',
|
||||
source: 'https://github.com/facebook/relay/tree/main/website',
|
||||
tags: ['opensource','favorite','design','versioning'],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@ type Operator = 'OR' | 'AND';
|
|||
const TITLE = 'Docusaurus Site Showcase';
|
||||
const DESCRIPTION = 'List of websites people are building with Docusaurus';
|
||||
const EDIT_URL =
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/src/data/users.tsx';
|
||||
'https://github.com/facebook/docusaurus/edit/main/website/src/data/users.tsx';
|
||||
|
||||
function filterUsers(
|
||||
users: User[],
|
||||
|
|
|
@ -34,12 +34,12 @@ module.exports = {
|
|||
* Base url to edit your site.
|
||||
* Docusaurus will compute the final editUrl with "editUrl + relativeDocPath"
|
||||
*/
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
/**
|
||||
* For advanced cases, compute the edit url for each Markdown file yourself.
|
||||
*/
|
||||
editUrl: ({locale, blogDirPath, blogPath, permalink}) => {
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${blogDirPath}/${blogPath}`;
|
||||
},
|
||||
/**
|
||||
* Useful if you commit localized files to git.
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = {
|
|||
* Base url to edit your site.
|
||||
* Docusaurus will compute the final editUrl with "editUrl + relativeDocPath"
|
||||
*/
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
/**
|
||||
* For advanced cases, compute the edit url for each Markdown file yourself.
|
||||
*/
|
||||
|
@ -45,7 +45,7 @@ module.exports = {
|
|||
docPath,
|
||||
permalink,
|
||||
}) {
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${versionDocsDirPath}/${docPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${versionDocsDirPath}/${docPath}`;
|
||||
},
|
||||
/**
|
||||
* Useful if you commit localized files to git.
|
||||
|
@ -171,7 +171,7 @@ module.exports = {
|
|||
*/
|
||||
versions: {
|
||||
/*
|
||||
Example configuration:
|
||||
Example configuration:
|
||||
current: {
|
||||
label: 'Android SDK v2.0.0 (WIP)',
|
||||
path: 'android-2.0.0',
|
||||
|
@ -224,7 +224,7 @@ hide_table_of_contents: false
|
|||
sidebar_label: Markdown
|
||||
sidebar_position: 3
|
||||
pagination_label: Markdown features
|
||||
custom_edit_url: https://github.com/facebook/docusaurus/edit/master/docs/api-doc-markdown.md
|
||||
custom_edit_url: https://github.com/facebook/docusaurus/edit/main/docs/api-doc-markdown.md
|
||||
description: How do I find you when I cannot solve this problem
|
||||
keywords:
|
||||
- docs
|
||||
|
|
|
@ -127,8 +127,8 @@ Optional parameters, also set as environment variables:
|
|||
| Name | Description |
|
||||
| --- | --- |
|
||||
| `USE_SSH` | Set to `true` to use SSH instead of the default HTTPS for the connection to the GitHub repo. |
|
||||
| `DEPLOYMENT_BRANCH` | The branch that the website will be deployed to, defaults to `gh-pages` for normal repos and `master` for repository names ending in `github.io`. |
|
||||
| `CURRENT_BRANCH` | The branch that contains the latest docs changes that will be deployed. Usually, the branch will be `master`, but it could be any branch (default or otherwise) except for `gh-pages`. If nothing is set for this variable, then the current branch will be used. |
|
||||
| `DEPLOYMENT_BRANCH` | The branch that the website will be deployed to, defaults to `gh-pages`. For GitHub Pages Organization repos (`config.projectName` ending in `github.io`), this env variable is required. |
|
||||
| `CURRENT_BRANCH` | The branch that contains the latest docs changes that will be deployed. Usually, the branch will be `main`, but it could be any branch (default or otherwise) except for `gh-pages`. If nothing is set for this variable, then the current branch will be used. |
|
||||
| `GIT_PASS` | Password (or token) of the `git` user (specified by `GIT_USER`). For example, to facilitate non-interactive deployment (e.g. continuous deployment) |
|
||||
|
||||
GitHub enterprise installations should work in the same manner as github.com; you only need to set the organization's GitHub Enterprise host as an environment variable:
|
||||
|
@ -269,7 +269,7 @@ node_js:
|
|||
- '10'
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- main
|
||||
cache:
|
||||
yarn: true
|
||||
script:
|
||||
|
@ -279,7 +279,7 @@ script:
|
|||
- yarn && GIT_USER="${GH_NAME}" yarn deploy
|
||||
```
|
||||
|
||||
Now, whenever a new commit lands in `master`, Travis CI will run your suite of tests and if everything passes, your website will be deployed via the `yarn deploy` script.
|
||||
Now, whenever a new commit lands in `main`, Travis CI will run your suite of tests and if everything passes, your website will be deployed via the `yarn deploy` script.
|
||||
|
||||
### Triggering deployment with Buddy {#triggering-deployment-with-buddy}
|
||||
|
||||
|
@ -312,7 +312,7 @@ After creating this simple pipeline, each new commit pushed to the branch you se
|
|||
|
||||
```yaml title="azure-pipelines.yml"
|
||||
trigger:
|
||||
- master
|
||||
- main
|
||||
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
|
@ -329,7 +329,7 @@ steps:
|
|||
- script: |
|
||||
git config --global user.name "${GH_NAME}"
|
||||
git config --global user.email "${GH_EMAIL}"
|
||||
git checkout -b master
|
||||
git checkout -b main
|
||||
echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc
|
||||
yarn && GIT_USER="${GH_NAME}" yarn deploy
|
||||
env:
|
||||
|
@ -394,7 +394,7 @@ While you set up the site, specify the build commands and directories as follows
|
|||
|
||||
If you did not configure these build options, you may still go to "Site settings" -> "Build and deploy" after your site is created.
|
||||
|
||||
Once properly configured with the above options, your site should deploy and automatically redeploy upon merging to your deploy branch, which defaults to `master`.
|
||||
Once properly configured with the above options, your site should deploy and automatically redeploy upon merging to your deploy branch, which defaults to `main`.
|
||||
|
||||
:::warning
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ To better understand how versioning works and see if it suits your needs, you ca
|
|||
|
||||
```shell
|
||||
website
|
||||
├── sidebars.json # sidebar for master (next) version
|
||||
├── docs # docs directory for master (next) version
|
||||
├── sidebars.json # sidebar for the current docs version
|
||||
├── docs # docs directory for the current docs version
|
||||
│ ├── foo
|
||||
│ │ └── bar.md # https://mysite.com/docs/next/foo/bar
|
||||
│ └── hello.md # https://mysite.com/docs/next/hello
|
||||
|
@ -48,11 +48,19 @@ The table below explains how a versioned file maps to its version and the genera
|
|||
| --------------------------------------- | -------------- | ----------------- |
|
||||
| `versioned_docs/version-1.0.0/hello.md` | 1.0.0 | /docs/1.0.0/hello |
|
||||
| `versioned_docs/version-1.1.0/hello.md` | 1.1.0 (latest) | /docs/hello |
|
||||
| `docs/hello.md` | next | /docs/next/hello |
|
||||
| `docs/hello.md` | current | /docs/next/hello |
|
||||
|
||||
:::tip
|
||||
|
||||
The files in the `docs` directory belong to the `current` docs version.
|
||||
|
||||
By default, the `current` docs version is labelled as `Next` and hosted under `/docs/next/*`, but is entirely configurable to fit your project's release lifecycle.
|
||||
|
||||
:::
|
||||
|
||||
### Tagging a new version {#tagging-a-new-version}
|
||||
|
||||
1. First, make sure your content in the `docs` directory is ready to be frozen as a version. A version always should be based from master.
|
||||
1. First, make sure the current docs version (the `docs` directory) is ready to be frozen.
|
||||
1. Enter a new version number.
|
||||
|
||||
```bash npm2yarn
|
||||
|
@ -72,7 +80,7 @@ When tagging a new version, the document versioning mechanism will:
|
|||
1. Place the new file into the corresponding version folder.
|
||||
1. Include the reference for the new file into the corresponding sidebar file, according to version number.
|
||||
|
||||
**Master docs**
|
||||
**Current version docs**
|
||||
|
||||
```shell
|
||||
# The new file.
|
||||
|
@ -82,7 +90,7 @@ docs/new.md
|
|||
sidebar.js
|
||||
```
|
||||
|
||||
**Older docs**
|
||||
**Older version docs**
|
||||
|
||||
```shell
|
||||
# The new file.
|
||||
|
|
|
@ -484,7 +484,7 @@ module.exports = {
|
|||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
// Link to Github for English docs
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${versionDocsDirPath}/${docPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${versionDocsDirPath}/${docPath}`;
|
||||
},
|
||||
// highlight-end
|
||||
},
|
||||
|
@ -494,7 +494,7 @@ module.exports = {
|
|||
if (locale !== DefaultLocale) {
|
||||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${blogDirPath}/${blogPath}`;
|
||||
},
|
||||
// highlight-start
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ The goals of the Docusaurus i18n system are:
|
|||
- **Easy to use with [Crowdin](https://crowdin.com/)**: multiple Docusaurus v1 sites use Crowdin, and should be able to migrate to v2
|
||||
- **Good SEO defaults**: we set useful SEO headers like [`hreflang`](https://developers.google.com/search/docs/advanced/crawling/localized-versions) for you
|
||||
- **RTL support**: locales reading right-to-left (Arabic, Hebrew, etc.) are supported and easy to implement
|
||||
- **Default translations**: classic theme labels are translated for you in [many languages](https://github.com/facebook/docusaurus/tree/master/packages/docusaurus-theme-classic/codeTranslations)
|
||||
- **Default translations**: classic theme labels are translated for you in [many languages](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-classic/codeTranslations)
|
||||
|
||||
### i18n non-goals {#i18n-non-goals}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ This tutorial will walk you through the basis of the **Docusaurus i18n system**.
|
|||
|
||||
We will add **French** translations to a **newly initialized English Docusaurus website**.
|
||||
|
||||
Initialize a new site with `npx @docusaurus/init@latest init website classic` (like [this one](https://github.com/facebook/docusaurus/tree/master/examples/classic)).
|
||||
Initialize a new site with `npx @docusaurus/init@latest init website classic` (like [this one](https://github.com/facebook/docusaurus/tree/main/examples/classic)).
|
||||
|
||||
## Configure your site {#configure-your-site}
|
||||
|
||||
|
@ -64,7 +64,7 @@ We haven't provided any translation, and the site is **mostly untranslated**.
|
|||
|
||||
Docusaurus provides **default translations** for generic theme labels, such as "Next" and "Previous" for the pagination.
|
||||
|
||||
Please help us complete those **[default translations](https://github.com/facebook/docusaurus/tree/master/packages/docusaurus-theme-classic/codeTranslations)**.
|
||||
Please help us complete those **[default translations](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-classic/codeTranslations)**.
|
||||
|
||||
:::
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ id: installation
|
|||
title: Installation
|
||||
---
|
||||
|
||||
Docusaurus is essentially a set of npm [packages](https://github.com/facebook/docusaurus/tree/master/packages).
|
||||
Docusaurus is essentially a set of npm [packages](https://github.com/facebook/docusaurus/tree/main/packages).
|
||||
|
||||
:::tip
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ yarn-error.log*
|
|||
|
||||
### `README` {#readme}
|
||||
|
||||
The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/master/packages/docusaurus-init/templates/classic/README.md).
|
||||
The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-init/templates/classic/README.md).
|
||||
|
||||
## Site configurations {#site-configurations}
|
||||
|
||||
|
@ -154,7 +154,7 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
We recommend moving the `docs` folder into the `website` folder and that is also the default directory structure in v2. [Now](https://zeit.co/now) supports [Docusaurus project deployments out-of-the-box](https://github.com/zeit/now-examples/tree/master/docusaurus) if the `docs` directory is within the `website`. It is also generally better for the docs to be within the website so that the docs and the rest of the website code are co-located within one `website` directory.
|
||||
We recommend moving the `docs` folder into the `website` folder and that is also the default directory structure in v2. [Vercel](https://vercel.com) supports [Docusaurus project deployments out-of-the-box](https://github.com/vercel/vercel/tree/main/examples/docusaurus) if the `docs` directory is within the `website`. It is also generally better for the docs to be within the website so that the docs and the rest of the website code are co-located within one `website` directory.
|
||||
|
||||
If you are migrating your Docusaurus v1 website, and there are pending documentation pull requests, you can temporarily keep the `/docs` folder to its original place, to avoid producing conflicts.
|
||||
|
||||
|
@ -344,7 +344,7 @@ module.exports = {
|
|||
// Equivalent to `customDocsPath`.
|
||||
path: 'docs',
|
||||
// Equivalent to `editUrl` but should point to `website` dir instead of `website/docs`.
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website',
|
||||
// Equivalent to `docsUrl`.
|
||||
routeBasePath: 'docs',
|
||||
// Remark and Rehype plugins passed to MDX. Replaces `markdownOptions` and `markdownPlugins`.
|
||||
|
@ -553,8 +553,8 @@ export default MyPage;
|
|||
|
||||
The following code could be helpful for migration of various pages:
|
||||
|
||||
- Index page - [Flux](https://github.com/facebook/flux/blob/master/website/src/pages/index.js/) (recommended), [Docusaurus 2](https://github.com/facebook/docusaurus/blob/master/website/src/pages/index.js/), [Hermes](https://github.com/facebook/hermes/blob/master/website/src/pages/index.js/)
|
||||
- Help/Support page - [Docusaurus 2](https://github.com/facebook/docusaurus/blob/master/website/src/pages/help.js/), [Flux](http://facebook.github.io/flux/support)
|
||||
- Index page - [Flux](https://github.com/facebook/flux/blob/master/website/src/pages/index.js/) (recommended), [Docusaurus 2](https://github.com/facebook/docusaurus/blob/main/website/src/pages/index.js/), [Hermes](https://github.com/facebook/hermes/blob/main/website/src/pages/index.js/)
|
||||
- Help/Support page - [Docusaurus 2](https://github.com/facebook/docusaurus/blob/main/website/src/pages/help.js/), [Flux](http://facebook.github.io/flux/support)
|
||||
|
||||
## Content {#content}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ This workflow has not been tested in practice, please report us how good it is.
|
|||
|
||||
This way, you wouldn't need to create a new Crowdin project, transfer the translation memory, apply pre-translations, and try to fix the pre-translations errors.
|
||||
|
||||
You could create a Crowdin branch for Docusaurus v2, where you upload the v2 sources, and merge the Crowdin branch to master once ready.
|
||||
You could create a Crowdin branch for Docusaurus v2, where you upload the v2 sources, and merge the Crowdin branch to main once ready.
|
||||
|
||||
### Use Git instead of Crowdin {#use-git-instead-of-crowdin}
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@ module.exports = {
|
|||
* Base url to edit your site.
|
||||
* Docusaurus will compute the final editUrl with "editUrl + relativeDocPath"
|
||||
*/
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
/**
|
||||
* For advanced cases, compute the edit url for each Markdown file yourself.
|
||||
*/
|
||||
editUrl: ({locale, blogDirPath, blogPath, permalink}) => {
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${blogDirPath}/${blogPath}`;
|
||||
},
|
||||
/**
|
||||
* Useful if you commit localized files to git.
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = {
|
|||
* Docusaurus will compute the final editUrl with "editUrl + relativeDocPath"
|
||||
* Omitting this variable entirely will disable edit links.
|
||||
*/
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
|
||||
/**
|
||||
* For advanced cases, compute the edit url for each Markdown file yourself.
|
||||
*/
|
||||
|
@ -46,7 +46,7 @@ module.exports = {
|
|||
docPath,
|
||||
permalink,
|
||||
}) {
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${versionDocsDirPath}/${docPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${versionDocsDirPath}/${docPath}`;
|
||||
},
|
||||
/**
|
||||
* Useful if you commit localized files to git.
|
||||
|
@ -191,7 +191,7 @@ module.exports = {
|
|||
*/
|
||||
versions: {
|
||||
/*
|
||||
Example configuration:
|
||||
Example configuration:
|
||||
current: {
|
||||
label: 'Android SDK v2.0.0 (WIP)',
|
||||
path: 'android-2.0.0',
|
||||
|
@ -244,7 +244,7 @@ hide_table_of_contents: false
|
|||
sidebar_label: Markdown
|
||||
sidebar_position: 3
|
||||
pagination_label: Markdown features
|
||||
custom_edit_url: https://github.com/facebook/docusaurus/edit/master/docs/api-doc-markdown.md
|
||||
custom_edit_url: https://github.com/facebook/docusaurus/edit/main/docs/api-doc-markdown.md
|
||||
description: How do I find you when I cannot solve this problem
|
||||
keywords:
|
||||
- docs
|
||||
|
|
|
@ -127,8 +127,8 @@ Optional parameters, also set as environment variables:
|
|||
| Name | Description |
|
||||
| --- | --- |
|
||||
| `USE_SSH` | Set to `true` to use SSH instead of the default HTTPS for the connection to the GitHub repo. |
|
||||
| `DEPLOYMENT_BRANCH` | The branch that the website will be deployed to, defaults to `gh-pages` for normal repos and `master` for repository names ending in `github.io`. |
|
||||
| `CURRENT_BRANCH` | The branch that contains the latest docs changes that will be deployed. Usually, the branch will be `master`, but it could be any branch (default or otherwise) except for `gh-pages`. If nothing is set for this variable, then the current branch will be used. |
|
||||
| `DEPLOYMENT_BRANCH` | The branch that the website will be deployed to, defaults to `gh-pages`. For GitHub Pages Organization repos (`config.projectName` ending in `github.io`), this env variable is required. |
|
||||
| `CURRENT_BRANCH` | The branch that contains the latest docs changes that will be deployed. Usually, the branch will be `main`, but it could be any branch (default or otherwise) except for `gh-pages`. If nothing is set for this variable, then the current branch will be used. |
|
||||
| `GIT_PASS` | Password (or token) of the `git` user (specified by `GIT_USER`). For example, to facilitate non-interactive deployment (e.g. continuous deployment) |
|
||||
|
||||
GitHub enterprise installations should work in the same manner as github.com; you only need to set the organization's GitHub Enterprise host as an environment variable:
|
||||
|
@ -269,7 +269,7 @@ node_js:
|
|||
- '10'
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- main
|
||||
cache:
|
||||
yarn: true
|
||||
script:
|
||||
|
@ -279,7 +279,7 @@ script:
|
|||
- yarn && GIT_USER="${GH_NAME}" yarn deploy
|
||||
```
|
||||
|
||||
Now, whenever a new commit lands in `master`, Travis CI will run your suite of tests and if everything passes, your website will be deployed via the `yarn deploy` script.
|
||||
Now, whenever a new commit lands in `main`, Travis CI will run your suite of tests and if everything passes, your website will be deployed via the `yarn deploy` script.
|
||||
|
||||
### Triggering deployment with Buddy {#triggering-deployment-with-buddy}
|
||||
|
||||
|
@ -312,7 +312,7 @@ After creating this simple pipeline, each new commit pushed to the branch you se
|
|||
|
||||
```yaml title="azure-pipelines.yml"
|
||||
trigger:
|
||||
- master
|
||||
- main
|
||||
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
|
@ -329,7 +329,7 @@ steps:
|
|||
- script: |
|
||||
git config --global user.name "${GH_NAME}"
|
||||
git config --global user.email "${GH_EMAIL}"
|
||||
git checkout -b master
|
||||
git checkout -b main
|
||||
echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc
|
||||
yarn && GIT_USER="${GH_NAME}" yarn deploy
|
||||
env:
|
||||
|
@ -394,7 +394,7 @@ While you set up the site, specify the build commands and directories as follows
|
|||
|
||||
If you did not configure these build options, you may still go to "Site settings" -> "Build and deploy" after your site is created.
|
||||
|
||||
Once properly configured with the above options, your site should deploy and automatically redeploy upon merging to your deploy branch, which defaults to `master`.
|
||||
Once properly configured with the above options, your site should deploy and automatically redeploy upon merging to your deploy branch, which defaults to `main`.
|
||||
|
||||
:::warning
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ To better understand how versioning works and see if it suits your needs, you ca
|
|||
|
||||
```shell
|
||||
website
|
||||
├── sidebars.json # sidebar for master (next) version
|
||||
├── docs # docs directory for master (next) version
|
||||
├── sidebars.json # sidebar for the current docs version
|
||||
├── docs # docs directory for the current docs version
|
||||
│ ├── foo
|
||||
│ │ └── bar.md # https://mysite.com/docs/next/foo/bar
|
||||
│ └── hello.md # https://mysite.com/docs/next/hello
|
||||
|
@ -48,11 +48,19 @@ The table below explains how a versioned file maps to its version and the genera
|
|||
| --------------------------------------- | -------------- | ----------------- |
|
||||
| `versioned_docs/version-1.0.0/hello.md` | 1.0.0 | /docs/1.0.0/hello |
|
||||
| `versioned_docs/version-1.1.0/hello.md` | 1.1.0 (latest) | /docs/hello |
|
||||
| `docs/hello.md` | next | /docs/next/hello |
|
||||
| `docs/hello.md` | current | /docs/next/hello |
|
||||
|
||||
:::tip
|
||||
|
||||
The files in the `docs` directory belong to the `current` docs version.
|
||||
|
||||
By default, the `current` docs version is labelled as `Next` and hosted under `/docs/next/*`, but is entirely configurable to fit your project's release lifecycle.
|
||||
|
||||
:::
|
||||
|
||||
### Tagging a new version {#tagging-a-new-version}
|
||||
|
||||
1. First, make sure your content in the `docs` directory is ready to be frozen as a version. A version always should be based from master.
|
||||
1. First, make sure the current docs version (the `docs` directory) is ready to be frozen.
|
||||
1. Enter a new version number.
|
||||
|
||||
```bash npm2yarn
|
||||
|
@ -72,7 +80,7 @@ When tagging a new version, the document versioning mechanism will:
|
|||
1. Place the new file into the corresponding version folder.
|
||||
1. Include the reference for the new file into the corresponding sidebar file, according to version number.
|
||||
|
||||
**Master docs**
|
||||
**Current version docs**
|
||||
|
||||
```shell
|
||||
# The new file.
|
||||
|
@ -82,7 +90,7 @@ docs/new.md
|
|||
sidebar.js
|
||||
```
|
||||
|
||||
**Older docs**
|
||||
**Older version docs**
|
||||
|
||||
```shell
|
||||
# The new file.
|
||||
|
|
|
@ -484,7 +484,7 @@ module.exports = {
|
|||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
// Link to Github for English docs
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${versionDocsDirPath}/${docPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${versionDocsDirPath}/${docPath}`;
|
||||
},
|
||||
// highlight-end
|
||||
},
|
||||
|
@ -494,7 +494,7 @@ module.exports = {
|
|||
if (locale !== DefaultLocale) {
|
||||
return `https://crowdin.com/project/docusaurus-v2/${locale}`;
|
||||
}
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`;
|
||||
return `https://github.com/facebook/docusaurus/edit/main/website/${blogDirPath}/${blogPath}`;
|
||||
},
|
||||
// highlight-start
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ The goals of the Docusaurus i18n system are:
|
|||
- **Easy to use with [Crowdin](https://crowdin.com/)**: multiple Docusaurus v1 sites use Crowdin, and should be able to migrate to v2
|
||||
- **Good SEO defaults**: we set useful SEO headers like [`hreflang`](https://developers.google.com/search/docs/advanced/crawling/localized-versions) for you
|
||||
- **RTL support**: locales reading right-to-left (Arabic, Hebrew, etc.) are supported and easy to implement
|
||||
- **Default translations**: classic theme labels are translated for you in [many languages](https://github.com/facebook/docusaurus/tree/master/packages/docusaurus-theme-classic/codeTranslations)
|
||||
- **Default translations**: classic theme labels are translated for you in [many languages](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-classic/codeTranslations)
|
||||
|
||||
### i18n non-goals {#i18n-non-goals}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ This tutorial will walk you through the basis of the **Docusaurus i18n system**.
|
|||
|
||||
We will add **French** translations to a **newly initialized English Docusaurus website**.
|
||||
|
||||
Initialize a new site with `npx @docusaurus/init@latest init website classic` (like [this one](https://github.com/facebook/docusaurus/tree/master/examples/classic)).
|
||||
Initialize a new site with `npx @docusaurus/init@latest init website classic` (like [this one](https://github.com/facebook/docusaurus/tree/main/examples/classic)).
|
||||
|
||||
## Configure your site {#configure-your-site}
|
||||
|
||||
|
@ -64,7 +64,7 @@ We haven't provided any translation, and the site is **mostly untranslated**.
|
|||
|
||||
Docusaurus provides **default translations** for generic theme labels, such as "Next" and "Previous" for the pagination.
|
||||
|
||||
Please help us complete those **[default translations](https://github.com/facebook/docusaurus/tree/master/packages/docusaurus-theme-classic/codeTranslations)**.
|
||||
Please help us complete those **[default translations](https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-classic/codeTranslations)**.
|
||||
|
||||
:::
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ id: installation
|
|||
title: Installation
|
||||
---
|
||||
|
||||
Docusaurus is essentially a set of npm [packages](https://github.com/facebook/docusaurus/tree/master/packages).
|
||||
Docusaurus is essentially a set of npm [packages](https://github.com/facebook/docusaurus/tree/main/packages).
|
||||
|
||||
:::tip
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ yarn-error.log*
|
|||
|
||||
### `README` {#readme}
|
||||
|
||||
The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/master/packages/docusaurus-init/templates/classic/README.md).
|
||||
The D1 website may have an existing README file. You can modify it to reflect the D2 changes, or copy the default [Docusaurus v2 README](https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-init/templates/classic/README.md).
|
||||
|
||||
## Site configurations {#site-configurations}
|
||||
|
||||
|
@ -154,7 +154,7 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
We recommend moving the `docs` folder into the `website` folder and that is also the default directory structure in v2. [Now](https://zeit.co/now) supports [Docusaurus project deployments out-of-the-box](https://github.com/zeit/now-examples/tree/master/docusaurus) if the `docs` directory is within the `website`. It is also generally better for the docs to be within the website so that the docs and the rest of the website code are co-located within one `website` directory.
|
||||
We recommend moving the `docs` folder into the `website` folder and that is also the default directory structure in v2. [Vercel](https://vercel.com) supports [Docusaurus project deployments out-of-the-box](https://github.com/vercel/vercel/tree/main/examples/docusaurus) if the `docs` directory is within the `website`. It is also generally better for the docs to be within the website so that the docs and the rest of the website code are co-located within one `website` directory.
|
||||
|
||||
If you are migrating your Docusaurus v1 website, and there are pending documentation pull requests, you can temporarily keep the `/docs` folder to its original place, to avoid producing conflicts.
|
||||
|
||||
|
@ -342,7 +342,7 @@ module.exports = {
|
|||
// Equivalent to `customDocsPath`.
|
||||
path: 'docs',
|
||||
// Equivalent to `editUrl` but should point to `website` dir instead of `website/docs`.
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website',
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/main/website',
|
||||
// Equivalent to `docsUrl`.
|
||||
routeBasePath: 'docs',
|
||||
// Remark and Rehype plugins passed to MDX. Replaces `markdownOptions` and `markdownPlugins`.
|
||||
|
@ -551,8 +551,8 @@ export default MyPage;
|
|||
|
||||
The following code could be helpful for migration of various pages:
|
||||
|
||||
- Index page - [Flux](https://github.com/facebook/flux/blob/master/website/src/pages/index.js/) (recommended), [Docusaurus 2](https://github.com/facebook/docusaurus/blob/master/website/src/pages/index.js/), [Hermes](https://github.com/facebook/hermes/blob/master/website/src/pages/index.js/)
|
||||
- Help/Support page - [Docusaurus 2](https://github.com/facebook/docusaurus/blob/master/website/src/pages/help.js/), [Flux](http://facebook.github.io/flux/support)
|
||||
- Index page - [Flux](https://github.com/facebook/flux/blob/master/website/src/pages/index.js/) (recommended), [Docusaurus 2](https://github.com/facebook/docusaurus/blob/main/website/src/pages/index.js/), [Hermes](https://github.com/facebook/hermes/blob/main/website/src/pages/index.js/)
|
||||
- Help/Support page - [Docusaurus 2](https://github.com/facebook/docusaurus/blob/main/website/src/pages/help.js/), [Flux](http://facebook.github.io/flux/support)
|
||||
|
||||
## Content {#content}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ This workflow has not been tested in practice, please report us how good it is.
|
|||
|
||||
This way, you wouldn't need to create a new Crowdin project, transfer the translation memory, apply pre-translations, and try to fix the pre-translations errors.
|
||||
|
||||
You could create a Crowdin branch for Docusaurus v2, where you upload the v2 sources, and merge the Crowdin branch to master once ready.
|
||||
You could create a Crowdin branch for Docusaurus v2, where you upload the v2 sources, and merge the Crowdin branch to main once ready.
|
||||
|
||||
### Use Git instead of Crowdin {#use-git-instead-of-crowdin}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ const {Translations} = require('@crowdin/crowdin-api-client');
|
|||
Crowdin does not support concurrent "project builds" (downloads of translations).
|
||||
The Crowdin CLI fails with error 409, and it leads to failures on Netlify.
|
||||
|
||||
On Docusaurus, when we commit on master, we have 2 Netlify deployments triggered:
|
||||
On Docusaurus, when we commit on main, we have 2 Netlify deployments triggered:
|
||||
- prod
|
||||
- i18n-staging (work-in-progress locales)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue