Skip to content

Commit 70db0ab

Browse files
committed
docs: move doc to jsdoc
1 parent b2e9fc0 commit 70db0ab

2 files changed

Lines changed: 10 additions & 26 deletions

File tree

README.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -136,31 +136,6 @@ Get modified files and modify type in a folder
136136
await getModifiedFileList(wikiFolderPath);
137137
```
138138

139-
### getRemoteUrl
140-
141-
Inspect git's remote url from folder's .git config
142-
143-
```ts
144-
export async function credentialOff(directory: string, remoteUrl?: string): Promise<void> {
145-
const githubRepoUrl = remoteUrl ?? (await getRemoteUrl(directory));
146-
const gitUrlWithOutCredential = getGitUrlWithOutCredential(githubRepoUrl);
147-
await GitProcess.exec(['remote', 'set-url', 'origin', gitUrlWithOutCredential], directory);
148-
}
149-
```
150-
151-
### getRemoteRepoName
152-
153-
get the Github Repo Name, which is similar to "linonetwo/wiki", that is the string after "https://github.com/", so we basically just get the pathname of URL.
154-
155-
### haveLocalChanges
156-
157-
See if there is any file not being committed
158-
159-
```ts
160-
if (await haveLocalChanges(dir)) {
161-
// ... do commit and push
162-
```
163-
164139
### getDefaultBranchName
165140

166141
### getSyncState

src/inspect.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ export async function getModifiedFileList(wikiFolderPath: string): Promise<Modif
6363
* Inspect git's remote url from folder's .git config
6464
* @param dir wiki folder path, git folder to inspect
6565
* @returns remote url, without `'.git'`
66+
* @example ```ts
67+
const githubRepoUrl = await getRemoteUrl(directory);
68+
const gitUrlWithOutCredential = getGitUrlWithOutCredential(githubRepoUrl);
69+
await GitProcess.exec(['remote', 'set-url', 'origin', gitUrlWithOutCredential], directory);
70+
```
6671
*/
6772
export async function getRemoteUrl(dir: string, remoteName: string): Promise<string> {
6873
const remotes = await listRemotes({ fs, dir });
@@ -74,7 +79,7 @@ export async function getRemoteUrl(dir: string, remoteName: string): Promise<str
7479
}
7580

7681
/**
77-
* get the Github Repo Name, similar to "linonetwo/wiki", string after "https://github.com/"
82+
* Get the Github Repo Name, which is similar to "linonetwo/wiki", that is the string after "https://github.com/", so we basically just get the pathname of URL.
7883
* @param remoteUrl full github repository url or other repository url
7984
* @returns
8085
*/
@@ -93,6 +98,10 @@ export function getRemoteRepoName(remoteUrl: string): string | undefined {
9398
/**
9499
* See if there is any file not being committed
95100
* @param {string} wikiFolderPath repo path to test
101+
* @example ```ts
102+
if (await haveLocalChanges(dir)) {
103+
// ... do commit and push
104+
```
96105
*/
97106
export async function haveLocalChanges(wikiFolderPath: string): Promise<boolean> {
98107
const { stdout } = await GitProcess.exec(['status', '--porcelain'], wikiFolderPath);

0 commit comments

Comments
 (0)