|
| 1 | +# Contributing to Medium Zoom |
| 2 | + |
| 3 | +Thank you for getting involved in Medium Zoom! |
| 4 | + |
| 5 | +## Concept |
| 6 | + |
| 7 | +This module is meant to reproduce the zoom from [Medium](http://medium.com). We want to provide a great UX (User Experience) with a lightweight vanilla JavaScript solution. Thus, this package must remain focused on this core principle, yet be extended with a composable API. |
| 8 | + |
| 9 | +## Folder structure |
| 10 | + |
| 11 | +``` |
| 12 | +▸ cypress The end-to-end tests written for Cypress |
| 13 | +▸ examples The Medium Zoom featured examples available on CodeSandbox |
| 14 | +▸ src The source code of the module |
| 15 | + ▸ __tests__ The tests for the module API |
| 16 | +▸ stories The stories for the Medium Zoom Storybook |
| 17 | +▸ website The Medium Zoom website source code |
| 18 | +``` |
| 19 | + |
| 20 | +## Requirements |
| 21 | + |
| 22 | +- [Node](https://nodejs.org) |
| 23 | +- [Yarn](https://yarnpkg.com) |
| 24 | + |
| 25 | +## Conventions |
| 26 | + |
| 27 | +### Commits |
| 28 | + |
| 29 | +This project follows the [conventional changelog](https://conventionalcommits.org/) guidelines. All commit messages should be formatted using the following scheme: |
| 30 | + |
| 31 | +``` |
| 32 | +type(scope): description |
| 33 | +``` |
| 34 | + |
| 35 | +## Workflow |
| 36 | + |
| 37 | +### Filing issues |
| 38 | + |
| 39 | +Reporting a bug or requesting a feature is always welcome. Feel free to [open an issue](https://github.com/francoischalifour/medium-zoom/issues/new/choose) with the according template which helps you create an effective report. |
| 40 | + |
| 41 | +### Submit code |
| 42 | + |
| 43 | +After discussing in an issue about the need to change the code, you will need to follow these steps: |
| 44 | + |
| 45 | +- [Fork the repository](https://help.github.com/articles/fork-a-repo/) |
| 46 | +- Clone your fork |
| 47 | +- Install the dependencies: `yarn` |
| 48 | +- For a **documentation** change: |
| 49 | + - Create a branch `docs/what-you-change` |
| 50 | + - Make the changes |
| 51 | + - Run `yarn run format` |
| 52 | +- For a **bug fix**: |
| 53 | + - Create a branch `fix/issue-number` |
| 54 | + - [Write a test](src/__tests__/medium-zoom.test.js) to reproduce the bug (run `yarn run test`) |
| 55 | + - Fix the bug in the [source code](src/medium-zoom.js) |
| 56 | + - Make your test pass the previous bug |
| 57 | + - Run `yarn run format` and fix problems if any |
| 58 | +- For a **feature**: |
| 59 | + - Create a branch `feat/name-of-the-feature` |
| 60 | + - Add the feature to the [source code](src/medium-zoom.js) |
| 61 | + - Create a story in the [storybook](stories) showcasing the feature |
| 62 | + - [Write a test](src/__tests__/medium-zoom.test.js) to ensure it's working as expected (run `yarn run test`) |
| 63 | + - Run `yarn run format` and fix problems if any |
| 64 | +- [Create a pull request](https://help.github.com/articles/creating-a-pull-request/) |
| 65 | + |
| 66 | +We will then review your pull request! |
| 67 | + |
| 68 | +### Testing |
| 69 | + |
| 70 | +#### Unit and integration tests |
| 71 | + |
| 72 | +[Unit and integration tests](src/__tests__) with [Jest](https://jestjs.io) ensure that the API works as documented. |
| 73 | + |
| 74 | +###### Commands |
| 75 | + |
| 76 | +- Run the tests: `yarn run test` |
| 77 | +- Watch the tests: `yarn run test --watch` |
| 78 | +- Run the tests with coverage: `yarn run test --coverage` |
| 79 | + |
| 80 | +#### End-to-end tests |
| 81 | + |
| 82 | +[End-to-end tests](cypress/integration) with [Cypress](https://cypress.io) take screenshots of the stories to ensure that the zoom looks as expected. |
| 83 | + |
| 84 | +###### Commands |
| 85 | + |
| 86 | +- Open the Cypress UI: `yarn run test:cypress:open` |
| 87 | +- Run the Cypress tests: `yarn run test:cypress:run` |
| 88 | + |
| 89 | +### Releasing |
| 90 | + |
| 91 | +We rely on [release-it](https://github.com/webpro/release-it) to release new versions of this package. |
| 92 | + |
| 93 | +#### Release flow |
| 94 | + |
| 95 | +The release flow goes through these steps: |
| 96 | + |
| 97 | +1. Run acceptance tests |
| 98 | +1. Bump the project version in [`package.json`](package.json) based on [the commits](#conventions) |
| 99 | +1. Commit the release version |
| 100 | +1. Create the new Git tag for this release |
| 101 | +1. Push to GitHub |
| 102 | +1. Publish to npm |
| 103 | + |
| 104 | +#### Release steps |
| 105 | + |
| 106 | +##### Unstable version |
| 107 | + |
| 108 | +1. Make sure you're on the `next` branch |
| 109 | +1. Run `npm run release:next` (_do not_ use `yarn` for releasing) |
| 110 | +1. Follow the command-line instructions |
| 111 | + |
| 112 | +##### Stable version |
| 113 | + |
| 114 | +1. Make sure you're on the `master` branch |
| 115 | +1. Run `npm run release` (_do not_ use `yarn` for releasing) |
| 116 | +1. Follow the command-line instructions |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +Thank you for contributing! |
0 commit comments