Skip to content

Commit b335bf1

Browse files
committed
Updated example in README.md
1 parent 12b279a commit b335bf1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,25 @@ GITHUB_API_TOKEN_READONLY=xxxxx
4242

4343
**index.js**
4444

45-
```javascript
45+
```typescript
4646
import { downloadFile, getRepoData, parseFiles } from 'doxdox-fetch';
4747

4848
import { parseString } from 'doxdox-parser-custom';
4949

50-
import { Doc } from 'doxdox-core/dist/types';
50+
import { Doc } from 'doxdox-core';
5151

5252
(async () => {
5353
const repoData = await getRepoData(username, repo, {
5454
GITHUB_API_TOKEN: process.env.GITHUB_API_TOKEN_READONLY
5555
});
5656

57-
const currentBranch =
57+
const selectedBranch =
5858
branch && [repoData.default_branch, ...repoData.tags].includes(branch)
5959
? branch
6060
: repoData.default_branch;
6161

62-
const files = await downloadFile(username, repo, currentBranch, [
63-
/.[jt]sx?$/,
62+
const files = await downloadFile(username, repo, selectedBranch, [
63+
/.[jt]s$/,
6464
/package.json$/,
6565
/\.doxdoxignore$/
6666
]);
@@ -74,7 +74,7 @@ import { Doc } from 'doxdox-core/dist/types';
7474
!path.match(/__tests__\//)
7575
);
7676

77-
const pkgFile = files.find(({ path }) => path.match(/package\.json$/));
77+
const pkgFile = files.find(({ path }) => path.match(/^package\.json$/));
7878

7979
const pkgFileContents = JSON.parse(pkgFile?.content || '{}');
8080

0 commit comments

Comments
 (0)