Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 146773a

Browse files
committed
chore: Merge branch 'dev'
2 parents c3856e1 + 085605b commit 146773a

File tree

3 files changed

+81
-33
lines changed

3 files changed

+81
-33
lines changed

services/github_api/client.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,16 @@ const jsonOptions = {
2424
// graphql client
2525
export const graphqlClient = makeGithubExplore(graphqlEndpoint, token)
2626

27-
export const restClient = (api, fmt = 'json') => {
28-
if (fmt === 'json') {
29-
return fetch(`${api}`, jsonOptions).then(r => r.json())
27+
export const restClient = (api, fmt = 'default') => {
28+
switch (fmt) {
29+
case 'json': {
30+
return fetch(`${api}`, jsonOptions).then(r => r.json())
31+
}
32+
case 'raw': {
33+
return fetch(`${api}`, rawOptions).then(r => r.text())
34+
}
35+
default: {
36+
return fetch(`${api}`).then(r => r.text())
37+
}
3038
}
31-
32-
return fetch(`${api}`, rawOptions).then(r => r.text())
3339
}

services/github_api/repo_search.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,21 @@ const contributorsQuery = (owner, name) => {
1414
const path = 'contributors?page=1&per_page=8'
1515
const api = `${restEndpoint}/repos/${owner}/${name}/${path}`
1616

17-
return restClient(`${api}`)
17+
return restClient(`${api}`, 'json')
1818
}
1919

2020
const readmeQuery = (owner, name) => {
2121
return restClient(`${restEndpoint}/repos/${owner}/${name}/readme`, 'raw')
2222
}
2323

24+
/**
25+
* @param {string} owner: repo owner
26+
* @param {string} name: repo name
27+
*
28+
* NOTE: use readmeQuery for readme instead of graphql is readme
29+
* has a lots of ext, like readme.md | readme.markdown ...
30+
*
31+
*/
2432
export const searchRepoPromise = (owner, name) =>
2533
Promise.all([
2634
timeout(baseInfoQuery(owner, name), TIMEOUT_SEC),

yarn.lock

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@
294294
"@babel/plugin-proposal-decorators@^7.4.4":
295295
version "7.4.4"
296296
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.4.4.tgz#de9b2a1a8ab0196f378e2a82f10b6e2a36f21cc0"
297-
integrity sha512-z7MpQz3XC/iQJWXH9y+MaWcLPNSMY9RQSthrLzak8R8hCj0fuyNk+Dzi9kfNe/JxxlWQ2g7wkABbgWjW36MTcw==
298297
dependencies:
299298
"@babel/helper-create-class-features-plugin" "^7.4.4"
300299
"@babel/helper-plugin-utils" "^7.0.0"
@@ -991,6 +990,10 @@
991990
dependencies:
992991
"@f/map-obj" "^1.2.2"
993992

993+
"@formatjs/intl-relativetimeformat@^2.5.0":
994+
version "2.5.2"
995+
resolved "https://registry.npmjs.org/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-2.5.2.tgz#4d00198b411688a2ee128a7df92ddb3b741779d6"
996+
994997
"@groupher/eslint-config-web@1.1.1":
995998
version "1.1.1"
996999
resolved "https://registry.npmjs.org/@groupher/eslint-config-web/-/eslint-config-web-1.1.1.tgz#69372fedc3d68560546f1618f973483b3d0cd413"
@@ -1237,6 +1240,17 @@
12371240
dependencies:
12381241
"@babel/types" "^7.3.0"
12391242

1243+
"@types/hoist-non-react-statics@^3.3.1":
1244+
version "3.3.1"
1245+
resolved "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f"
1246+
dependencies:
1247+
"@types/react" "*"
1248+
hoist-non-react-statics "^3.3.0"
1249+
1250+
"@types/invariant@^2.2.30":
1251+
version "2.2.30"
1252+
resolved "https://registry.npmjs.org/@types/invariant/-/invariant-2.2.30.tgz#20efa342807606ada5483731a8137cb1561e5fe9"
1253+
12401254
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
12411255
version "2.0.1"
12421256
resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
@@ -1298,6 +1312,13 @@
12981312
"@types/prop-types" "*"
12991313
csstype "^2.2.0"
13001314

1315+
"@types/react@^16.0.0":
1316+
version "16.8.24"
1317+
resolved "https://registry.npmjs.org/@types/react/-/react-16.8.24.tgz#8d1ea1fcbfa214220da3d3c04e506f1077b0deac"
1318+
dependencies:
1319+
"@types/prop-types" "*"
1320+
csstype "^2.2.0"
1321+
13011322
"@types/stack-trace@0.0.29":
13021323
version "0.0.29"
13031324
resolved "https://registry.npmjs.org/@types/stack-trace/-/stack-trace-0.0.29.tgz#eb7a7c60098edb35630ed900742a5ecb20cfcb4d"
@@ -5170,7 +5191,6 @@ fs-extra@5.0.0:
51705191
fs-extra@8.1.0, fs-extra@^8.0.1:
51715192
version "8.1.0"
51725193
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
5173-
integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==
51745194
dependencies:
51755195
graceful-fs "^4.2.0"
51765196
jsonfile "^4.0.0"
@@ -5704,7 +5724,7 @@ hoek@6.x.x:
57045724
version "6.1.3"
57055725
resolved "https://registry.npmjs.org/hoek/-/hoek-6.1.3.tgz#73b7d33952e01fe27a38b0457294b79dd8da242c"
57065726

5707-
hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.5:
5727+
hoist-non-react-statics@^2.3.1:
57085728
version "2.5.5"
57095729
resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47"
57105730

@@ -6037,29 +6057,28 @@ intersperse@^1.0.0:
60376057
version "1.0.0"
60386058
resolved "https://registry.npmjs.org/intersperse/-/intersperse-1.0.0.tgz#f2561fb1cfef9f5277cc3347a22886b4351a5181"
60396059

6040-
intl-format-cache@^2.0.5:
6041-
version "2.2.9"
6042-
resolved "https://registry.npmjs.org/intl-format-cache/-/intl-format-cache-2.2.9.tgz#fb560de20c549cda20b569cf1ffb6dc62b5b93b4"
6060+
intl-format-cache@^4.1.4, intl-format-cache@^4.1.6:
6061+
version "4.1.6"
6062+
resolved "https://registry.npmjs.org/intl-format-cache/-/intl-format-cache-4.1.6.tgz#a1f7101f435fa06cc2fe3a968f4b393663ca92a4"
60436063

6044-
intl-messageformat-parser@1.4.0:
6045-
version "1.4.0"
6046-
resolved "https://registry.npmjs.org/intl-messageformat-parser/-/intl-messageformat-parser-1.4.0.tgz#b43d45a97468cadbe44331d74bb1e8dea44fc075"
6064+
intl-locales-supported@^1.4.2:
6065+
version "1.4.3"
6066+
resolved "https://registry.npmjs.org/intl-locales-supported/-/intl-locales-supported-1.4.3.tgz#2cbfebe94e3954350622b518b7e1d42324ff69c9"
60476067

60486068
intl-messageformat-parser@^2.1.2:
60496069
version "2.1.3"
60506070
resolved "https://registry.npmjs.org/intl-messageformat-parser/-/intl-messageformat-parser-2.1.3.tgz#c918e36a08bd7ff01349d8ea3736262c986aaeb1"
60516071

6052-
intl-messageformat@^2.0.0, intl-messageformat@^2.1.0:
6053-
version "2.2.0"
6054-
resolved "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-2.2.0.tgz#345bcd46de630b7683330c2e52177ff5eab484fc"
6055-
dependencies:
6056-
intl-messageformat-parser "1.4.0"
6072+
intl-messageformat-parser@^3.0.1, intl-messageformat-parser@^3.0.2:
6073+
version "3.0.2"
6074+
resolved "https://registry.npmjs.org/intl-messageformat-parser/-/intl-messageformat-parser-3.0.2.tgz#87d26e25c5435355174ae2b7de63eaba77a0af38"
60576075

6058-
intl-relativeformat@^2.1.0:
6059-
version "2.2.0"
6060-
resolved "https://registry.npmjs.org/intl-relativeformat/-/intl-relativeformat-2.2.0.tgz#6aca95d019ec8d30b6c5653b6629f9983ea5b6c5"
6076+
intl-messageformat@^6.0.1:
6077+
version "6.0.3"
6078+
resolved "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-6.0.3.tgz#161646e0007526c86d6700d087561b2c4249d2e3"
60616079
dependencies:
6062-
intl-messageformat "^2.0.0"
6080+
intl-format-cache "^4.1.6"
6081+
intl-messageformat-parser "^3.0.2"
60636082

60646083
intl@^1.2.5:
60656084
version "1.2.5"
@@ -9559,15 +9578,22 @@ react-highlight-words@^0.16.0:
95599578
memoize-one "^4.0.0"
95609579
prop-types "^15.5.8"
95619580

9562-
react-intl@2.8.0:
9563-
version "2.8.0"
9564-
resolved "https://registry.npmjs.org/react-intl/-/react-intl-2.8.0.tgz#20b0c1f01d1292427768aa8ec9e51ab7e36503ba"
9581+
react-intl@3.0.0:
9582+
version "3.0.0"
9583+
resolved "https://registry.npmjs.org/react-intl/-/react-intl-3.0.0.tgz#c883b8f84919800fc0ea63b877ee48ca45e4eefc"
95659584
dependencies:
9566-
hoist-non-react-statics "^2.5.5"
9567-
intl-format-cache "^2.0.5"
9568-
intl-messageformat "^2.1.0"
9569-
intl-relativeformat "^2.1.0"
9585+
"@formatjs/intl-relativetimeformat" "^2.5.0"
9586+
"@types/hoist-non-react-statics" "^3.3.1"
9587+
"@types/invariant" "^2.2.30"
9588+
"@types/react" "^16.0.0"
9589+
hoist-non-react-statics "^3.3.0"
9590+
intl-format-cache "^4.1.4"
9591+
intl-locales-supported "^1.4.2"
9592+
intl-messageformat "^6.0.1"
9593+
intl-messageformat-parser "^3.0.1"
95709594
invariant "^2.1.1"
9595+
react "^16.3.0"
9596+
shallow-equal "^1.1.0"
95719597

95729598
react-is@16.8.6, react-is@^16.6.0, react-is@^16.6.3, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6:
95739599
version "16.8.6"
@@ -9729,6 +9755,15 @@ react@16.8.1:
97299755
prop-types "^15.6.2"
97309756
scheduler "^0.13.1"
97319757

9758+
react@^16.3.0:
9759+
version "16.8.6"
9760+
resolved "https://registry.npmjs.org/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe"
9761+
dependencies:
9762+
loose-envify "^1.1.0"
9763+
object-assign "^4.1.1"
9764+
prop-types "^15.6.2"
9765+
scheduler "^0.13.6"
9766+
97329767
read-pkg-up@^1.0.1:
97339768
version "1.0.1"
97349769
resolved "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02"
@@ -10283,7 +10318,6 @@ semver@6.0.0:
1028310318
semver@6.3.0, semver@^6.0.0, semver@^6.1.2:
1028410319
version "6.3.0"
1028510320
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
10286-
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
1028710321

1028810322
semver@^6.1.1:
1028910323
version "6.2.0"
@@ -10390,7 +10424,7 @@ sha.js@^2.4.0, sha.js@^2.4.8:
1039010424
inherits "^2.0.1"
1039110425
safe-buffer "^5.0.1"
1039210426

10393-
shallow-equal@^1.0.0:
10427+
shallow-equal@^1.0.0, shallow-equal@^1.1.0:
1039410428
version "1.2.0"
1039510429
resolved "https://registry.npmjs.org/shallow-equal/-/shallow-equal-1.2.0.tgz#fd828d2029ff4e19569db7e19e535e94e2d1f5cc"
1039610430

0 commit comments

Comments
 (0)