Skip to content

Commit 37067d7

Browse files
committed
Merge branch 'master' into sam/eng-124-update-node-ipinfo-to-use-fetch-error-error-parsing-json
2 parents 42d285f + 6f0a3a3 commit 37067d7

File tree

7 files changed

+61
-35
lines changed

7 files changed

+61
-35
lines changed

.github/workflows/cd_npm.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
name: Release package to npm
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
push:
5+
tags:
6+
- "v*"
77

88
jobs:
9-
build:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-node@v3
14-
with:
15-
node-version: 16
16-
- run: npm ci
17-
- run: npm test
18-
env:
19-
IPINFO_TOKEN: ${{secrets.IPINFO_TOKEN}}
20-
publish:
21-
needs: build
22-
runs-on: ubuntu-latest
23-
steps:
24-
- uses: actions/checkout@v3
25-
- uses: actions/setup-node@v3
26-
with:
27-
node-version: 16
28-
registry-url: https://registry.npmjs.org/
29-
- run: npm ci
30-
- run: npm run build
31-
- run: npm publish
32-
env:
33-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 16
16+
- run: npm ci
17+
- run: npm test
18+
env:
19+
IPINFO_TOKEN: ${{secrets.IPINFO_TOKEN}}
20+
publish:
21+
needs: build
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
- uses: actions/setup-node@v3
26+
with:
27+
node-version: 16
28+
registry-url: https://registry.npmjs.org/
29+
- run: npm ci
30+
- run: npm run build
31+
- run: npm publish
32+
env:
33+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/lint.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Lint Code"
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: "latest"
16+
- run: npm ci
17+
- run: npx prettier . --check

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/*.md
2+
config/**/*
3+
package-lock.json

.prettierrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module.exports = {
88
jsxSingleQuote: false,
99
trailingComma: "none",
1010
bracketSpacing: true,
11-
jsxBracketSameLine: false,
1211
arrowParens: "always",
1312
rangeStart: 0,
1413
rangeEnd: Infinity,

__tests__/ipinfoWrapper.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ describe("IPinfoWrapper", () => {
2424
expect(data.countryCode).toEqual("US");
2525
expect(data.countryFlag.emoji).toEqual("🇺🇸");
2626
expect(data.countryFlag.unicode).toEqual("U+1F1FA U+1F1F8");
27-
expect(data.countryFlagURL).toEqual("https://cdn.ipinfo.io/static/images/countries-flags/US.svg");
27+
expect(data.countryFlagURL).toEqual(
28+
"https://cdn.ipinfo.io/static/images/countries-flags/US.svg"
29+
);
2830
expect(data.countryCurrency.code).toEqual("USD");
2931
expect(data.countryCurrency.symbol).toEqual("$");
3032
expect(data.continent.code).toEqual("NA");
@@ -152,7 +154,7 @@ describe("IPinfoWrapper", () => {
152154
"safermoto.com",
153155
"progeni.com",
154156
"grahamhostedservices.com",
155-
"bhcentral.tech",
157+
"bhcentral.tech"
156158
]
157159
},
158160
countryCode: "ID"

test-app/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ let { IPinfoWrapper, LruCache } = require("node-ipinfo");
22

33
let cacheOptions = {
44
max: 5000,
5-
ttl: 24 * 1000 * 60 * 60,
5+
ttl: 24 * 1000 * 60 * 60
66
};
77
let cache = new LruCache(cacheOptions);
88

9-
let token = process.env.IPINFO_TOKEN
9+
let token = process.env.IPINFO_TOKEN;
1010
let ipinfo = new IPinfoWrapper(token, cache);
1111

1212
ipinfo.lookupIp("1.1.1.1").then((response) => {

test-app/ipinfo.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import IPinfoWrapper, { LruCache, Options, IPinfo, AsnResponse } from "node-ipinfo";
1+
import IPinfoWrapper, {
2+
LruCache,
3+
Options,
4+
IPinfo,
5+
AsnResponse
6+
} from "node-ipinfo";
27

38
const cacheOptions: Options<string, any> = {
49
max: 5000,
5-
ttl: 24 * 1000 * 60 * 60,
10+
ttl: 24 * 1000 * 60 * 60
611
};
712
const cache = new LruCache(cacheOptions);
813

0 commit comments

Comments
 (0)