-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tierney Cyren <[email protected]>
- Loading branch information
Showing
7 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License Copyright (c) 2022 Tierney Cyren | ||
|
||
Permission is hereby granted, free | ||
of charge, to any person obtaining a copy of this software and associated | ||
documentation files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, copy, modify, merge, | ||
publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to the | ||
following conditions: | ||
|
||
The above copyright notice and this permission notice | ||
(including the next paragraph) shall be included in all copies or substantial | ||
portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF | ||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO | ||
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# @nodevu/newest | ||
|
||
A module that returns newest LTS or Security release of a given Node.js release line. | ||
|
||
## Usage | ||
|
||
```js | ||
const { newest } = require('@nodevu/newest') | ||
|
||
const newestLts = newest('v16', 'lts') | ||
const newestSecurity = newest('v16', 'security') | ||
``` | ||
|
||
```js | ||
const { lts, security } = require('@nodevu/newest') | ||
|
||
const newestLts = lts('v16') | ||
const newestSecurity = security('v16') | ||
``` | ||
|
||
## API | ||
|
||
This module exports three functions: | ||
|
||
- `newest(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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.6.1/schema.json", | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "single" | ||
} | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const nodevu = require('@nodevu/core'); | ||
|
||
async function newest(name, type) { | ||
const data = await nodevu(); | ||
|
||
if (type === 'lts') { | ||
return data[name].support.lts.newest; | ||
} | ||
|
||
if (type === 'security') { | ||
return data[name].security.newest; | ||
} | ||
} | ||
|
||
async function lts(name) { | ||
return await newest(name, 'lts'); | ||
} | ||
|
||
async function security(name) { | ||
return await newest(name, 'security'); | ||
} | ||
|
||
module.exports.newest = newest; | ||
module.exports.lts = lts; | ||
module.exports.security = security; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "@nodevu/newest", | ||
"version": "0.1.0", | ||
"description": "a module that returns the newest lts or security release of the release line passed.", | ||
"main": "index.js", | ||
"files": ["index.js", "LICENSE"], | ||
"scripts": { | ||
"lint": "biome check ./", | ||
"lint:write": "biome check ./ --write", | ||
"test": "node --test", | ||
"coverage": "c8 node --test", | ||
"updates:check": "npx npm-check-updates", | ||
"updates:update": "npx npm-check-updates -u" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/cutenode/nodevu.git" | ||
}, | ||
"keywords": ["node.js", "versions"], | ||
"author": "Tierney Cyren <[email protected]> (https://bnb.im/)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/cutenode/nodevu/issues" | ||
}, | ||
"homepage": "https://github.com/cutenode/nodevu#readme", | ||
"dependencies": { | ||
"@nodevu/core": "^0.3.0" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "1.9.4", | ||
"c8": "^10.1.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const assert = require('node:assert'); | ||
const { newest, lts, security } = require('../index'); | ||
const { describe, it } = require('node:test'); | ||
|
||
describe('check v10', async () => { | ||
describe('running newest', async () => { | ||
it('should return the correct security version for v10', async () => { | ||
const data = await newest('v10', 'security'); | ||
assert.equal(data, '10.24.1'); | ||
}); | ||
|
||
it('should return the correct lts version for v10', async () => { | ||
const data = await newest('v10', 'lts'); | ||
assert.equal(data, '10.24.1'); | ||
}); | ||
}); | ||
|
||
describe('running security', async () => { | ||
it('should return the correct security version for v10', async () => { | ||
const data = await security('v10'); | ||
assert.equal(data, '10.24.1'); | ||
}); | ||
}); | ||
|
||
describe('running lts', async () => { | ||
it('should return the correct lts version for v10', async () => { | ||
const data = await lts('v10'); | ||
assert.equal(data, '10.24.1'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
"static", | ||
"parsefiles", | ||
"earliest", | ||
"newest", | ||
"ranges", | ||
"aliases", | ||
"translate" | ||
|