Skip to content

Commit a7de6c0

Browse files
author
Dmitry Shirokov
authored
Merge pull request #40 from runk/maintenance
Maintenance
2 parents 6ba9211 + 7331f14 commit a7de6c0

File tree

8 files changed

+31
-42
lines changed

8 files changed

+31
-42
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ on:
44
push:
55
branches: [master]
66
pull_request:
7-
branches: ["*"]
7+
branches: ['*']
88

99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

1313
strategy:
1414
matrix:
15-
node-version: [10.x, 12.x, 14.x]
15+
node-version: [12.x, 14.x, 16.x]
1616

1717
steps:
18-
- uses: actions/checkout@v2
19-
- name: Use Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v2
21-
with:
22-
node-version: ${{ matrix.node-version }}
23-
- run: npm i
24-
env:
25-
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }}
26-
- run: npm test
18+
- uses: actions/checkout@v2
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v2
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
- run: npm i
24+
env:
25+
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }}
26+
- run: npm run format:check
27+
- run: npm test

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2020 Dmitry Shirokov
1+
Copyright 2022 Dmitry Shirokov
22

33
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:
44

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
node-geolite2
2-
========
1+
# node-geolite2
32

43
Maxmind's GeoLite2 Free Databases download helper.
54

@@ -44,7 +43,6 @@ If `selected-dbs` is unset, or is set but empty, all dbs will be downloaded.
4443
}
4544
```
4645

47-
4846
## Usage
4947

5048
```javascript

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"scripts": {
1616
"postinstall": "node scripts/postinstall.js",
1717
"test": "scripts/test",
18-
"semantic-release": "semantic-release"
18+
"semantic-release": "semantic-release",
19+
"format": "prettier --write .",
20+
"format:check": "prettier --write ."
1921
},
2022
"repository": {
2123
"type": "git",
@@ -32,6 +34,7 @@
3234
},
3335
"devDependencies": {
3436
"mocha": "^5.2.0",
37+
"prettier": "^2.6.0",
3538
"semantic-release": "^17.0.8"
3639
}
3740
}

test/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ const assert = require('assert');
22
const fs = require('fs');
33
const geolite2 = require('../');
44

5-
describe('geolite2', function() {
6-
it('should return a valid city db path', function() {
5+
describe('geolite2', function () {
6+
it('should return a valid city db path', function () {
77
var stat = fs.statSync(geolite2.paths.city);
88
assert(stat.size > 1e6);
99
assert(stat.ctime);
1010
});
1111

12-
it('should return a valid country db path', function() {
12+
it('should return a valid country db path', function () {
1313
var stat = fs.statSync(geolite2.paths.country);
1414
assert(stat.size > 1e6);
1515
assert(stat.ctime);
1616
});
1717

18-
it('should return a valid ASN db path', function() {
18+
it('should return a valid ASN db path', function () {
1919
var stat = fs.statSync(geolite2.paths.asn);
2020
assert(stat.size > 1e6);
2121
assert(stat.ctime);

utils.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ const getSelectedDbs = () => {
3939

4040
if (selected.length === 0) return valids;
4141

42-
if (selected.length > 3) {
42+
const validValuesText = valids.join(', ');
43+
if (selected.length > valids.length) {
4344
console.error(
44-
`selected-dbs has too many values, there are only three valid values: ${valids.join(', ')}.`
45+
'Property selected-dbs has too many values, there are only %d valid values: %s',
46+
valids.length,
47+
validValuesText
4548
);
4649
process.exit(1);
4750
}
@@ -50,7 +53,9 @@ const getSelectedDbs = () => {
5053
const index = valids.indexOf(value);
5154
if (index === -1) {
5255
console.error(
53-
`Invalid value in selected-dbs: ${value}. The only valid values are: ${valids.join(', ')}.`
56+
'Invalid value in selected-dbs: %s The only valid values are: %s',
57+
value,
58+
validValuesText
5459
);
5560
process.exit(1);
5661
}

0 commit comments

Comments
 (0)