test: drop end of life Node.js version

* test: Dropped Node v13.x since it's now past it's expiration.
* test: Migrated from Travis CI to GitHub Actions.
* test: Migrated from Coveralls to CodeCov.
* docs: Dropped over 1.x stuff from the read me.
* perf: Updated dependencies and rebuilt against latest TypeScript.
* feat: Bumped major version number due to Node.js support changing.
This commit is contained in:
Josh Sherman 2020-06-08 18:19:22 -05:00
parent 2edef851ca
commit bc67f9f132
No known key found for this signature in database
GPG key ID: 55B058A80530EF22
10 changed files with 1826 additions and 1880 deletions

31
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,31 @@
name: Test
on: [push, pull_request]
jobs:
test:
name: Test Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['10', '12', '14']
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Node.js Version
run: node --version
- name: NPM Version
run: npm --version
- name: Install Dependencies
run: npm install
- name: Run Linter
run: npm run lint
- name: Run Tests
run: npm run test:coverage
- name: Upload Coverage
if: ${{ matrix.node-version == '14' }}
uses: codecov/codecov-action@v1
with:
file: ./coverage/lcov.info

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
node_modules
npm-debug.log*
coverage/

View file

@ -1,12 +0,0 @@
language: node_js
node_js:
- 8
- 10
- 12
- 13
- 14
script:
- npm run lint
- npm run test:coverage

View file

@ -2,28 +2,13 @@
[![License](https://img.shields.io/npm/l/holidayapi-node?style=for-the-badge)](https://github.com/holidayapi/holidayapi-node/blob/master/LICENSE)
![Node Version](https://img.shields.io/node/v/holidayapi?style=for-the-badge)
![Build Status](https://img.shields.io/travis/holidayapi/holidayapi-node/master?style=for-the-badge)
[![Coverage Status](https://img.shields.io/coveralls/github/holidayapi/holidayapi-node/master?style=for-the-badge)](https://coveralls.io/github/holidayapi/holidayapi-node?branch=master)
[![Test Status](https://img.shields.io/github/workflow/status/holidayapi/holidayapi-node/Test?style=for-the-badge)](https://github.com/holidayapi/holidayapi-node/actions)
[![Code Coverage](https://img.shields.io/codecov/c/github/holidayapi/holidayapi-node?style=for-the-badge)](https://codecov.io/gh/holidayapi/holidayapi-node)
Official Node.js library for [Holiday API](https://holidayapi.com) providing
quick and easy access to holiday information from applications written in
server-side JavaScript.
## Migrating from 1.x
Please note, version 2.x of this library is a full rewrite of the 1.x series in
TypeScript. The interfacing to the library has been simplified and existing
applications upgrading to 2.x will need to be updated.
| Version 1.x Syntax (Old) | Version 2.x+ Syntax (New) |
|---------------------------------------------------|---------------------------------------------------|
| `const HolidayAPI = require('node-holidayapi');` | `import { HolidayAPI } from 'holidayapi';` |
| `const holidayApi = new HolidayAPI(key).v1;` | `const holidayApi = new HolidayAPI({ key });` |
| `holidayApi.holidays(params, (err, data) => {});` | `holidayApi.holidays(params).then((data) => {});` |
Version 1.x of the library can still be found
[here](https://github.com/joshtronic/node-holidayapi).
## Documentation
Full documentation of the Holiday API endpoints is available

20
codecov.yml Normal file
View file

@ -0,0 +1,20 @@
codecov:
require_ci_to_pass: yes
coverage:
precision: 2
round: down
range: "70...100"
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no
comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no

1
dist/holidayapi.js vendored
View file

@ -47,6 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HolidayAPI = void 0;
var node_fetch_1 = require("node-fetch");
var url_1 = require("url");
var HolidayAPI = (function () {

16
dist/index.js vendored
View file

@ -1,6 +1,14 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./holidayapi"));
__exportStar(require("./types"), exports);
__exportStar(require("./holidayapi"), exports);

View file

@ -1,4 +1,5 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
coverageReporters: ['lcov'],
};

3576
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "holidayapi",
"version": "3.3.0",
"version": "4.0.0",
"description": "Official Node.js library for Holiday API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@ -21,24 +21,23 @@
},
"homepage": "https://holidayapi.com",
"engines": {
"node": ">= 8.0.0"
"node": ">= 10.0.0"
},
"devDependencies": {
"@types/jest": "^25.2.1",
"@types/jest": "^25.2.3",
"@types/nock": "^11.1.0",
"@types/node": "^13.13.4",
"@types/node": "^14.0.12",
"@types/node-fetch": "^2.5.7",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"coveralls": "^3.1.0",
"eslint": "^6.8.0",
"@typescript-eslint/eslint-plugin": "^3.2.0",
"@typescript-eslint/parser": "^3.2.0",
"eslint": "^7.2.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jest": "^23.8.2",
"jest": "^25.4.0",
"eslint-plugin-import": "^2.21.1",
"eslint-plugin-jest": "^23.13.2",
"jest": "^26.0.1",
"nock": "^12.0.3",
"ts-jest": "^25.4.0",
"typescript": "^3.7.5"
"ts-jest": "^26.1.0",
"typescript": "^3.9.5"
},
"dependencies": {
"node-fetch": "^2.6.0"
@ -47,6 +46,6 @@
"build": "tsc",
"lint": "eslint --ext .js,.ts src tests",
"test": "jest",
"test:coverage": "jest --coverage --coverageReporters=text-lcov | coveralls"
"test:coverage": "jest --coverage"
}
}