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!
Regarding code style like indentation and whitespace, follow the conventions you see used in the source already.
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.
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.
- Fork and clone the repo.
- Run
npm install
to install all dependencies (including Grunt). - Run
bower install
to install the front-end dependencies. - 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.
There are 3 HTML files in the root of the project and each is used to test different things:
- 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
- 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. - 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.
- Create a new branch, please don't work in your
master
branch directly. - Add failing tests for the change you want to make. Run
grunt
to see the tests fail. - Fix stuff.
- Run
grunt test
to see if the tests pass. Repeat steps 2-4 until done. - Open index.html, dist-test.html and dist-test-require.html in actual browsers to test the changes.
- Push to your fork and submit a pull request.
- Pull requests containing new public methods must include relevant JSDoc tags to generate documentation.
- Pull requests containing files added to the dist, docs or reports subdirectories will be rejected.