sourcecred/src
William Chargin 17172c2d96
cli: implement `load` (#743)
Summary:
This ports the OClif version of `sourcecred load` to the sane CLI
system. The functionality is similar, but the interface has been
changed a bit (mostly simplifications):

  - The `SOURCECRED_GITHUB_TOKEN` can only be set by an environment
    variable, not by a command-line argument. This is standard practice
    because it is more secure: (a) other users on the same system can
    see the full command line arguments, but not the environment
    variables, and (b) it’s easier to accidentally leak a command line
    (e.g., in CI) than a full environment.

  - The `SOURCECRED_DIRECTORY` can only be set by an environment
    variable, not by a command-line argument. This is mostly just to
    simplify the interface, and also because we don’t really have a good
    name for the argument: we had previously used `-d`, which is
    unclear, but `--sourcecred-directory` is a bit redundant, while
    `--directory` is vague and `--sourcecred-directory` is redundant.
    This is an easy way out, but we can put the flag for this back in if
    it becomes a problem.

  - The `--max-old-space-size` argument has been removed in favor of a
    fixed value. It’s unlikely that users should need to change it.
    If we’re blowing an 8GB heap, we should try to not do that instead
    of increasing the heap.

  - Loading zero repositories, but specifying an output directory, is
    now valid. This is the right thing to do, but OClif got in our way
    in the previous implementation.

Test Plan:
Unit tests added, with full coverage; run `yarn unit`.

To try it out, run `yarn backend`, then `node bin/cli.js load --help` to
get started.

I also manually tested that the following invocations work (i.e., they
complete successfully, and `yarn start` shows good data):

  - `load sourcecred/sourcecred`
  - `load sourcecred/example-git{,hub} --output sourcecred/examples`

These work even when invoked from a different directory.

wchargin-branch: cli-load
2018-09-02 16:07:46 -07:00
..
app cli: implement `load` (#743) 2018-09-02 16:07:46 -07:00
assets/logo Add logo variants for CredBot and Discourse (#717) 2018-08-29 15:15:10 -07:00
cli cli: implement `load` (#743) 2018-09-02 16:07:46 -07:00
core Fix crash on repos with underscores and dots (#738) 2018-08-31 16:18:47 -07:00
graphql Create a Repo type and use throughout the project (#555) 2018-07-27 21:30:50 -07:00
oclif cli: rename existing system from `cli` to `oclif` (#739) 2018-09-02 15:44:30 -07:00
plugins Compress the RelationalView by removing post body (#747) 2018-09-02 00:16:09 -07:00
tools Log error contents on promise rejection (#345) 2018-06-05 11:15:13 -07:00
util Add Node’s `path.normalize` for the browser (#650) 2018-08-14 13:04:53 -07:00