Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 2.77 KB

CONTRIBUTING.md

File metadata and controls

43 lines (30 loc) · 2.77 KB

Contributing

Important notes

Please don't edit files in the dist, docs or reports subdirectories as they are generated via Grunt. You'll find source code in the app subdirectory!

Code style

Regarding code style like indentation and whitespace, follow the conventions you see used in the source already.

PhantomJS

While Grunt can run the included unit tests via PhantomJS, this shouldn't be considered a substitute for the real thing. Please be sure to manually test in actual browsers using the index.html, dist-test.html and dist-test-require.html files in the root of the project.

Modifying the code

First, ensure that you have the latest Node.js and npm installed.

Test that Grunt's CLI is installed by running grunt --version. If the command isn't found, run npm install -g grunt-cli. For more information about installing Grunt, see the getting started guide.

  1. Fork and clone the repo.
  2. Run npm install to install all dependencies (including Grunt).
  3. Run bower install to install the front-end dependencies.
  4. Run requirejs:prod to build the library

Assuming that you don't see any red, you're ready to go. Just be sure to run grunt after making any changes, to ensure that nothing is broken.

To run tests by themselves use grunt test, this will run the unit tests and generate a coverage report in reports/coverage.

Files for manual testing

There are 3 HTML files in the root of the project and each is used to test different things:

  1. index.html loads the full require.js and uses the app/main.js bootstrapper. Use this while developing to check your progress. This page does not load built files
  2. dist-test.html loads just the built encoda package (dist/encoda.min.js) using regular <script> tags. Use this after grunting the project to test it still works stand-alone.
  3. dist-test-require.html loads the full require.js and uses the app/main-dist.js bootstrapper to load the built encoda package. Use this after grunting the project to test it still works as an AMD module.

Submitting pull requests

  1. Create a new branch, please don't work in your master branch directly.
  2. Add failing tests for the change you want to make. Run grunt to see the tests fail.
  3. Fix stuff.
  4. Run grunt test to see if the tests pass. Repeat steps 2-4 until done.
  5. Open index.html, dist-test.html and dist-test-require.html in actual browsers to test the changes.
  6. Push to your fork and submit a pull request.
  7. Pull requests containing new public methods must include relevant JSDoc tags to generate documentation.
  8. Pull requests containing files added to the dist, docs or reports subdirectories will be rejected.