Skip to content

Commit

Permalink
github-graphql.js: Fix several issues
Browse files Browse the repository at this point in the history
1. Fix bug: GraphqlClient class was instantiated
   with wrong arguments.

2. Remove redundant code: _updateRateLimit function
   is defined twice.

3. Remove script/queries/*.js files and refactor
   script/index.js.

4. Retry threshold is changed to be based on repo.

Related to #138
  • Loading branch information
li-boxuan committed Aug 2, 2018
1 parent d32b257 commit faf793a
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 272 deletions.
12 changes: 12 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
presets: [
'react',
'env',
],
plugins: [
'react-require',
'transform-object-rest-spread',
'transform-class-properties',
'babel-plugin-inline-import',
],
}
44 changes: 44 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"babel-cli": "^6.26.0",
"babel-core": "^6.3.17",
"babel-eslint": "^7.1.0",
"babel-inline-import-loader": "^0.1.0",
"babel-loader": "^7.0.0",
"babel-plugin-inline-import": "^3.0.0",
"babel-plugin-react-require": "^3.0.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
Expand Down
2 changes: 1 addition & 1 deletion script/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e -x

npm run build
NODE_ENV=development npx babel-node --presets env --plugins transform-class-properties script/fetch-issues.js
NODE_ENV=development npx babel-node script/fetch-issues.js
4 changes: 0 additions & 4 deletions script/queries/export.js

This file was deleted.

9 changes: 7 additions & 2 deletions script/queries/github_issue_info.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
query($owner: String!, $name: String!, $before: String) {
query($owner: String!, $name: String!, $perPage: Int!, $before: String, $orderBy: IssueOrder!) {
rateLimit {
limit
remaining
resetAt
}
repository(owner:$owner, name:$name) {
issues(last:100, before:$before) {
issues(last:$perPage, before:$before, orderBy:$orderBy) {
pageInfo {
startCursor
hasPreviousPage
Expand Down
53 changes: 0 additions & 53 deletions script/queries/github_issue_info.js

This file was deleted.

5 changes: 5 additions & 0 deletions script/queries/github_label_info.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
query($owner: String!, $name: String!) {
rateLimit {
limit
remaining
resetAt
}
repository(owner:$owner, name:$name) {
labels(first:100){
nodes {
Expand Down
19 changes: 0 additions & 19 deletions script/queries/github_label_info.js

This file was deleted.

9 changes: 7 additions & 2 deletions script/queries/github_pr_info.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
query($owner: String!, $name: String!, $before: String) {
query($owner: String!, $name: String!, $perPage: Int!, $before: String, $orderBy: IssueOrder!) {
rateLimit {
limit
remaining
resetAt
}
repository(owner:$owner, name:$name) {
pullRequests(last:30, before:$before) {
pullRequests(last:$perPage, before:$before, orderBy:$orderBy) {
pageInfo {
startCursor
hasPreviousPage
Expand Down
98 changes: 0 additions & 98 deletions script/queries/github_pr_info.js

This file was deleted.

13 changes: 9 additions & 4 deletions script/queries/github_reaction_info.graphql
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
query($owner: String!, $name: String!, $number: Int!,
$reviewCnt: Int!, $maxCommentsPerReview: Int!, $commentCnt: Int!) {
$reviewsCount: Int!, $discussionsPerReview: Int!, $commentsCount: Int!) {
rateLimit {
limit
remaining
resetAt
}
repository(owner:$owner, name:$name) {
pullRequest(number: $number) {
reviews(first: $reviewCnt) {
reviews(first: $reviewsCount) {
nodes {
comments(first: $maxCommentsPerReview) {
comments(first: $discussionsPerReview) {
nodes {
id
reactions(first: 100) {
Expand All @@ -22,7 +27,7 @@ query($owner: String!, $name: String!, $number: Int!,
}
}
}
comments(first:$commentCnt) {
comments(first:$commentsCount) {
nodes {
id
reactions(first: 100) {
Expand Down
Loading

0 comments on commit faf793a

Please sign in to comment.