Skip to content

Commit b0da6cf

Browse files
committed
Update README.md
1 parent 0301cd9 commit b0da6cf

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ GITHUB_API_TOKEN_READONLY=xxxxx
4646
import { downloadFile, getRepoData, parseFiles } from 'doxdox-fetch';
4747

4848
(async () => {
49-
const data = await getRepoData('neogeek', 'pocket-sized-facade.js');
49+
const data = await getRepoData('neogeek', 'pocket-sized-facade.js', {
50+
GITHUB_API_TOKEN: process.env.GITHUB_API_TOKEN_READONLY
51+
});
5052

5153
const files = await downloadFile(
5254
'neogeek',
@@ -56,11 +58,22 @@ import { downloadFile, getRepoData, parseFiles } from 'doxdox-fetch';
5658
);
5759

5860
const jsFiles = files.filter(
59-
({ path }) => path.match(/\.js$/) && !path.match(/\.min\.js$/)
61+
({ path }) =>
62+
path.match(/\.js$/) &&
63+
!path.match(/\.min\.js$/) &&
64+
!path.match(/\.test\.js$/) &&
65+
!path.match(/^dist\//) &&
66+
!path.match(/__tests__\//)
6067
);
6168

69+
const pkgFile = files.find(({ path }) => path.match(/package\.json$/));
70+
71+
const pkgFileContents = JSON.parse(pkgFile?.content || '{}');
72+
6273
const doc = {
63-
...data,
74+
name: pkgFileContents.name || data.name,
75+
description: pkgFileContents.description || data.description,
76+
homepage: pkgFileContents.homepage || data.html_url,
6477
files: await parseFiles(jsFiles)
6578
};
6679

0 commit comments

Comments
 (0)