Skip to content

Latest commit

 

History

History
139 lines (87 loc) · 4.66 KB

CONTRIBUTING.md

File metadata and controls

139 lines (87 loc) · 4.66 KB

Contributing to Force

This project is work of many developers.

For an overview of our current best practices, see this doc.

For an architecture overview (as of July 2021), see this video.

We accept pull requests, and you may propose features and discuss issues.

Setup Instructions

⚠️ If you're an Artsy Engineer, be sure to run the general setup script located in Potential first.

Clone the project on GitHub and cd in:

git clone [email protected]:artsy/force.git && cd force

Execute the setup script:

./scripts/setup.sh

This should install various dependencies, including the Artsy VSCode extension pack for linting, formatting, and Relay.js.

Start the server:

yarn start

# Start and open browser automatically
yarn start --open

# With a specific url
yarn start --open=http://local.artsy.net

Force should now be running at http://localhost:4000/.

Run the tests

yarn type-check
yarn jest
yarn jest-enzyme # for legacy tests

Running a local copy of Force in Production mode

yarn start:prod

This creates a production-ready bundle of client and server-side code and boots the server. (This will take a while to compile.)

Do you see an error about not providing a secure connection?

Your browser has probably cached a redirect to https://.... Clear your browser cache for this page:

  • Browse to the failing page
  • Open Chrome Dev Tools (this adds a drop down menu to the reload icon)
  • Click and hold “Reload” icon until the drop down appears.
  • Select “Empty Cache and Hard Reload”
  • You may now browse successfully to the page

Creating a Review App

git checkout -b review-app-<some-name>

# Add commits
git push

# Once CI is done running, review app should be viewable at
https://some-name.artsy.net

See the docs.

Write Tests

Write tests for all new features and fixes using Jest. Run all tests with yarn test and be sure to include .jest in the filename so that the test-runner knows what to look for.

To speed up your workflow try watching an individual file or directory for changes, e.g. yarn jest --watch src/Components/Authentication

Write Code

We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.

Implement your feature or bug fix.

Commit Changes

Make sure git knows your name and email address:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Prefix your branch with your Github username:

git checkout -b <username>/branch-name
git add .
git commit -m 'Some descriptive commit message'

At this point a series of githooks will run via Husky to ensure staged code is free of linting errors and is formatted properly with Prettier. If all good, then run

git push

This will then run yarn type-check to ensure that type-errors aren't committed upstream, which in turn will prevent unnecessary CI churn when working on a feature. (The reason we run type-checking before git push (vs git commit) is that it's common for developers to create temporary wip commits, which often contain type errors.)

NOTE: For those who prefer to not use our git-hooks workflow, you can easily opt out by prefixing HUSKY_SKIP_HOOKS=1 to executed commands, or by using --no-verify. To opt out globally, add this env var to your .bashrc (or related).

Make a Pull Request

Go to https://github.com/artsy/force and select your branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.

Check on Your Pull Request

Go back to your pull request after a few minutes and see whether it passed muster with Circle. Everything should look green, otherwise fix issues and amend your commit as described above.

Be Patient

It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang in there!

Thank You

Please do know that we really appreciate and value your time and work. We love you, really. <3