Mirror: 馃帺 A tiny but capable push & pull stream library for TypeScript and Flow
1# Development 2 3Thanks for contributing! We want to ensure that `wonka` evolves 4and fulfills its idea of being a tiny & capable push & pull stream library! 5 6## How to contribute? 7 8We follow fairly standard but lenient rules around pull requests and issues. 9Please pick a title that describes your change briefly, optionally in the imperative 10mood if possible. 11 12If you have an idea for a feature or want to fix a bug, consider opening an issue 13first. We're also happy to discuss and help you open a PR and get your changes 14in! 15 16- If you have a question, try [creating a GitHub Discussions thread.](https://github.com/0no-co/wonka/discussions/new/choose) 17- If you think you've found a bug, [open a new issue.](https://github.com/0no-co/wonka/issues/new) 18- or, if you found a bug you'd like to fix, [open a PR.](https://github.com/0no-co/wonka/compare) 19- If you'd like to propose a change [open an RFC issue.](https://github.com/0no-co/wonka/issues/new?labels=future+%F0%9F%94%AE&template=RFC.md&title=RFC%3A+Your+Proposal) You can read more about the RFC process [below](#how-do-i-propose-changes). 20 21### What are the issue conventions? 22 23There are **no strict conventions**, but we do have two templates in place that will fit most 24issues, since questions and other discussion start on GitHub Discussions. The bug template is fairly 25standard and the rule of thumb is to try to explain **what you expected** and **what you got 26instead.** Following this makes it very clear whether it's a known behavior, an unexpected issue, 27or an undocumented quirk. 28 29### How do I propose changes? 30 31We follow an **RFC proposal process**. This allows anyone to propose a new feature or a change, and 32allows us to communicate our current planned features or changes, so any technical discussion, 33progress, or upcoming changes are always **documented transparently.** You can [find the RFC 34template](https://github.com/0no-co/wonka/issues/new/choose) in our issue creator. 35 36### What are the PR conventions? 37 38This also comes with **no strict conventions**. We only ask you to follow the PR template we have 39in place more strictly here than the templates for issues, since it asks you to list a summary 40(maybe even with a short explanation) and a list of technical changes. 41 42If you're **resolving** an issue please don't forget to add `Resolve #123` to the description so that 43it's automatically linked, so that there's no ambiguity and which issue is being addressed (if any) 44 45You'll find that a comment by the "Changeset" bot may pop up. If you don't know what a **changeset** 46is and why it's asking you to document your changes, read on at ["How do I document a change for the 47changelog"](#how-do-i-document-a-change-for-the-changelog) 48 49We also typically **name** our PRs with a slightly descriptive title, e.g. `feat: Title`. 50 51## How do I set up the project? 52 53Luckily it's not hard to get started. You can install dependencie 54[using `pnpm`](https://pnpm.io/installation#using-corepack). 55Please don't use `npm` or `yarn` to respect the lockfile. 56 57```sh 58pnpm install 59``` 60 61There are multiple commands you can run in the root folder to test your changes: 62 63```sh 64# TypeScript checks: 65pnpm run check 66 67# Linting (prettier & eslint): 68pnpm run lint 69 70# Unit Tests: 71pnpm run test 72 73# Builds: 74pnpm run build 75``` 76 77## How do I test my changes? 78 79It's always good practice to run the tests when making changes. If you're unsure which packages 80may be affected by your new tests or changes you may run `pnpm test` in the root of 81the repository. 82 83If your editor is not set up with type checks you may also want to run `pnpm run check` on your 84changes. 85 86Additionally you can head to any example in the `examples/` folder 87and run them. There you'll also need to install their dependencies as they're isolated projects, 88without a lockfile and without linking to packages in the monorepos. 89All examples are started using the `package.json`'s `start` script. 90 91## How do I lint my code? 92 93We ensure consistency in this codebase using `eslint` and `prettier`. 94They are run on a `precommit` hook, so if something's off they'll try 95to automatically fix up your code, or display an error. 96 97If you have them set up in your editor, even better! 98 99## How do I document a change for the changelog? 100 101This project uses [changesets](https://github.com/atlassian/changesets). This means that for 102every PR there must be documentation for what has been changed and which package is affected. 103 104You can document a change by running `changeset`, which will ask you which packages 105have changed and whether the change is major/minor/patch. It will then ask you to write 106a change entry as markdown. 107 108```sh 109# In the root of the urql repository call: 110pnpm changeset 111``` 112 113This will create a new "changeset file" in the `.changeset` folder, which you should commit and 114push, so that it's added to your PR. 115This will eventually end up in the package's `CHANGELOG.md` file when we do a release. 116 117You won't need to add a changeset if you're simply making "non-visible" changes to the docs or other 118files that aren't published to the npm registry. 119 120[Read more about adding a `changeset` here.](https://github.com/atlassian/changesets/blob/master/docs/adding-a-changeset.md#i-am-in-a-multi-package-repository-a-mono-repo) 121 122## How do I release new versions of our packages? 123 124Hold up, that's **automated**! Since we use `changeset` to document our changes, which determines what 125goes into the changelog and what kind of version bump a change should make, you can also use the 126tool to check what's currently posed to change after a release batch using: `pnpm changeset status`. 127 128We have a [GitHub Actions workflow](./.github/workflow/release.yml) which is triggered whenever new 129changes are merged. It will always open a **"Version Packages" PR** which is kept up-to-date. This PR 130documents all changes that are made and will show in its description what all new changelogs are 131going to contain for their new entries. 132 133Once a "Version Packages" PR is approved by a contributor and merged, the action will automatically 134take care of creating the release, publishing all updated packages to the npm registry, and creating 135appropriate tags on GitHub too. 136 137This process is automated, but the changelog should be checked for errors. 138 139As to **when** to merge the automated PR and publish? Maybe not after every change. Typically there 140are two release batches: hotfixes and release batches. We expect that a hotfix for a single package 141should go out as quickly as possible if it negatively affects users. For **release batches** 142however, it's common to assume that if one change is made to a package that more will follow in the 143same week. So waiting for **a day or two** when other changes are expected will make sense to keep the 144fatigue as low as possible for downstream maintainers. 145 146## How do I upgrade all dependencies? 147 148It may be a good idea to keep all dependencies on this repository **up-to-date** every now and 149then. Typically we do this by running `pnpm update --interactive --latest` and checking one-by-one 150which dependencies will need to be bumped. In case of any security issues it may make sense to 151just run `pnpm update [package]`. 152 153While this is rare with `pnpm`, upgrading some transitive dependencies may accidentally duplicate 154them if two packages depend on different compatible version ranges. This can be fixed by running: 155 156```sh 157pnpm dedupe 158pnpm install 159``` 160 161It's common to then **create a PR** (with a changeset documenting the packages that need to reflect 162new changes if any `dependencies` have changed) with the name of 163"(chore) - Upgrade direct and transitive dependencies" or something similar.