Contributing to Inferno
==========================
Many thanks for using Inferno and contributing to its development. The following is a quick set of guidelines designed to maximise your contribution's effectiveness.
Got a question or need help?
----------------------------
If you're having trouble getting Inferno to do what you want, there are a couple of places to get help before submitting an issue:
* [Stack Overflow questions tagged infernojs](http://stackoverflow.com/questions/tagged/infernojs)
Of course, if you've encountered a bug, then the best course of action is to raise an issue (if no-one else has!).
Reporting security vulnerabilities
----------------------------------
If you think you've found a security vulnerability, please email [Dominic Gannaway](mailto:dg@domgan.com) with details, and he will respond to you if he isn't at work by that time.
Repository Layout
-----------------
The repository is structured as a pnpm workspace. Workspace setup and linking are handled by `pnpm install`, and the root `postinstall` task builds the packages.
For example, if you want to see the order of packages being processed, you can do:
```
$ pnpm -r --workspace-concurrency=1 --filter './packages/*' exec node -e "console.log(require('./package.json').name)"
inferno-shared
inferno-vnode-flags
inferno-utils
inferno
inferno-clone-vnode
inferno-create-element
inferno-extras
inferno-hyperscript
inferno-test-utils
inferno-animation
inferno-hydrate
inferno-mobx
inferno-redux
inferno-compat
inferno-server
inferno-router
```
Source files are written in TypeScript and tests are written in JS/JSX consuming the dist files.
Running tests
-------------
Always include tests for the functionality you want to add into Inferno. This way we can avoid regression in future.
Make sure you have pnpm available. The repository pins its pnpm version through `packageManager`, so Corepack can provision it for you:
```
corepack enable
```
- Clone the repository.
- Install development dependencies `pnpm install`
- build typescript files `pnpm run build`
- run tests `pnpm run test`
Pull requests
-------------
All pull requests are welcome.
*Caveat for what follows: If in doubt, submit the request - a PR that needs tweaking is infinitely more valuable than a request that wasn't made because you were worrying about meeting these requirements.*
Before submitting, run `pnpm run build` (which will concatenate, lint and test the code) to ensure the build passes - but don't include files from outside the `src` and `test` folders in the PR.
And make sure the PR haven't been published before!
There isn't (yet) a formal style guide for Inferno, so please take care to adhere to existing conventions:
* 2-space indentation, not tabs!
* Semi-colons
* Single-quotes for strings
Above all, code should be clean and readable, and commented where necessary. If you add a new feature, make sure you add a test to go along with it!
Before you commit your changes, please run `pnpm run prettier` to format code correctly
Small print
-----------
There's no contributor license agreement - contributions are made on a common sense basis. Inferno is distributed under the MIT license, which means your contributions will be too.
Debugging Browser
-----------------
Just run `pnpm run test:browser:debug` Open localhost:9876 and click debug!
Debugging NodeJS
----------------
Its possible to debug inferno tests by running following command `pnpm run debug` and open chrome web address: chrome://inspect/#devices
Pro tip: You can filter down number of tests by editing `debug` -task:
`node --inspect-brk ./node_modules/.bin/jest {*edit this*} --runInBand --no-cache --no-watchman`
Change parameter to jest to match only files you want to run.
Happy debugging!
## Credits
### Contributors
Thank you to all the people who have already contributed to inferno!
### Backers
Thank you to all our backers! [[Become a backer](https://opencollective.com/inferno#backer)]
### Sponsors
Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/inferno#sponsor))