Thanks you for considering a contribution to Microcosm!
Microcosm is built using tools written for
nodejs. We recommend installing Node with
nvm. Dependencies are managed
through package.json
.
You use the same node version we are developing with by running
nvm use
You may need to run
nvm install
if you haven't installed the node version on.nvmrc
All commands should be run using yarn. If you haven't switched to yarn yet, now's a great time!
If you are familiar with npm then using yarn should be a breeze. You can keep using npm if you'd prefer but you will miss out on the safety and security of yarn
You can install dependencies with:
yarn install
The examples section showcase Microcosm features. These may be helpful as you develop new features or improve existing ones. Check out the examples section of this repo to get started running the examples.
Documentation found on the Microcosm site is generated from markdown files in the docs section.
We would love your help in improving documentation. Get involved by creating a pull request addressing an issue with the label
documentation
, by creating a documentation issue, or contributing to the conversation on existing issues.
You may want to run what you see on code.viget.com/microcosm locally. To do so head over the site section of this repo.
We are using prettier combined with eslint to keep formatting and format linting easy. We do that by running:
yarn run pretty
or
make pretty
These will first run prettier
to format our code and then run eslint --fix
to make additional style changes and fixes.
We are defaulting to prettier's opinions on some things (the ones it forces us to). Most notably single quotes. Prettiers will use double quotes (even in single quote mode) when it is "prettier" to do so.
ie:
// prettier will do this (what we chose to do)
"I am using double quotes because it's prettier"
// eslint --fix would do this
'I am using single quotes because it\'s eslint --fix'
We are letting this happen for two reasons:
- Write whatever you want, prettier will fix it, that's the point
- Our
yarn run lint
task would error out if we did aeslint --fix
. There is no way to turn change prettier's behaviour but we can turn off the offending eslint rule
yarn test
For test coverage:
yarn run test:cov
open ./coverage/index.html
Be sure to check the
./coverage
folder to verify all code paths are touched.
The following steps are required to push a new release:
- Update changelog
yarn version <major,minor,patch>
git push --tags
make release
Microcosm must first be compiled down to ES5 using Babel. The following command will perform that task and deploy to NPM:
yarn run release
For release candidates, consider deploying to NPM using the beta
tag
with:
make prerelease
Consider master unsafe, use npm
for the latest stable version.
Microcosm uses ES6 Javascript (compiled using Babel). As for style:
- No semicolons (enforced by
.eslintrc.json
) - 2 spaces for indentation (no tabs) (enforced by
.editorconfig
) - Prefer ' over ", use string interpolation (enforced by
.eslintrc.json
) - 80 character line length (enforced by
.editorconfig
)
We recommend using an editorconfig, a eslint plugin, and prettier integration for your editor during development to ensure standards are met.
All changes should be submitted through pull request. Ideally, at least two 👍s should be given before a pull request is merge.