Contributing
April 19, 2021 ยท View on GitHub
How do I debug the morpher locally?
-
You need to symlink your local morpher to your Views project.
- In your local instance of the morpher run
yarn linkin the root directory. - In your project where you are using Views run
yarn link @viewstools/morphin the root directory.
- In your local instance of the morpher run
-
Put in your
debuggerstatements where necessary. -
Run
yarn preparein the morpher directory to bundle your code. -
In your views project run
node --inspect ./node_modules/@viewstools/morph/cli.js . --watch. This will watch your current directory. If you just want to watch a subdirectory within that you can replace the.in that command with the path to the subdirectory. And if you are working on react-native runnode --inspect ./node_modules/@viewstools/morph/cli.js . --watch --as react-native -
In chrome open your dev tools on any tab. Click on the green icon at the top to open the node dev tools. Bingo! :tada:
-
Everytime you make changes to the code in the morpher you'll need to run
yarn preparefor those changes to be picked up by your Views project.
How do I update tests?
The tests are in __tests__/views. We are using Jest snapshot testing.
You can run all the tests with yarn test, or you can run a specific test with jest -t '<nameOfTest>'.
You can debug a specific test with node --inspect node_modules/.bin/jest --runInBand -t='<nameOfTest>'.
When you're happy with snapshot diffs you can run yarn test -u to update them all at once or you can run jest --updateSnapshot -t='<nameOfTest>' to update them individually.
All tests should be passing before you open a PR.
How do I publish a new package version to NPM?
Prerequisites:
- login with your NPM credentials by running the following command in a terminal:
npm login - add this entry
git-tag-version=falseto~/.npmrc
For bug fixes:
yarn release:patch
For non-breaking changes:
yarn release:minor
To finally publish the package run:
npm publish
Releasing a major version:
Run:
yarn release:major
and then:
npm publish
Update the version of @viewstools/create-react-app to match the new version of the morpher (see https://github.com/viewstools/create-react-app/blob/master/package.json) and the template.json file in this repo to make use of the new version https://github.com/viewstools/cra-template-views/blob/master/template.json#L4. In addition to that, the version of @viewstools/cra-template-views should be increased to match the new major version of the morpher.
Having problems? Let us know in the Views slack channel.
Thanks! :clap: