Summary: See motivation in #76. Feel free to look at the new snapshot file to inspect the structured representation and also the stringified output. This implementation is sufficient to encode our query against the GitHub v4 API; see the test plan below. Test Plan: Unit tests added; run `yarn flow && yarn test`. This code has full coverage except for lines 260, 315, and 380 of `queries.js`; these lines check invariants that should never be violated. You can also use the following steps to verify that the sample query is valid GraphQL that produces the same results as our hand-written query: 1. Apply the following hacky patch: ```diff diff --git a/src/backend/graphql/queries.test.js b/src/backend/graphql/queries.test.js index 52bdec7..c04a636 100644 --- a/src/backend/graphql/queries.test.js +++ b/src/backend/graphql/queries.test.js @@ -3,6 +3,18 @@ import type {Body} from "./queries"; import {build, stringify, multilineLayout, inlineLayout} from "./queries"; +function emitGitHubQuery(layout, filename) { + const fs = require("fs"); + const path = require("path"); + const result = stringify.body(usefulQuery(), layout); + const outputFilepath = path.join(__dirname, "..", filename); + const outputText = `module.exports = ${JSON.stringify(result)};\n`; + fs.writeFileSync(outputFilepath, outputText); + console.log(`Wrote output to ${outputFilepath}.`); +} +emitGitHubQuery(multilineLayout(" "), "githubQueryMultiline.js"); +emitGitHubQuery(inlineLayout(), "githubQueryInline.js"); + describe("queries", () => { describe("end-to-end-test cases", () => { const testCases = { ``` 2. Run `CI=true yarn test`, and verify that the following two files written to `src/backend/` contain appropriate contents. You can just eyeball them, or check that they match my results: https://gist.github.com/wchargin/f37b99fd4ec345c9d2541c2dc53ceda9 3. In `fetchGitHubRepo.js`, change the definition of `const query` to ```js const query = require("./githubQueryMultiline.js"); ``` Run ```shell GITHUB_TOKEN="<your_token_here>" src/backend/fetchGitHubRepoTest.sh ``` and verify that it exits successfully. 4. Repeat for `require("./githubQueryInline.js")`. wchargin-branch: graphql-structured-queries
SourceCred
The open-source community provides an enormous amount of value to the world. However, open-source contributors go largely unrewarded and unrecognized. SourceCred aims to help that situation, by building tools that enable quantitatively measuring the value that open-source contributors provide to individual projects, and to the community as a whole.
SourceCred will create a "Cred Graph", which is a graph that shows how the contributions that compose open-source projects are related to and derive value from each other. From this, we'll be able to assign "cred" to users based on how valuable their contributions are. Cred will be assigned based on a mixture of objective data (e.g. references between GitHub pull requests) and subjective feedback (e.g. projects' own judgments on how important different contributions were).
If you'd like to contribute, please follow along with our issues, as we are using issues to coordinate development and design decisions. We also have a slack.