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

Add a JavaScript module for easier access to data #18

Open
nschonni opened this issue Mar 17, 2020 · 3 comments · May be fixed by #21
Open

Add a JavaScript module for easier access to data #18

nschonni opened this issue Mar 17, 2020 · 3 comments · May be fixed by #21

Comments

@nschonni
Copy link
Contributor

While looking to implement this for nodejs/i18n, I found myself looking at what Browserlist was doing, and re-implementing it.
EX:

const schedule = require(node-releases).schedule // expose the release-schedule.json object
const nodejs = require(node-releases).nodejs// expose the release-schedule.json object

Other useful functions would be to have the functions to just return active releases

@nschonni nschonni changed the title Add an JavaScript module for easier access to data Add a JavaScript module for easier access to data Mar 17, 2020
@nschonni nschonni linked a pull request Mar 18, 2020 that will close this issue
@chicoxyzzy
Copy link
Owner

I think that if we want to add JS module, we can do better and pre-generate a flat CJS/ESM modules without the need to require and parse JSON.

@nschonni
Copy link
Contributor Author

I did a placeholder example over in #21
Did you have an idea on how the generation approach would work?

@jimmywarting
Copy link
Contributor

fyi, there is also the possibility of using import type assertion
cjs is obsolete

import { schedule } from 'node-release/data.json' assert { type: 'json' }

or for the just of simplicity export a esm file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants