Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: first pass at @nodevu/opt #79

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
doc: update @nodevu/opt README
Signed-off-by: Tierney Cyren <hello@bnb.im>
bnb committed Nov 19, 2024

Verified

This commit was signed with the committer’s verified signature.
baptistegrimaud Baptiste Grimaud
commit 6adc62a25bd2dac556ffdfba1af92e4c03f39361
15 changes: 7 additions & 8 deletions opt/README.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ A tool that fetches the /dist/index.json file from the Node.js website.
```js
const opt = require('@nodevu/opt')

const parsedOptions = await parser(); // returns a huge JSON object
const parsedOptions = await opt(); // returns a default set of options
```

```js
@@ -25,10 +25,9 @@ const parsedOptions = await parser(options); // returns a huge JSON object

## API
- `opt(options)`
- `options` (object): Options object.
- `fetch` (function): Fetch function. Default: `globalThis.fetch`.
- `urls` (object): URLs object.
- `index` (string): URL to fetch the index.json file from. Default: `'https://nodejs.org/dist/index.json'`.
- `schedule` (string): URL to fetch the schedule.json file from. Default: `'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json'`.
- `accept` (array): Array of strings that represent the accepted versions. Default: `['lts', 'current']`.
- Returns: Promise that resolves with the fetched `index.json` object.
- `options` (`Object`, optional): Options object.
- `fetch` (`Function`, optional): Fetch function. Default: `globalThis.fetch`.
- `urls` (`Object`, optional): URLs object.
- `index` (`String`, optional): URL to fetch the index.json file from. Default: `'https://nodejs.org/dist/index.json'`.
- `schedule` (`String`, optional): URL to fetch the schedule.json file from. Default: `'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json'`.
- Returns: `Object` with a set of default options in the structure required by `@nodevu/core`.