mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-05 12:22:45 +02:00
feat: allow user to specify deploymentBranch property in docusaurus.config.js (#5841)
* feat: allow user to specify deploymentBranch property in docusaurus.config.js * docs: remove extra backtick * docs: fix broken code block
This commit is contained in:
parent
6ccda86e0f
commit
ca9bd244aa
6 changed files with 26 additions and 6 deletions
|
@ -109,13 +109,18 @@ This behavior can have SEO impacts and create relative link issues.
|
|||
// - Site url: https://<organization>.github.io
|
||||
const isGitHubPagesOrganizationDeploy =
|
||||
projectName.indexOf('.github.io') !== -1;
|
||||
if (isGitHubPagesOrganizationDeploy && !process.env.DEPLOYMENT_BRANCH) {
|
||||
if (
|
||||
isGitHubPagesOrganizationDeploy &&
|
||||
!process.env.DEPLOYMENT_BRANCH &&
|
||||
!siteConfig.deploymentBranch
|
||||
) {
|
||||
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`);
|
||||
Please provide the branch name to deploy to as an environment variable, for example DEPLOYMENT_BRANCH=main or DEPLOYMENT_BRANCH=master .
|
||||
You can also set the deploymentBranch property in docusaurus.config.js .`);
|
||||
}
|
||||
|
||||
const deploymentBranch = process.env.DEPLOYMENT_BRANCH || 'gh-pages';
|
||||
const deploymentBranch =
|
||||
process.env.DEPLOYMENT_BRANCH || siteConfig.deploymentBranch || 'gh-pages';
|
||||
console.log(`${chalk.cyan('deploymentBranch:')} ${deploymentBranch}`);
|
||||
|
||||
const githubHost =
|
||||
|
|
|
@ -143,6 +143,7 @@ export const ConfigSchema = Joi.object({
|
|||
.default(DEFAULT_CONFIG.onDuplicateRoutes),
|
||||
organizationName: Joi.string().allow(''),
|
||||
projectName: Joi.string().allow(''),
|
||||
deploymentBranch: Joi.string().optional(),
|
||||
customFields: Joi.object().unknown().default(DEFAULT_CONFIG.customFields),
|
||||
githubHost: Joi.string(),
|
||||
plugins: Joi.array().items(PluginSchema).default(DEFAULT_CONFIG.plugins),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue