-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow GIT_USER env var to be unset if SSH is used (#5840)
* feat: allow GIT_USER env var to be unset if SSH is used * fix: packages/docusaurus/src/commands/deploy.ts Co-authored-by: Joshua Chen <sidachen2003@gmail.com> * 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 * docs: fix i18n routes to feature requests (#5843) * docs: fix i18n routes to feature requests * Add redirect rules * feat: allow GIT_USER env var to be unset if SSH is used * fix: packages/docusaurus/src/commands/deploy.ts Co-authored-by: Joshua Chen <sidachen2003@gmail.com> * fix: avoid escaping hyphen in regex * Refactor * Update deployment.mdx * Make SSH higher priority * Only infer but not override * Add tests * Fix tests * Fix Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
- Loading branch information
Showing
7 changed files
with
166 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
packages/docusaurus/src/commands/__tests__/buildRemoteBranchUrl.test.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import {buildSshUrl, buildHttpsUrl, hasSSHProtocol} from '../deploy'; | ||
|
||
describe('remoteBranchUrl', () => { | ||
test('should build a normal ssh url', () => { | ||
const url = buildSshUrl('github.com', 'facebook', 'docusaurus'); | ||
expect(url).toEqual('git@github.com:facebook/docusaurus.git'); | ||
}); | ||
test('should build a ssh url with port', () => { | ||
const url = buildSshUrl('github.com', 'facebook', 'docusaurus', '422'); | ||
expect(url).toEqual('ssh://git@github.com:422/facebook/docusaurus.git'); | ||
}); | ||
test('should build a normal http url', () => { | ||
const url = buildHttpsUrl( | ||
'user:pass', | ||
'github.com', | ||
'facebook', | ||
'docusaurus', | ||
); | ||
expect(url).toEqual('https://user:pass@github.com/facebook/docusaurus.git'); | ||
}); | ||
test('should build a normal http url', () => { | ||
const url = buildHttpsUrl( | ||
'user:pass', | ||
'github.com', | ||
'facebook', | ||
'docusaurus', | ||
'5433', | ||
); | ||
expect(url).toEqual( | ||
'https://user:pass@github.com:5433/facebook/docusaurus.git', | ||
); | ||
}); | ||
}); | ||
|
||
describe('hasSSHProtocol', () => { | ||
test('should recognize explicit SSH protocol', () => { | ||
const url = 'ssh://git@github.com:422/facebook/docusaurus.git'; | ||
expect(hasSSHProtocol(url)).toEqual(true); | ||
}); | ||
|
||
test('should recognize implied SSH protocol', () => { | ||
const url = 'git@github.com:facebook/docusaurus.git'; | ||
expect(hasSSHProtocol(url)).toEqual(true); | ||
}); | ||
|
||
test('should not recognize HTTPS with credentials', () => { | ||
const url = 'https://user:pass@github.com/facebook/docusaurus.git'; | ||
expect(hasSSHProtocol(url)).toEqual(false); | ||
}); | ||
|
||
test('should not recognize plain HTTPS URL', () => { | ||
const url = 'https://github.com:5433/facebook/docusaurus.git'; | ||
expect(hasSSHProtocol(url)).toEqual(false); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.