Skip to content

Commit

Permalink
feat: introduce @nodevu/oldest, deprecating @nodevu/earliest
Browse files Browse the repository at this point in the history
Signed-off-by: Tierney Cyren <[email protected]>
  • Loading branch information
bnb committed Nov 8, 2024
1 parent d605b2d commit eb547a5
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 47 deletions.
File renamed without changes.
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
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

0 comments on commit eb547a5

Please sign in to comment.