Commit Graph

123 Commits

Author SHA1 Message Date
greenkeeper[bot] ef3e1d6c48 Update eslint-plugin-import to the latest version 🚀 (#1484)
* chore(package): update eslint-plugin-import to version 2.19.0

* chore(package): update lockfile yarn.lock
2019-12-09 15:19:42 +01:00
greenkeeper[bot] 7951d3adae Update file-loader to the latest version 🚀 (#1468)
* chore(package): update file-loader to version 5.0.2

Closes #1468

* chore(package): update lockfile yarn.lock
2019-12-09 15:07:58 +01:00
greenkeeper[bot] 13fa8e78a6 Update url-loader to the latest version 🚀 (#1470)
* chore(package): update url-loader to version 3.0.0

* chore(package): update lockfile yarn.lock
2019-12-09 14:57:52 +01:00
greenkeeper[bot] c5d7d27459 Update flow-bin to the latest version 🚀 (#1476)
* chore(package): update flow-bin to version 0.113.0

* chore(package): update lockfile yarn.lock
2019-12-03 12:51:25 -06:00
greenkeeper[bot] 811d22aa61 Update eslint-plugin-flowtype to the latest version 🚀 (#1467)
* chore(package): update eslint-plugin-flowtype to version 4.5.0

* chore(package): update lockfile yarn.lock
2019-11-28 18:54:52 -06:00
greenkeeper[bot] 98c0bebeef Update flow-bin to the latest version 🚀 (#1449)
* chore(package): update flow-bin to version 0.112.0

* chore(package): update lockfile yarn.lock
2019-11-12 16:57:15 -08:00
greenkeeper[bot] 7b3b0f054d Update eslint-plugin-flowtype to the latest version 🚀 (#1447)
* chore(package): update eslint-plugin-flowtype to version 4.3.1

* chore(package): update lockfile yarn.lock
2019-11-12 16:55:34 -08:00
William Chargin c07a3fe208
deps: upgrade `prettier@1.19.1` (#1439)
Summary:
Most changes due to <https://github.com/prettier/prettier/pull/6694>.

Generated with `yarn add prettier@1.19.1 && yarn prettify`.

Test Plan:
Running `yarn test` suffices.

wchargin-branch: prettier-v1.19.1
2019-11-11 12:47:26 -08:00
William Chargin ada9140663
Upgrade Flow to v0.111.0 (#1436)
Summary:
The Flow team fixed a lot of bugs related to object spreading recently.
Some of these enable us to simplify our code (`generateGraphqlFlowTypes`
and `mirror`). Some find new genuine errors. Others require suppressions
in place of a larger change.

Test Plan:
Running `yarn flow` now passes.

wchargin-branch: upgrade-flow-v0.111.0
2019-11-01 19:55:07 -07:00
greenkeeper[bot] c560f508b1 Update flow-bin to the latest version 🚀 (#1421)
* chore(package): update flow-bin to version 0.110.0

* chore(package): update lockfile yarn.lock
2019-10-22 12:05:50 -06:00
greenkeeper[bot] f725f7c47a Update dotenv to the latest version 🚀 (#1411)
* chore(package): update dotenv to version 8.2.0

* chore(package): update lockfile yarn.lock
2019-10-16 16:32:49 -07:00
Dandelion Mané 5e02a2caeb
Add logic for plucking hyperlinks from cooked html (#1403)
This commit adds a `parseLinks` method to a new module,
`plugins/discourse/references`. `parseLinks` allows us to extract the
hyperlinks from `<a>` tags in "cooked" html.

I added `htmlparser2` as a dependency to parse the html. There were a
lot of options to choose from; I chose htmlparser2 because it has a lot
of usage, reasonable performance, and suits our needs. We use this
dependency in a lightweight and local way, so we can always change it
later if needed.

One thing which was a bit odd: I wasn't able to import it using
`import`, and needed a `require` statement instead.

Test plan: Unit tests added; `yarn test` passes.

This is progress towards [Discourse reference and mention detection][1].

[1]: https://discourse.sourcecred.io/t/discourse-reference-mention-detection/270
2019-10-11 13:36:31 -06:00
greenkeeper[bot] 65edd01dcf Update eslint-plugin-react to the latest version 🚀 (#1400)
* chore(package): update eslint-plugin-react to version 7.16.0

* chore(package): update lockfile yarn.lock
2019-10-04 09:22:12 -06:00
greenkeeper[bot] 74e7508f11 chore(package): update dependencies (#1394) 2019-10-03 12:03:25 -06:00
Dandelion Mané 026d3dc705
Upgrade flow to v109 (#1395)
We need one tiny change in test code, where Flow (correctly) detects an
error. I've added an error suppression comment because it is truly a
Flow error, but is appropriate as we are testing an error condition.

Test plan: `yarn test`
2019-10-03 10:41:51 -06:00
William Chargin e762d2b900
security: upgrade transitive `eslint-utils` to 1.4.2 (#1332)
Summary:
Upgrading past a security fix in that package. Generated by running
`yarn add eslint@^6.2.2 babel-eslint@^10.0.3`: `eslint` to update the
problematic transitive dependency, and `babel-eslint` to avoid
<https://github.com/eslint/eslint/issues/12117>.

Test Plan:
Running `yarn lint` yields no false positives, and does complain on true
positives. Running `yarn list --pattern eslint-utils` lists only v1.4.2.

wchargin-branch: eslint-utils-1.4.2
2019-08-28 07:51:41 -07:00
Dandelion Mané 012f19eb48
discourse fetch: add rate limiting (#1321)
This implements rate limiting to the Discourse fetch logic, so that we
can actually load nontrivial servers without getting a 529 failure.

We could have used retry; I thought it was more polite to actually limit
the rate at which we make requests. However, to avoid seeing 529s in
practice, I left a bit of a buffer: we make only 55 requests per minute,
although 60 would be allowed.

If we want to improve Discourse loading time, we could boost up to the
full 60 request/min, but add in retries. (Or we could switch to retries
entirely.)

Test plan: This logic is untested, however my full discourse-plugin
branch uses it to do full Discourse loads without issue.
2019-08-23 17:51:35 +02:00
Dandelion Mané 610ace0cff
chore(package): update webpack to version 4.39.2 (#1285) 2019-08-14 16:11:47 +02:00
Dandelion Mané 95b8974f6a
Make SourceCred a public package (#1284)
I'm mostly motivated by wanting to get greenkeeper lockfile
auto-updating working (see #1269) although this is also a first step
towards making SourceCred usable from NPM (#1232).

For now, see this as us making sure we claim the sourcecred package name
on npm (see: https://www.npmjs.com/package/sourcecred).

I also fixed the license spec so that it's valid SPDX.
2019-08-13 17:46:23 +02:00
greenkeeper[bot] 027de6d3f0 chore(package): update flow-bin to version 0.105.0 2019-08-13 17:03:50 +02:00
greenkeeper[bot] e31485e7fc chore(package): update eslint-plugin-flowtype to version 4.0.0 2019-08-13 17:03:37 +02:00
Dandelion Mané c62ddccfec
Release version 0.4.0 (#1271)
Test plan: `yarn test --full`
2019-08-07 20:12:11 +02:00
greenkeeper[bot] baf2431f18 chore(package): update eslint to version 6.1.0 (#1245) 2019-08-07 13:48:31 +02:00
greenkeeper[bot] cc68b71029 chore(package): update eslint-plugin-react to version 7.14.3 (#1252) 2019-08-07 13:41:10 +02:00
greenkeeper[bot] 877fca416e chore(package): update eslint-plugin-import to version 2.18.1 (#1241) 2019-08-07 13:40:57 +02:00
greenkeeper[bot] 7d64b15519 chore(package): update webpack to version 4.37.0 2019-08-07 13:40:35 +02:00
greenkeeper[bot] 9a6c9bca3a chore(package): update eslint-plugin-flowtype to version 3.12.1 2019-08-07 13:35:54 +02:00
William Chargin ee581f647f deps: pin an exact version of Prettier
Summary:
[Prettier docs] recommend pinning an exact version because their semver
policy does not extend to stylistic changes, and so patch releases may
change the formatting output.

Given some recent discussion about formatting skew of unknown cause,
this seems like a reasonable safety measure.

Generated with `yarn add --dev --exact prettier`.

[Prettier docs]: https://prettier.io/docs/en/install.html

wchargin-branch: prettier-exact
2019-08-06 12:49:00 +02:00
greenkeeper[bot] 744c11214d chore(package): update flow-bin to version 0.104.0 2019-07-27 18:49:14 +01:00
Dandelion Mané 37b39a7e0a
remove dep on `mkdirp` (#1253)
There's no need for us to depend on `mkdirp`, because the `fs-extra`
module already has `fs.mkdirp` and `fs.mkdirpSync`. This commit removes
the dep from our `package.json`, and removes all explicit imports of it.

Test plan: `yarn test --full` passes. `git grep "import mkdirp"` has no
hits.
2019-07-23 00:28:49 +01:00
Dandelion Mané 6bd7fe1154 Replace `Object.freeze` with `deepFreeze`
Throughout the codebase, we freeze objects when we want to ensure that
their properties are never altered -- e.g. because they are a plugin
declaration, or are being re-used for various test cases.

We generally use `Object.freeze`. This has the disadvantage that it does
not work recursively, so a frozen object's mutable fields and properties
can still be mutated. (E.g. if `const obj = Object.freeze({foo: []})`,
then `obj.foo.push(1)` will succeed in mutating the 'frozen' object).

Sometimes we anticipate this and explicitly freeze the sub-fields (which
is tedious); sometimes we forget (which invites errors). This change
simply replaces all instances of Object.freeze with [deep-freeze], so we
don't need to worry about the issue at all anymore.

Test plan: `yarn test` passes (after updating snapshots);
`git grep Object.freeze` returns no hits.

[deep-freeze]: https://www.npmjs.com/package/deep-freeze
2019-07-21 16:21:12 +01:00
Dandelion Mané 0889a0a5d1 Use url encoding and make _getProjectIds async
Test plan: `yarn test --full` still passes. Also, I've ensured that the
async `_getProjectIds` is still usable in our webpack configs (via
modifying and testing the dependent commits).
2019-07-21 12:24:10 +01:00
Dandelion Mané 9b105ee4ce Add `core/project` and `core/project_io`
This creates a new `Project` type which will replace `RepoId` as the
index type for saving and loading data.

The basic data type is added to `project.js`. Rather than having a
`RepoIdRegistry`, I intend to infer the registry at build time by
scanning for available projects saved in the sourcecred directory. I've
added the `project_io` module for this task. It has methods for setting
up a project subdirectory, and loading the `Project` info from that
subdirectory.

To ensure that projects ids can be encoded even if they have symbols
like `/` and `@`, we base64 encode them.

To ensure that project ids can be retrieved at build time, the
`getProjectIds` method is factored out into its own plain ECMAScript
module. For all non-build time needs, it is re-exported from
`project_io`.

Test plan: Unit tests added; run `yarn test`.
2019-07-21 12:24:10 +01:00
greenkeeper[bot] 34117642cf chore(package): update flow-bin to version 0.103.0 2019-07-19 01:17:01 +01:00
greenkeeper[bot] 3dfc209f76 chore(package): update eslint-plugin-flowtype to version 3.12.0 2019-07-18 18:50:54 +01:00
Dandelion Mané d88c72f612
Update babel dependencies (#1236)
* chore(package): update @babel/core to version 7.5.5

* chore(package): update @babel/plugin-proposal-class-properties to version 7.5.5

* chore(package): update @babel/preset-env to version 7.5.5

Test plan: CI passes.
2019-07-18 14:04:05 +01:00
greenkeeper[bot] 8d8804c246 Update dependencies to enable Greenkeeper 🌴 (#1231)
* chore(package): update dependencies

* revert tmp upgrade

I'm having test failures when `tmp` is upgraded; they seem to repro only
when many tests are running at once. Since we have no issues with the
older version of tmp, let's just keep an old tmp and inform Greenkeeper
not to touch it.

Test plan: `yarn test`
2019-07-18 14:02:52 +01:00
Dandelion Mané 493d7332c6 tweak: jest loads .mjs last
This resolves an issue that caused jest tests to fail when depending on
a module that ships .mjs files (encountered via a transitive dep of
react-markdown).

See https://github.com/facebook/create-react-app/pull/4085 for context.

Test plan: I have a future commit which tests a file that depends on
react-markdown. The tests fail to run before this commit, and they run
without issue afterwards.
2019-07-14 20:11:30 +01:00
Dandelion Mané 8e0bbcf597 Change version to 0.3.0 2019-07-11 21:53:11 +01:00
Dandelion Mané 5dc7f440ce Initial Timeline Explorer
This commit adds a TimelineExplorer for visualizing timeline cred data.
The centerpiece is the TimelineCredChart, a d3-based line chart showing
how the top users' cred evolved over time. It has features like tooltips,
reasonable ticks on the x axis, a legend, and filtering out line
segments that stay on the x axis.

An inspection test is included, which you can check out here:
http://localhost:8080/test/TimelineCredView/

Also, you can run it for any loaded repository at:
http://localhost:8080/timeline/$repoOwner/$repoName

This commit also includes new dependencies:
- recharts (for the charts)
- react-markdown (for rendering the Markdown descriptions)
- remove-markdown (so the legend will be clean text)
- d3-time-format for date axis generation
- d3-scale and d3-scale-chromatic for color scales

Test plan: The frontend code is mostly untested, in keeping with my
observation that the costs of testing the old explorer were really high,
and the tests brought little benefit. However, I have manually tested it
thoroughly. Also, there is an inspection test for the TimelineCredView
(see above).
2019-07-11 06:33:41 +01:00
Dandelion Mané a0b754bb43 upgrade to webpack 4
Now that babel is upgraded, upgrading webpack was pretty
straightforward.

- We take advantage of the new `mode` config option, and no longer need
to manually set up Uglify plugin
- Uglifyjs is back, I checked the prod build output: it's very ugly
- I updated the RemoveBuildDirectoryPlugin per instructions, and
verified it still works.
- I verified that of `yarn backend`, `yarn build`, and `yarn start` all
still work as expected.
2019-07-11 05:52:54 +01:00
Dandelion Mané f77ff3ecd0 Upgrade babel to 7
I moved `config/babel.js` to `.babelrc.js` because it seemed like babel
7 really wanted that. I also blew away our (complicated, copied from
create-react-app) config and replaced it with a much, much simpler one.

Test plan: `yarn test` passes, `yarn start` still serves a working
server, and `scripts/build_static_site.sh` still produces a working
site.

Possibly we lost some nice features re: React debugging; if so I'll add
them back as I miss them.
2019-07-11 05:52:54 +01:00
Dandelion Mané 2335c5d844 add `analysis/timeline/interval`
This commit adds an `interval` module which defines intervals (time
ranges), and methods for slicing up a graph into its consistuent time
intervals. This is pre-requisite work for #862.

I've added a dep on d3-array.

Test plan: Unit tests added; run `yarn test`
2019-07-11 01:30:27 +01:00
Dandelion Mané b7eae8b3eb
Switch to flow v0.100.0 to try to fix CI issues (#1203)
Since upgrading to flow 0.102.0, we've been having CI issues where flow
fails as "out of retries". In my testing, downgrading flow seems to
resolve this, although it's hard to be certain as the issue strikes
sporadically.

Test plan: This commit definitely works locally; hopefully it will
consistently pass in CI as well.
2019-07-06 14:39:32 +01:00
Dandelion Mané 0ade04b66c
try reverting tmp upgrade (#1202)
After merging #1201, we started seeing build failures ([1], [2]) on
CircleCI. I can't reproduce them locally, but they seem related to the
`tmp` module, so let's try reverting the upgrade.

Test plan: `yarn test` passes locally. Let's see how it does on CI.

[1]: https://circleci.com/gh/sourcecred/sourcecred/1091
[2]: https://circleci.com/gh/sourcecred/sourcecred/1092
2019-07-06 00:22:04 +01:00
greenkeeper[bot] 4758cea2f8 Update dependencies to enable Greenkeeper 🌴 (#1201)
This commit enables Greenkeeper, along with an initial upgrade push for our dependencies.

I've reverted a number of upgrades, and also added them to the
greenkeeper ignore list. They mostly relate to babel/webpack stuff,
which I'm reluctant to dive into now (there have been major upgrades for
both babel and webpack) but we should address eventually. There are also
a few oddballs like whatwg-fetch and history.

Test plan: `yarn test --full` passes.
2019-07-05 20:10:02 +01:00
Dandelion Mané 125e8b0486 Tweak package.json
- Remove obsolete eslint react app config
- Pin webpack major version

Test plan: yarn && yarn test
2019-07-05 19:34:35 +01:00
Dandelion Mané 7a493b596d Update eslint and eslint configuration
This commit updates eslint from v4 to v6. In doing so, I've moved off of
the create-react-app base eslint config. We were on an old version (v2)
and it doesn't make sense to update to v4, as in v4 create-react-app
uses typescript. Also, it didn't make sense to stay on
create-react-app's v2 config, because then it had unmet peer dependency
constraints on old versions of eslint.

Instead, I've moved us to use the default rules for eslint,
eslint-plugin-react, and eslint-plugin-flowtype.

I also made some changes to the codebase to satisfy the new lint rules
that came with this change.

Test plan: `yarn test` passes.
2019-07-05 18:39:00 +01:00
Dandelion Mané eadcca8999 Upgrade flow to to 0.102.0
This necessitated a number of type fixes:
- Upgraded the express flow-typed file to latest
- Added manual flow error suppression to where the express flow-typed
file is still using a deprecated utility type
- Removed type polymorphism support on map.merge (see context here[1]).
We weren't using the polymorphism anywhere so I figured it was simplest
to just remove it.
- Improve typing around jest mocks throughout the codebase.

Test plan: `yarn test --full` passes.

[1]: https://github.com/flow-typed/flow-typed/issues/2991
2019-07-05 17:21:56 +01:00
Dandelion Mané 230756ffec Upgrade jest from v23 to v24
Just some general housekeeping. `yarn test --full` passes without issue.
2019-07-04 18:57:50 +01:00