Skip to content

Latest commit

 

History

History
51 lines (25 loc) · 2.27 KB

CONTRIBUTING.md

File metadata and controls

51 lines (25 loc) · 2.27 KB

Contributing

Code Style

We use the Prettier code style as defined in .prettierrc.json.

{
	"semi": true,
	"useTabs": true,
	"singleQuote": true
}

Your code MUST be formatted respecting these styles. You can use IDE extensions (for example jsPrettier for sublime), or you can use the included script (npm run format), which formats every JS file.

Branches

The master and dev branches are protected.

The master branch contains the well tested code that is ready to be released. Each release is tagged.

The dev branch is used for development.

Each feature must have its own branch prefixed with feature/ (for example: feature/userMutations). When the work is finished you have to file a Pull Request which will be reviewed by one of the code owners. During the review the reviewer MUST check the results of the CI tests and the compliance of naming conventions. After merging the feature branch it will be removed from the origin repository.

Testing

You should write tests for every unit. Every feature of the unit should be covered by tests. You can check your test coverage by running npm run test:coverage.

We are using jest for testing.

The tests files should be placed near the tested filed with the .test.js extension (for example: epicFeature.js should have a test file called epicFeature.test.js).

Tools

During development you can test the GraphQL server using the included playground that can be found at http://localhost:5000. Or you can use GraphiQL. The endpoint is http://localhost:5000/graphql.

You can test MQTT functionality with MQTT.fx. The username and password should be set to development, since the MQTT server defaults to provision new nodes when they try to authenticate.

Caveats

Due to limitations when modifying .graphql files the application won't reload. You have to kill it with Ctrl + C, clear the node_modules/.cache/babel-loader directory and start it back again. Or you make a small modification (for example, adding a new line at the end of the file) in src/apollo/schema/index.js and everything will be reloaded automatically. Just make sure you revert your changes afterwards.