Skip to content

Latest commit

 

History

History
177 lines (110 loc) · 4.81 KB

CONTRIBUTING.md

File metadata and controls

177 lines (110 loc) · 4.81 KB

Contributing to Force

This project is work of many developers.

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

Quick Start

  • Install dependencies:

      $ git clone [email protected]:artsy/force.git
      $ cd force
      $ cp .env.oss .env
      $ yarn install
    
  • Development of components happen in storybooks:

      $ yarn storybook
      $ open http://localhost:9001
    
  • To run the full Artsy.net server:

      $ yarn start
      $ open http://localhost:5000
    
  • Run the tests:

      $ yarn type-check
      $ yarn test:jest
    

Setup Instructions

Clone the Project

Clone the project on GitHub and cd in:

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

Run Force

Install NVM and Node 12:

nvm install 12
nvm alias default 12

Install node modules with Yarn:

brew install yarn
yarn install

Copy the .env.oss file to a .env file:

cp .env.oss .env

Start the server:

yarn start

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

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.)

In case you want to ease debugging the server-side code, you can set the DEBUG environment variable to disable webpack optimizations.

env DEBUG=true yarn start:prod

Authentication in your local Force app

Authentication in Force is handled by a modified OAuth flow, with Gravity authenticating the user and redirecting back to Force. For security reasons, the localhost origin is forbidden as a redirect URL by Gravity in the staging environment. This means that when running Force locally at http://localhost:5000, the staging Gravity environment won't redirect back to your locally running app to complete the flow.

For most local development in Force, this shouldn't be a problem. The login will still take effect and you can manually visit the desired local URL after logging in.

If you require the authentication flow to redirect back to your local version, you can configure Force to run locally at an *.artsy.net subdomain. Gravity's staging environment considers all *.artsy.net subdomains to be valid redirect URLs.

  1. Add the following entry to your local hosts file (/etc/hosts):
127.0.0.1 local.artsy.net
  1. Update your .env file with the following setting:
APP_URL=http://local.artsy.net:5000
  1. Visit http://local.artsy.net:5000.

Creating a Review App

See the docs.

Create a Topic Branch

Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.

git checkout master
git pull upstream master
git checkout -b my-feature-branch

Write Tests

Write tests for all new features and fixes using Mocha or Jest. Run all tests with yarn test.

Mocha looks for files prefixed with .test or .spec, while Jest looks for the prefix .jest.

To speed up your workflow try watching an individual file for changes, e.g. yarn mocha -- --watch desktop/components/foo/bar.test.coffee

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]"

Push

git push origin my-feature-branch

Make a Pull Request

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

Rebase

If you've been working on a change for a while, rebase with upstream/master.

git fetch upstream
git rebase upstream/master
git push origin my-feature-branch -f

Check on Your Pull Request

Go back to your pull request after a few minutes and see whether it passed muster with Semaphore. 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