Skip to content

Commit 8b7a8e0

Browse files
author
James Baxley
authored
* setup some bots * don't track package-lock.json
1 parent 2d560ab commit 8b7a8e0

File tree

12 files changed

+266
-6322
lines changed

12 files changed

+266
-6322
lines changed

.github/ISSUE_REPLY_TEMPLATE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### Thanks for filing an issue on React Apollo!
2+
3+
To make things easier for you and for a maintiner or contributor to help out, here are a few useful resources!
4+
5+
### Contributing to Apollo
6+
If this is your first time contributing to Apollo, one of our friendly bots will ask for you to sign the CLA. After that, take a look at the [contributor guide](https://github.com/apollographql/apollo-client/blob/master/CONTRIBUTING.md)!
7+
8+
### Creating a reproduction:
9+
- You can create a reproduction using [this template](https://codesandbox.io/s/7361K9q6w) on codesandbox, or try it locally using [the apollo error template](https://github.com/apollographql/react-apollo-error-template)
10+
- If you want to customize the schema to match the issue you are having, checkout [Apollo Launchpad](https://launchpad.graphql.com/new)
11+
- If your issue is related to react-native, try using [Expo](https://snack.expo.io/)
12+
13+
### Guides and Documentation
14+
The issue you are having (or the feature you are requesting) may already be fixed! To find the latest information about how to use Apollo, check out the [documentation](http://dev.apollodata.com/) and see the latest entry from [the blog](https://dev-blog.apollodata.com)
15+
16+
17+
Thank you again for helping to improve React Apollo!

.github/ISSUE_TEMPLATE.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
<!--
2-
Thanks for filing an issue on react-apollo!
2+
Thanks for filing an issue on React Apollo!
33
4-
Please look at the following checklist to ensure that your PR
5-
can be accepted quickly:
6-
-->
7-
8-
9-
## Steps to Reproduce
4+
Please make sure that you include the following information to ensure that your issue is actionable.
105
11-
Describe how to reproduce this issue.
6+
If you don't follow the template, your issue may end up being closed without anyone looking at it carefully, because it is not actionable for us without the information in this template.
127
13-
> code samples are greatly appreciated!
14-
15-
1. Do a thing
16-
2. Do another thing
17-
3. etc.
8+
If you're filing a feature request, you do not need to follow the outline below, but please include "feature idea" in the title and include a specific example in which that feature would be useful.
9+
-->
1810

19-
### Buggy Behavior
11+
**Intended outcome:**
12+
<!--
13+
What you were trying to accomplish when the bug occurred, and as much code as possible related to the source of the problem.
14+
-->
2015

21-
Describe the thing that happens that is the issue.
16+
**Actual outcome:**
17+
<!--
18+
A description of what actually happened, including a screenshot or copy-paste of any related error messages, logs, or other output that might be related. Places to look for information include your browser console, server console, and network logs. Please avoid non-specific phrases like “didn’t work” or “broke”.
19+
-->
2220

23-
### Expected Behavior
21+
**How to reproduce the issue:**
22+
<!--
23+
If possible, please create a reproduction using https://github.com/apollographql/react-apollo-error-template and link to it here. If you prefer an in-browser way to create reproduction, try https://codesandbox.io/s/7361K9q6w
2424
25-
Describe what you think should actually happen.
25+
Instructions for how the issue can be reproduced by a maintainer or contributor. Be as specific as possible, and only mention what is necessary to reproduce the bug. If possible, try to isolate the exact circumstances in which the bug occurs and avoid speculation over what the cause might be.
26+
-->
2627

27-
### Version
28+
**Version**
2829
- apollo-client@<version number>
2930
- react-apollo@<version number>

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
<!--
2-
Thanks for filing a pull request on react-apollo!
2+
Thanks for filing a pull request on React Apollo!
3+
4+
A few automated bots may chime in on your PR. They are here to help
5+
with reviewing and ensuring React Apollo is production ready after each
6+
pull request merge.
7+
8+
- meteor-bot will respond asking you to sign the CLA if this is your first PR.
9+
It may also respond with warnings, messages, or fail the build if something is off.
10+
Don't worry, it'll help you to fix what is broken!
11+
12+
- bundlesize is a status check to keep the footprint of React Apollo as small as possible.
13+
14+
- travis-ci will run tests, checking style of code, and generally make
15+
sure everything is working as expected
316
417
Please look at the following checklist to ensure that your PR
518
can be accepted quickly:
619
-->
720

8-
TODO:
21+
### Checklist:
922

10-
- [ ] If this PR is a new feature, reference an issue where a consensus about the design was reached (not necessary for small changes)
23+
- [ ] If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
1124
- [ ] Make sure all of the significant new logic is covered by tests
12-
- [ ] Rebase your changes on master so that they can be merged easily
13-
- [ ] Make sure all tests and linter rules pass
14-
- [ ] Update CHANGELOG.md with your change
15-
- [ ] If this was a change that affects the external API, update the docs and post a link to the PR in the discussion
16-
- [ ] If this was a change that affects GitHunt-React, update GitHunt-React and post a link to the PR in the discussion
25+
- [ ] If this was a change that affects the external API used in GitHunt-React, update GitHunt-React and post a link to the PR in the discussion.

.github/config.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
repository:
2+
# See https://developer.github.com/v3/repos/#edit for all available settings.
3+
4+
homepage: http://dev.apollodata.com/
5+
private: false
6+
has_issues: true
7+
has_wiki: false
8+
has_downloads: true
9+
has_projects: false
10+
11+
# Labels: define labels for Issues and Pull Requests
12+
labels:
13+
# statuses to signal contributor / maintainers action
14+
- name: help-wanted
15+
color: 159818
16+
- name: discussion
17+
color: e99695
18+
- name: question
19+
color: cc317c
20+
- name: waiting-response
21+
color: fbca04
22+
- name: reproduction-needed
23+
color: fbca04
24+
25+
# type of the issue / PR
26+
- name: bug
27+
color: fc2929
28+
- name: docs
29+
color: c2e0c6
30+
- name: feature
31+
color: 5319e7
32+
- name: greenkeeper
33+
color: ededed
34+
- name: idea
35+
color: fbca04
36+
- name: perf
37+
color: 1d76db
38+
- name: tooling
39+
color: c5def5
40+
- name: refactor
41+
color: bfdadc
42+
- name: usability
43+
color: d4c5f9
44+
- name: good-first-issue
45+
color: bfdadc
46+
47+
# status of the issue / PR
48+
- name: duplicate
49+
color: d4c5f9
50+
- name: can't-reproduce
51+
color: bfd4f2
52+
- name: confirmed
53+
color: d93f0b
54+
- name: in-progress
55+
color: ededed
56+
- name: revist
57+
color: ededed
58+
59+
# priority
60+
- name: high-priority
61+
color: b60205
62+
- name: medium-priority
63+
color: e99695
64+
- name: low-priority
65+
color: fef2c0
66+
- name: pull-requests-encouraged
67+
color: 0e8a16
68+
69+
# tech specific
70+
- name: typescript
71+
color: 1d76db
72+

.github/no-response.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Probot configuration
2+
# Number of days of inactivity before an Issue is closed for lack of response
3+
daysUntilClose: 14
4+
# Label requiring a response
5+
responseRequiredLabel: waiting-response
6+
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
7+
closeComment: >
8+
This issue has been automatically closed because there has been no response
9+
to the request for more information from the author. With only the
10+
information that is currently in the issue, we sadly don't have enough information
11+
to take action. Please reach out if you have or find the information we need so
12+
that we can investigate further! Thank you for contributing to React Apollo!

.github/probot-snooze.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Default length (in days) to snooze an item if no date is specified
2+
defaultSnoozeDuration: 7,
3+
labelName : 'revist',
4+
labelColor : 'ededed'

.github/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ exemptLables:
99
- enhancement
1010
# text of the comment when marking issue as stale
1111
markComment: >
12-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if not further activity occurs. Thank you for your contributions to React Apollo!
12+
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!
1313
# text of the comment when closing an issue
1414
closeComment: >
1515
This issue has been automatically closed because it has not had recent activity after being marked as stale. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to React Apollo!

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ dist
3333

3434
# don't track yarn lock but allow contributors to use it for local dev
3535
yarn.lock
36+
package-lock.json

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "4"
3+
- "8"
44
cache:
55
directories:
66
- $HOME/.npm
@@ -17,13 +17,13 @@ install:
1717
- cd examples/create-react-app && yarn && cd ../../
1818

1919
script:
20+
- npm run danger
2021
- npm test
2122
- coveralls < ./coverage/lcov.info || true # ignore coveralls error
2223
- npm run compile
2324
- npm run bundle
2425
- cd examples/create-react-app && npm test && cd ../../
2526
- npm run filesize
26-
- python node_modules/travis-weigh-in/weigh_in.py ./dist/index.min.js.gz || true # ignore size errors
2727

2828
# Allow Travis tests to run in containers.
2929
sudo: false
@@ -35,6 +35,6 @@ deploy:
3535
secure: jctKs4JKowu1fYaqy2ALIBQAq+yRGVxdDlQGG5rlItmPKLd2mMHZ8Cz/+bew0Y8E9jTCExxGP0tX7HN32RoDWFID7sZspPhEiuh6QKVtyxVoiEyLGiH1qCFYJsD/H8Ms7xVjnNgbqTwj+CiJyPsLjXRahLNn1cAE6E6As9S2QVKc/1O9cLesqRdilZoKcLxSu8ppwxoqvLyOilgg0iiPMepp90B2suLmXht2CPFhDqbWhF8s8IblNB8m6xBLHkH3nrTPTISWjZqSHjKz6rmknrwI9LJQHVXkrB7xEpvIkzTbQWajTdDPkGS6EyZyltIFoEICG9Yecski0wuxRXU64dsrSPcB4vEvJv8qq5LckvqHjT84JTWfKDZl3LjlRJY7Oig5Z93YlnV89W1sMJMQOKzt7XMEMHyER1ja/ZY6SbPfJxer2JIy0MNo1CDNLMDBS1OcmCvw6joZwSBm3sJd9Fe9g898K5UIiY/jRnh6CqG0U9BzY9L2wjtrB3biSF4iIaMZvFF/pwS8JI7MZOdo0bwTJIRqhqDcLpF7nS3+ph0rytemjMhEP4IgVCqXyiBiAAMXtN7D3RWe7E+I4dBvK1Cgdjgp2bNJTcAaBdLsFCiBSkKH0JYAV7mj6nt77EpqEgoyJD+32gSDomzUq2Nxo4USxwiHq5F4vBbX99+XJuw=
3636
on:
3737
tags: true
38-
node: '4'
38+
node: '8'
3939
repo: apollographql/react-apollo
4040
branch: master

dangerfile.ts

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import { danger, fail, warn, message } from 'danger';
2+
import { includes } from 'lodash';
3+
import * as fs from 'fs';
4+
5+
// Setup
6+
const pr = danger.github.pr;
7+
const modified = danger.git.modified_files;
8+
const bodyAndTitle = (pr.body + pr.title).toLowerCase();
9+
10+
// Custom modifiers for people submitting PRs to be able to say "skip this"
11+
const trivialPR = bodyAndTitle.includes('trivial');
12+
const acceptedNoTests = bodyAndTitle.includes('skip new tests');
13+
14+
const typescriptOnly = (file: string) => includes(file, '.ts');
15+
const filesOnly = (file: string) =>
16+
fs.existsSync(file) && fs.lstatSync(file).isFile();
17+
18+
// Custom subsets of known files
19+
const modifiedAppFiles = modified
20+
.filter(p => includes(p, 'src/'))
21+
.filter(p => filesOnly(p) && typescriptOnly(p));
22+
23+
// Takes a list of file paths, and converts it into clickable links
24+
const linkableFiles = paths => {
25+
const repoURL = danger.github.pr.head.repo.html_url;
26+
const ref = danger.github.pr.head.ref;
27+
const links = paths.map(path => {
28+
return createLink(`${repoURL}/blob/${ref}/${path}`, path);
29+
});
30+
return toSentence(links);
31+
};
32+
33+
// ["1", "2", "3"] to "1, 2 and 3"
34+
const toSentence = (array: Array<string>): string => {
35+
if (array.length === 1) {
36+
return array[0];
37+
}
38+
return array.slice(0, array.length - 1).join(', ') + ' and ' + array.pop();
39+
};
40+
41+
// ("/href/thing", "name") to "<a href="/href/thing">name</a>"
42+
const createLink = (href: string, text: string): string =>
43+
`<a href='${href}'>${text}</a>`;
44+
45+
// Raise about missing code inside files
46+
const raiseIssueAboutPaths = (
47+
type: Function,
48+
paths: string[],
49+
codeToInclude: string
50+
) => {
51+
if (paths.length > 0) {
52+
const files = linkableFiles(paths);
53+
const strict = '<code>' + codeToInclude + '</code>';
54+
type(`Please ensure that ${strict} is enabled on: ${files}`);
55+
}
56+
};
57+
58+
// Rules
59+
60+
// make sure someone else reviews these changes
61+
const someoneAssigned = danger.github.pr.assignee;
62+
if (someoneAssigned === null) {
63+
warn(
64+
'Please assign someone to merge this PR, and optionally include people who should review.'
65+
);
66+
}
67+
68+
// When there are app-changes and it's not a PR marked as trivial, expect
69+
// there to be CHANGELOG changes.
70+
const changelogChanges = includes(modified, 'CHANGELOG.md');
71+
if (modifiedAppFiles.length > 0 && !trivialPR && !changelogChanges) {
72+
fail('No CHANGELOG added.');
73+
}
74+
75+
// No PR is too small to warrant a paragraph or two of summary
76+
if (pr.body.length === 0) {
77+
fail('Please add a description to your PR.');
78+
}
79+
80+
const hasAppChanges = modifiedAppFiles.length > 0;
81+
82+
const testChanges = modifiedAppFiles.filter(
83+
filepath => filepath.includes('__tests__') || filepath.includes('test')
84+
);
85+
const hasTestChanges = testChanges.length > 0;
86+
87+
// Warn when there is a big PR
88+
const bigPRThreshold = 500;
89+
if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) {
90+
warn(':exclamation: Big PR');
91+
}
92+
93+
// Warn if there are library changes, but not tests
94+
if (hasAppChanges && !hasTestChanges) {
95+
warn(
96+
"There are library changes, but not tests. That's OK as long as you're refactoring existing code"
97+
);
98+
}
99+
100+
// Be careful of leaving testing shortcuts in the codebase
101+
const onlyTestFiles = testChanges.filter(x => {
102+
const content = fs.readFileSync(x).toString();
103+
return (
104+
content.includes('it.only') ||
105+
content.includes('describe.only') ||
106+
content.includes('fdescribe') ||
107+
content.includes('fit(')
108+
);
109+
});
110+
raiseIssueAboutPaths(fail, onlyTestFiles, 'an `only` was left in the test');

0 commit comments

Comments
 (0)