Skip to content

Commit

Permalink
Fixing some mistakes
Browse files Browse the repository at this point in the history
Documenting

Adding githubPort documentation on docusaurus.config.js.

Addind SSH protocol prefix. ssh://

Using the default protocol port instead of define it on the code.

Prettify.
  • Loading branch information
talesporto authored and Tales Porto committed Apr 1, 2021
1 parent daf33fd commit cc3971d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/docusaurus-types/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface DocusaurusConfig {
organizationName?: string;
projectName?: string;
githubHost?: string;
githubPort?: string;
plugins?: PluginConfig[];
themes?: PluginConfig[];
presets?: PresetConfig[];
Expand Down
17 changes: 9 additions & 8 deletions packages/docusaurus/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,23 @@ export default async function deploy(
(projectName.indexOf('.github.io') !== -1 ? 'master' : 'gh-pages');
console.log(`${chalk.cyan('deploymentBranch:')} ${deploymentBranch}`);

const useSSH = process.env.USE_SSH;

const githubHost =
process.env.GITHUB_HOST || siteConfig.githubHost || 'github.com';
const githubPort =
process.env.GITHUB_PORT || siteConfig.githubPort || (useSSH && useSSH.toLowerCase() === 'true'
? '22'
: '433');

const useSSH = process.env.USE_SSH;
const githubPort = process.env.GITHUB_PORT || siteConfig.githubPort;

const gitPass: string | undefined = process.env.GIT_PASS;
let gitCredentials = `${gitUser}`;
if (gitPass) {
gitCredentials = `${gitCredentials}:${gitPass}`;
}

const sshRemoteBranch: string = `git@${githubHost}:${githubPort}/${organizationName}/${projectName}.git`;
const nonSshRemoteBranch: string = `https://${gitCredentials}@${githubHost}:${githubPort}/${organizationName}/${projectName}.git`;
const githubAddress = `${githubHost}${githubPort ? ':' + githubPort : ''}`;
const githubPath = `${organizationName}/${projectName}`;

const sshRemoteBranch: string = `ssh://git@${githubAddress}/${githubPath}.git`;
const nonSshRemoteBranch: string = `https://${gitCredentials}@${githubAddress}/${githubPath}.git`;

const remoteBranch =
useSSH && useSSH.toLowerCase() === 'true'
Expand Down
12 changes: 12 additions & 0 deletions website/docs/api/docusaurus.config.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,18 @@ module.exports = {
};
```

### `githubPort` {#githubPort}

- Type: `string`

The port of your server. Useful if you are using GitHub Enterprise.

```js title="docusaurus.config.js"
module.exports = {
githubPort: '22',
};
```

### `themeConfig` {#themeconfig}

- Type: `Object`
Expand Down
1 change: 1 addition & 0 deletions website/docs/deployment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ GitHub enterprise installations should work in the same manner as github.com; yo
| Name | Description |
| ------------- | ----------------------------------------------- |
| `GITHUB_HOST` | The domain name of your GitHub enterprise site. |
| `GITHUB_PORT` | The port of your GitHub enterprise site. |

### Deploy {#deploy}

Expand Down

0 comments on commit cc3971d

Please sign in to comment.