Skip to content
This repository has been archived by the owner on Nov 13, 2019. It is now read-only.

wri/gfw-water

Repository files navigation

GFW Water Code Climate

Getting Started

Before you can begin, make sure you have node.js.

Install all the front end dependencies.

npm install

Then start the server and your ready to go. The app will be served at http://localhost:3000. You can test the various pages at localhost:3000/index.html and localhost:3000/map.html.

npm start

Scripts

There are several scripts configured in the package.json for different purposes. The three main scripts are detailed below. There are some extra postinstall, optimize, and babel scripts which are just helpers.

Developing

Will start up browser-sync and serve the app out of the build folder at http://localhost:3000.

npm start
Distribution

Will minify and bundle all the code and prepare a distribution ready package in a dist folder.

npm run dist
Tests

Runs Intern and eslint based on the rules defined in .eslintrc.

npm test

If you have a case where it cannot pass an eslint rule, instead of turning the rule off for the entire project, turn it off for the one line like so:

/* eslint no-unused-vars: 0 */
const scalebar = new Scalebar({ map: brApp.map, scalebarUnit: 'metric' }, this.refs.scalebar);
/* eslint no-unused-vars: 0 */

Contributing

Please branch off of the develop branch. Do all of your development in a feature branch and once you are ready to merge to develop, commit your branch and submit a pull request.

Also, please make sure your contributions pass tests before submitting a pull request. Tests include unit tests and linter. We are using Intern and Chai for tests and the eslint cli to lint all javascript. Run your test with the following:

npm test

Deployment

The master branch should always be stable and contain release code. Before submitting a pull request from develop to master, make sure the develop branch has been thoroughly tested and passes npm test. If it is a valid release candidate, please run the following commands to update the version and tag a release, and then submit a pull request to master. If npm test fails it will not be accepted.

npm version {major|minor|patch}
git push origin develop
git push origin --tags

Run the npm version command with major, minor, or patch depending on how you want to increment the version number, following semver. Use npm version patch --no-git-tag-version if you need to increment the version number but you don't want it to auto commit or auto generate a tag.