Skip to content

Commit cee5392

Browse files
committed
Initial commit.
0 parents  commit cee5392

File tree

12 files changed

+3383
-0
lines changed

12 files changed

+3383
-0
lines changed

.eslintrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"env": {
3+
"node": true
4+
},
5+
"parser": "@typescript-eslint/parser",
6+
"plugins": ["@typescript-eslint"],
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/eslint-recommended",
10+
"plugin:@typescript-eslint/recommended"
11+
],
12+
"rules": {
13+
"@typescript-eslint/no-explicit-any": "error",
14+
"@typescript-eslint/no-unused-vars": "error",
15+
"no-warning-comments": ["warn", { "terms": ["todo"], "location": "start" }],
16+
"no-magic-numbers": [
17+
"error",
18+
{
19+
"ignore": [-1, 0, 1]
20+
}
21+
]
22+
}
23+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
3+
dist/

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
src/
2+
3+
.eslintrc
4+
5+
.prettierignore
6+
.prettierrc
7+
8+
tsconfig.json

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

.prettierrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"arrowParens": "avoid",
3+
"singleQuote": true,
4+
"tabWidth": 4,
5+
"trailingComma": "none",
6+
"overrides": [
7+
{
8+
"files": ["*.json", ".*rc", "*.md"],
9+
"options": {
10+
"tabWidth": 2
11+
}
12+
}
13+
]
14+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022 Scott Doxey
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# doxdox-fetch
2+
3+
> Fetch utilities for doxdox server.
4+
5+
[![NPM version](https://img.shields.io/npm/v/doxdox-fetch?style=flat-square)](https://www.npmjs.org/package/doxdox-fetch)
6+
[![NPM downloads per month](https://img.shields.io/npm/dm/doxdox-fetch?style=flat-square)](https://www.npmjs.org/package/doxdox-fetch)
7+
[![doxdox documentation](https://img.shields.io/badge/doxdox-documentation-%23E85E95?style=flat-square)](https://doxdox.org)
8+
9+
## Install
10+
11+
```bash
12+
$ npm install doxdox-fetch --save
13+
```
14+
15+
## Usage
16+
17+
<https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token>
18+
19+
**.env**
20+
21+
```yaml
22+
GITHUB_API_TOKEN_READONLY=xxxxx
23+
```
24+
25+
**package.json**
26+
27+
```json
28+
{
29+
"type": "module",
30+
"dependencies": {
31+
"doxdox-fetch": "1.0.0"
32+
},
33+
"devDependencies": {
34+
"dotenv": "16.0.0"
35+
},
36+
"scripts": {
37+
"test": "node -r dotenv/config index.js"
38+
},
39+
"private": true
40+
}
41+
```
42+
43+
**index.js**
44+
45+
```javascript
46+
import { downloadFile, getRepoData, parseFiles } from 'doxdox-fetch';
47+
48+
(async () => {
49+
const data = await getRepoData('neogeek', 'pocket-sized-facade.js');
50+
51+
const files = await downloadFile(
52+
'neogeek',
53+
'pocket-sized-facade.js',
54+
data.default_branch,
55+
[/.js$/, /package.json$/, /\.doxdoxignore$/]
56+
);
57+
58+
const jsFiles = files.filter(
59+
({ path }) => path.match(/\.js$/) && !path.match(/\.min\.js$/)
60+
);
61+
62+
const doc = {
63+
...data,
64+
files: await parseFiles(jsFiles)
65+
};
66+
67+
console.log(doc);
68+
})();
69+
```

0 commit comments

Comments
 (0)