2013-12-09 16:29:13 +00:00
# How to Contribute
The best way to get started is to read through the `Getting Started` and `Example`
sections before having a look through the open [issues ](https://github.com/js-platform/filer/issues ).
Some of the issues are marked as `good first bug` , but feel free to contribute to
any of the issues there, or open a new one if the thing you want to work on isn't
there yet. If you would like to have an issue assigned to you, please send me a
message and I'll update it.
## Setup
2018-06-28 17:35:20 +00:00
To get a working build system do the following:
2013-12-09 16:29:13 +00:00
```
npm install
```
2018-06-28 17:35:20 +00:00
You can now run the following `npm` scripts:
2018-07-15 17:28:04 +00:00
* `npm run lint` or `npm run eslint` will run `eslint` on the `src` and `tests` directories.
* `npm run lint:fix` or `npm run eslint:fix` will run `eslint` with `--fix` on the `src` and `tests` directories, automatically fixing minor issues.
2018-07-15 17:03:28 +00:00
* `npm run test:manual` will build the tests, and allow you to run them in a browser manually by loading http://localhost:1234.
2018-12-01 17:50:04 +00:00
* `npm run karma-mocha` will build Filer and the tests, and finally run the tests in both headless Chrome and headless Firefox browsers.
* `npm run karma-mocha-chrome` will build Filer and the tests, and finally run the tests in headless Chrome
* `npm run karma-mocha-firefox` will build Filer and the tests, and finally run the tests in headless Firefox
2018-07-15 17:03:28 +00:00
* `npm test` will run `lint` followed by `karma-chrome` , and is what we do on Travis.
2018-06-28 17:35:20 +00:00
* `npm run build` will bundle two versions of Filer: `dist/filer.js` (unminified) and `dist/filer.min.js` (minified) as well as source map files.
2013-12-09 16:29:13 +00:00
Once you've done some hacking and you'd like to have your work merged, you'll need to
2018-10-20 21:00:03 +00:00
make a pull request. If your patch includes code, make sure to check that all the
2013-12-09 16:29:13 +00:00
unit tests pass, including any new tests you wrote. Finally, make sure you add yourself
to the `AUTHORS` file.
## Tests
2014-01-21 21:25:09 +00:00
Tests are writting using [Mocha ](http://visionmedia.github.io/mocha/ ) and [Chai ](http://chaijs.com/api/bdd/ ).
2018-06-28 17:35:20 +00:00
You can run the tests in your browser by running `npm test` and opening your browser to `http://localhost:1234` .
2014-01-21 21:25:09 +00:00
There are a number of configurable options for the test suite, which are set via query string params.
2014-05-21 17:07:31 +00:00
First, you can choose which filer source to use (i.e., src/, dist/filer-test.js, dist/filer.js or dist/filer.min.js).
The default is to use what is in /dist/filer-test.js, and you can switch to other versions like so:
2014-01-21 21:25:09 +00:00
* tests/index.html?filer-dist/filer.js
* tests/index.html?filer-dist/filer.min.js
2014-05-21 17:07:31 +00:00
* tests/index.html?filer-src/filer.js (from src)
2014-01-21 21:25:09 +00:00
Second, you can specify which provider to use for all non-provider specific tests (i.e., most of the tests).
The default provider is `Memory` , and you can switch it like so:
* tests/index.html?filer-provider=memory
* tests/index.html?filer-provider=indexeddb
* tests/index.html?filer-provider=websql
If you're writing tests, make sure you write them in the same style as existing tests, which are
provider agnostic. See `tests/lib/test-utils.js` and how it gets used in various tests as
an example.
2013-12-09 16:29:13 +00:00
## Communication
2014-02-17 21:34:41 +00:00
If you'd like to talk to someone about the project, you can reach us on irc.mozilla.org in the #filer or #mofodev channel. Look for "ack" or "humph".
2018-12-20 22:09:17 +00:00
## Releases
In order to perform a release, you'll need commit access to the main Filer repo,
as well as access to publish to Filer's npm module. To do a release:
1. Make sure you have a .env file, with your `GITHUB_TOKEN` included. See [`env.sample` ](env.sample ) for more info on how to create one.
1. Login to the `npm` registry if you haven't already using `npm login`
1. Run `npm run release` . Releases are done interactively using [release-it ](https://www.npmjs.com/package/release-it ), and our config is defined in [`.release-it.json` ](.release-it.json ).