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: introduce oldest, deprecate earliest #77

Merged
merged 4 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "Test Suite: Linter (earliest)"
name: "Test Suite: Linter (oldest)"

on:
push:
pull_request:
paths:
- 'earliest/**'
- 'oldest/**'
branches:
- main
workflow_dispatch:
Expand All @@ -21,7 +21,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: current
- name: Run npm install -w earliest
run: npm install -w earliest
- name: Run npm run lint -w earliest
run: npm run lint -w earliest
- name: Run npm install -w oldest
run: npm install -w oldest
- name: Run npm run lint -w oldest
run: npm run lint -w oldest
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "Test Suite: @nodevu/core"
name: "Test Suite: @nodevu/oldest"

on:
pull_request:
paths:
- 'earliest/**'
- 'oldest/**'
branches:
- main
workflow_dispatch:
Expand All @@ -25,7 +25,7 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Install most recent npm
run: npm install -g npm
- name: Run npm install -w earliest
run: npm install -w earliest
- name: Run npm test -w earliest
run: npm test -w earliest
- name: Run npm install -w oldest
run: npm install -w oldest
- name: Run npm test -w oldest
run: npm test -w oldest
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ nodevu is composed of a set of modules:
* [core](./core/): this is the core, online-only module. It calls out to sources that have version information about Node.js and does the heavy lifting of coercion, merging, and reasoning about that data into a format that is easily accessible and (hopefully!) extremely useful. It transparently provides data from the sources it fetches from, but also adds additional useufl context that it figures out based on time, context, and other signals.
* [static](./static/): this is the offline-only version of nodevu. It's simply an interface to both the full context of [core](./core/), in addition to a few subsets of the data core provides. It is automatically updated when there's new information available, though there aren't gaurantees on when that will be available. This is mostly useful if you're not particularly picky about when your version information is availble.
- Additional Utilities
* [earliest](./earliest/): this is a utility for finding the earliest LTS or Security release in a Node.js release line.
* [oldest](./oldest/): this is a utility for finding the oldest LTS or Security release in a Node.js release line.
* [newest](./newest/): this is a utility for finding the newest LTS or Security release in a Node.js release line.
* [ranges](./ranges/): a module that provides information about ranges of Node.js versions.
* [aliases](./aliases/): a module that provides information about aliases for Node.js versions.
- Helper Modules
Expand Down
31 changes: 0 additions & 31 deletions earliest/README.md

This file was deleted.

File renamed without changes.
31 changes: 31 additions & 0 deletions oldest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# @nodevu/oldest

A module that returns oldest LTS or Security release of a given Node.js release line.

## Usage

```js
const { oldest } = require('@nodevu/oldest')

const oldestLts = oldest('v16', 'lts')
const oldestSecurity = oldest('v16', 'security')
```

```js
const { lts, security } = require('@nodevu/oldest')

const oldestLts = oldest('v16', 'lts')
const oldestSecurity = oldest('v16', 'security')
```

## API

This module exports three functions:

- `oldest(name, type)`
- `name` (string): Node.js release line name. Examples: `v16`, `v11`, `v8`, `v0.10`.
- `type` (string): `lts` or `security`.
- `lts(name)`
- `name` (string): Node.js release line name. Examples: `v16`, `v11`, `v8`, `v0.10`.
- `security(name)`
- `name` (string): Node.js release line name. Examples: `v16`, `v11`, `v8`, `v0.10`.
File renamed without changes.
8 changes: 4 additions & 4 deletions earliest/index.js → oldest/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const nodevu = require('@nodevu/core');

async function earliest(name, type) {
async function oldest(name, type) {
const data = await nodevu();

if (type === 'lts') {
Expand All @@ -13,13 +13,13 @@ async function earliest(name, type) {
}

async function lts(name) {
return await earliest(name, 'lts');
return await oldest(name, 'lts');
}

async function security(name) {
return await earliest(name, 'security');
return await oldest(name, 'security');
}

module.exports.earliest = earliest;
module.exports.oldest = oldest;
module.exports.lts = lts;
module.exports.security = security;
4 changes: 2 additions & 2 deletions earliest/package.json → oldest/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nodevu/earliest",
"name": "@nodevu/oldest",
"version": "0.1.0",
"description": "a module that returns the earliest lts or security release of the release line passed.",
"description": "a module that returns the oldest lts or security release of the release line passed.",
"main": "index.js",
"files": ["index.js", "LICENSE"],
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions earliest/test/test.js → oldest/test/test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const assert = require('node:assert');
const { earliest, lts, security } = require('../index');
const { oldest, lts, security } = require('../index');
const { describe, it } = require('node:test');

describe('check v10', async () => {
describe('running earliest', async () => {
describe('running oldest', async () => {
it('should return the correct security version for v10', async () => {
const data = await earliest('v10', 'security');
const data = await oldest('v10', 'security');
assert.equal(data, '10.14.0');
});

it('should return the correct lts version for v10', async () => {
const data = await earliest('v10', 'lts');
const data = await oldest('v10', 'lts');
assert.equal(data, '10.13.0');
});
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"core",
"static",
"parsefiles",
"earliest",
"oldest",
"newest",
"ranges",
"aliases",
Expand Down