chicoxyzzy / node-releases

Node.js releases data
MIT License
36 stars 11 forks source link

Add a JavaScript module for easier access to data #18

Open nschonni opened 4 years ago

nschonni commented 4 years ago

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

chicoxyzzy commented 4 years ago

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 commented 4 years ago

I did a placeholder example over in https://github.com/chicoxyzzy/node-releases/pull/21 Did you have an idea on how the generation approach would work?

jimmywarting commented 1 year ago

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