sourcecred/package.json

143 lines
4.1 KiB
JSON
Raw Normal View History

{
"name": "sourcecred",
"version": "0.4.0",
"private": false,
"dependencies": {
"aphrodite": "^2.1.0",
"base64url": "^3.0.1",
"better-sqlite3": "^5.4.0",
"bottleneck": "^2.19.5",
"chalk": "2.4.2",
"commonmark": "^0.29.0",
"d3-array": "^2.2.0",
"d3-format": "^1.3.2",
"d3-scale": "^3.0.0",
"d3-scale-chromatic": "^1.3.3",
"d3-time": "^1.0.11",
"d3-time-format": "^2.1.3",
"deep-freeze": "^0.0.1",
"express": "^4.16.3",
"fs-extra": "8.1.0",
"history": "^3.0.0",
"isomorphic-fetch": "^2.2.1",
"json-stable-stringify": "^1.0.1",
"lodash.clonedeep": "^4.5.0",
"lodash.isequal": "^4.5.0",
"lodash.sortby": "^4.7.0",
"object-assign": "4.1.1",
Store GitHub data gzipped at rest (#751) Summary: We store the relational view in `view.json.gz` instead of `view.json`, taking advantage of the isomorphic `pako` library for gzip encoding and decoding. Sample space savings (note that post bodies are included; i.e., #747 has not been applied): SAVE OLD (B) NEW (B) REPO 89.7% 25326 2617 sourcecred/example-github 82.9% 3257576 555948 sourcecred/sourcecred 85.2% 11287621 1665884 ipfs/js-ipfs 88.0% 20953425 2520358 gitcoinco/web 84.4% 38196825 5951459 ipfs/go-ipfs 84.9% 205770642 31101452 tensorflow/tensorflow <details> <summary>Script to generate space savings output</summary> ```shell savings() { printf '% 7s % 11s % 11s %s\n' 'SAVE' 'OLD (B)' 'NEW (B)' 'REPO' for repo; do file="${SOURCECRED_DIRECTORY}/data/${repo}/github/view.json.gz" if ! [ -f "${file}" ]; then printf >&2 'warn: no such file %s\n' "${file}" continue fi script="$(sed -e 's/^ *//' <<EOF repo = '${repo}' pre_size = $(<"${file}" gzip -dc | wc -c) post_size = $(<"${file}" wc -c) percentage = '%0.1f%%' % (100 * (1 - post_size / pre_size)) p = '% 7s % 11d % 11d %s' % (percentage, pre_size, post_size, repo) print(p) EOF )" python3 -c "${script}" done } ``` </details> Closes #750. Test Plan: Comparing the raw old version with the decompressed new version shows that they are identical: ``` $ <~/tmp/sourcecred/data/sourcecred/example-github/github/view.json \ > shasum -a 256 - 63853b9d3f918274aafacf5198787e18185a61b9c95faf640a1e61f5d11fa19f - $ <~/tmp/sourcecred/data/sourcecred/example-github/github/view.json.gz \ > gzip -dc | shasum -a 256 63853b9d3f918274aafacf5198787e18185a61b9c95faf640a1e61f5d11fa19f - ``` Additionally, `yarn test --full` passes, and `yarn start` still loads data and runs PageRank properly. wchargin-branch: gzip-relational-view
2018-09-01 17:42:30 +00:00
"pako": "^1.0.6",
"promise": "8.0.3",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-icons": "^3.7.0",
"react-markdown": "^4.0.8",
"react-router": "3.2.1",
"recharts": "^1.6.2",
"remove-markdown": "^0.3.0",
Retry GitHub queries with exponential backoff (#699) Summary: This patch adds independent exponential backoff to each individual GitHub GraphQL query. We remove the fixed `GITHUB_DELAY_MS` delay before each query in favor of this solution, which requires no additional configuration (thus resolving a TODO in the process). We use the NPM module `retry` with its default settings: namely, a maximum of 10 retries with factor-2 backoff starting at 1000ms. Empirically, it seems very unlikely that we should require much more than 2 retries for a query. (See Test Plan for more details.) This is both a short-term unblocker and a good kind of thing to have in the long term. Test Plan: Note that `yarn test --full` passes, including `fetchGithubRepoTest.sh`. Consider manual testing as follows. Add `console.info` statements in `retryGithubFetch`, then load a large repository like TensorFlow, and observe the output: ```shell $ node bin/sourcecred.js load --plugin github tensorflow/tensorflow 2>&1 | ts -s '%.s' 0.252566 Fetching repo... 0.258422 Trying... 5.203014 Trying... [snip] 1244.521197 Trying... 1254.848044 Will retry (n=1)... 1260.893334 Trying... 1271.547368 Trying... 1282.094735 Will retry (n=1)... 1283.349192 Will retry (n=2)... 1289.188728 Trying... [snip] 1741.026869 Ensuring no more pages... 1742.139978 Creating view... 1752.023697 Stringifying... 1754.697116 Writing... 1754.697772 Done. ``` This took just under half an hour, with 264 queries total, of which: - 225 queries required 0 retries; - 38 queries required exactly 1 retry; - 1 query required exactly 2 retries; and - 0 queries required 3 or more retries. wchargin-branch: github-backoff
2018-08-22 18:37:29 +00:00
"retry": "^0.12.0",
Add CLI command to clear sourcecred data directory (#1111) Resolves #1067 Adds the CLI commands: `sourcecred clear --all` -- removes the $SOURCECRED_DIRECTORY `sourcecred clear --cache` -- removes the cache directory `sourcecred clear --help` -- provides usage info `sourcecred clear` -- prompts the user to be more specific Test plan: The unit tests ensure that the command is properly wired into the sourcecred CLI, including help text integration. However, just to be safe, we can start by verifying that calling `sourcecred` without arguments lists the `clear` command as a valid option, and that calling `sourcecred help clear` prints help information. (Note: it's necessary to run `yarn backend` before testing these changes) The unit tests also ensure that the command removes the proper directories, so there isn't really a need to manually test it, although the reviewer may choose to do so to be safe. Although out of scope for unit tests on this function, we can also do integration tests, to make sure that running the clear command doesn't leave the sourcecred directory in an invalid state from the perspective of the `load` command. ```js $ yarn backend; $ node bin/sourcecred.js load sourcecred/example-github; $ node bin/sourcecred.js clear --cache; $ node bin/sourcecred.js load sourcecred/example-github; $ node bin/sourcecred.js clear --all; $ node bin/sourcecred.js load sourcecred/example-github; ``` The expected behavior of the above command block is that the load command never fails or throws an error. @decentralion and I discussed the scenario where `rimraf` errors. We decided that testing this scenario wasn't necessary, because `rimraf` doesn't error if a directory doesn't exist, and rimraf's maintainer suggests [monkey-patching the fs module] to get rimraf to error in testing scenarios. Thanks @decentralion for reviewing and pair-programming this with me. [monkey-patching the fs module]: https://github.com/isaacs/rimraf/issues/31#issuecomment-29534796
2019-05-13 09:59:58 +00:00
"rimraf": "^2.6.3",
"svg-react-loader": "^0.4.6",
"tmp": "^0.0.33",
"whatwg-fetch": "2.0.3"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.8.0",
"babel-loader": "^8.0.6",
"copy-webpack-plugin": "^5.0.3",
"css-loader": "^3.0.0",
"dotenv": "8.0.0",
"dotenv-expand": "5.1.0",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"enzyme-to-json": "^3.3.3",
"eslint": "^6.2.2",
"eslint-plugin-flowtype": "4.0.0",
"eslint-plugin-import": "2.18.1",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-react": "7.14.3",
"file-loader": "^4.0.0",
"flow-bin": "^0.105.0",
"jest": "^24.8.0",
"jest-fetch-mock": "^2.1.2",
"prettier": "1.18.2",
"raf": "3.4.1",
"react-dev-utils": "^5.0.0",
"static-site-generator-webpack-plugin": "^3.4.1",
"url-loader": "^2.0.1",
"webpack": "^4.39.2",
"webpack-cli": "^3.3.5",
"webpack-dev-server": "^3.7.2",
"webpack-manifest-plugin": "^2.0.4",
"webpack-node-externals": "^1.7.2"
},
"greenkeeper": {
"ignore": [
"history",
"react-dev-utils",
"react-router",
"whatwg-fetch",
"tmp"
]
},
"scripts": {
"prettify": "prettier --write '**/*.js'",
"check-pretty": "prettier --list-different '**/*.js'",
"start": "NODE_ENV=development webpack-dev-server --config config/webpack.config.web.js",
"build": "NODE_ENV=production webpack --config config/webpack.config.web.js",
"backend": "NODE_ENV=development webpack --config config/webpack.config.backend.js",
"test": "node ./config/test.js",
"unit": "BABEL_ENV=test NODE_ENV=test jest --env=jsdom",
Add `sharness` for shell-based testing (#597) Summary: We will shortly want to perform testing of shell scripts; it makes the most sense to do so via the shell. We could roll our own testing framework, but it makes more sense to use an existing one. By choosing Sharness, we’re in good company: `go-ipfs` and `go-multihash` use it as well, and it’s derived from Git’s testing library. I like it a lot. For now, we need a dummy test file; our test runner will fail if there are no tests to run. As soon as we have a real test, we can remove this. This commit was generated by following the “per-project installation” instructions at https://github.com/chriscool/sharness, and by additionally including that repository’s `COPYING` file as `SHARNESS_LICENSE`, with a header prepended. I considered instead adding Sharness as a submodule, which is supported and has clear advantages (e.g., you can update the thing), but opted to avoid the complexity of submodules for now. Test Plan: Create the following tests in the `sharness` directory: ```shell $ cat sharness/good.t #!/bin/sh test_description='demo of passing tests' . ./sharness.sh test_expect_success "look at me go" true test_expect_success EXPENSIVE "this may take a while" 'sleep 2' test_done # vim: ft=sh $ cat sharness/bad.t #!/bin/sh test_description='demo of failing tests' . ./sharness.sh test_expect_success "I don't feel so good" false test_done # vim: ft=sh ``` Note that `yarn sharness` and `yarn test` fail appropriately. Note that `yarn sharness-full` fails appropriately after taking two extra seconds, and `yarn test --full` runs the latter. Each failure message should print the name of the failing test case, not just the suite name, and should indicate that the passing tests passed. Then, remove `sharness/bad.t`, and note that the above commands all pass, with the `--full` variants still taking longer. Finally, remove `sharness/good.t`, and note that the above commands all pass (and all pass quickly). wchargin-branch: add-sharness
2018-08-06 19:56:25 +00:00
"sharness": "make -sC ./sharness prove PROVE_OPTS=-f TEST_OPTS='--chain-lint'",
"sharness-full": "make -sC ./sharness prove PROVE_OPTS=-vf TEST_OPTS='-v --chain-lint --long'",
"coverage": "yarn run unit --coverage",
"flow": "flow",
"lint": "eslint src config --max-warnings 0"
},
"license": "(MIT OR Apache-2.0)",
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,mjs}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js",
"<rootDir>/config/jest/setupJest.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx",
"node",
"mjs"
]
},
"files": [
"/bin",
"/build"
]
}