-
Notifications
You must be signed in to change notification settings - Fork 243
docs: add contributing guide #1620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KyleAMathews
wants to merge
2
commits into
main
Choose a base branch
from
horton/add-contributor-doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| # Contributing | ||
|
|
||
| ## Questions | ||
|
|
||
| If you have questions about implementation details, help, or support, please use our dedicated community forum at [GitHub Discussions](https://github.com/TanStack/db/discussions). **PLEASE NOTE:** If you choose to open an issue for your question instead, your issue may be closed and redirected to the forum. | ||
|
|
||
| ## Reporting issues | ||
|
|
||
| If you have found what you think is a bug, please [file an issue](https://github.com/TanStack/db/issues/new/choose). **PLEASE NOTE:** Issues that are identified as implementation questions or non-issues may be closed and redirected to [GitHub Discussions](https://github.com/TanStack/db/discussions). | ||
|
|
||
| ## Suggesting new features | ||
|
|
||
| If you are here to suggest a feature, first create an issue if it does not already exist. From there, we can discuss use cases for the feature and how it could be implemented. | ||
|
|
||
| ## Development | ||
|
|
||
| If you have been assigned to fix an issue or develop a new feature, please follow these steps to get started: | ||
|
|
||
| - Fork this repository. | ||
| - Install dependencies. | ||
|
|
||
| ```bash | ||
| pnpm install | ||
| ``` | ||
|
|
||
| - We use [pnpm](https://pnpm.io/) for package management. Please use the version mentioned in `package.json`. | ||
|
|
||
| ```bash | ||
| corepack enable && corepack prepare pnpm@11.1.0 --activate | ||
| ``` | ||
|
|
||
| - We use [nvm](https://github.com/nvm-sh/nvm) to manage Node.js versions. Please use the version mentioned in `.nvmrc`. | ||
|
|
||
| ```bash | ||
| nvm use | ||
| ``` | ||
|
|
||
| - Build all packages. | ||
|
|
||
| ```bash | ||
| pnpm build | ||
| ``` | ||
|
|
||
| - Run tests. | ||
|
|
||
| ```bash | ||
| pnpm test | ||
| ``` | ||
|
|
||
| - Run linting. | ||
|
|
||
| ```bash | ||
| pnpm lint | ||
| ``` | ||
|
|
||
| - Implement your changes and tests in the relevant package or example. | ||
| - Document your changes in the appropriate doc page. | ||
| - Git stage your required changes and commit them. | ||
| - Submit a PR for review. | ||
|
|
||
| ### Editing the docs locally and previewing changes | ||
|
|
||
| The documentation for all TanStack projects is hosted on [tanstack.com](https://tanstack.com), which is a TanStack Start application (https://github.com/TanStack/tanstack.com). You need to run this app locally to preview your changes in the `TanStack/db` docs. | ||
|
|
||
| > [!NOTE] | ||
| > The website fetches doc pages from GitHub in production, and searches for them at `../db/docs` in development. Your local clone of `TanStack/db` needs to be in the same directory as the local clone of `TanStack/tanstack.com`. | ||
|
|
||
| You can follow these steps to set up the docs for local development: | ||
|
|
||
| 1. Make a new directory called `tanstack`. | ||
|
|
||
| ```sh | ||
| mkdir tanstack | ||
| ``` | ||
|
|
||
| 2. Enter that directory and clone the [`TanStack/db`](https://github.com/TanStack/db) and [`TanStack/tanstack.com`](https://github.com/TanStack/tanstack.com) repos. | ||
|
|
||
| ```sh | ||
| cd tanstack | ||
| git clone git@github.com:TanStack/db.git | ||
| # We probably don't need all the branches and commit history | ||
| # from the `tanstack.com` repo, so let's just create a shallow | ||
| # clone of the latest version of the `main` branch. | ||
| # Read more about shallow clones here: | ||
| # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/#user-content-shallow-clones | ||
| git clone git@github.com:TanStack/tanstack.com.git --depth=1 --single-branch --branch=main | ||
| ``` | ||
|
|
||
| > [!NOTE] | ||
| > Your `tanstack` directory should look like this: | ||
| > | ||
| > ```text | ||
| > tanstack/ | ||
| > | | ||
| > +-- db/ (<-- this directory cannot be called anything else!) | ||
| > | | ||
| > +-- tanstack.com/ | ||
| > ``` | ||
|
|
||
| 3. Enter the `tanstack/tanstack.com` directory, install the dependencies, and run the app in dev mode. | ||
|
|
||
| ```sh | ||
| cd tanstack.com | ||
| pnpm i | ||
| # The app will run on http://localhost:3000 by default | ||
| pnpm dev | ||
| ``` | ||
|
|
||
| 4. Visit http://localhost:3000/db/latest/docs/overview in the browser and see the changes you make in `tanstack/db/docs` there. | ||
|
|
||
| > [!WARNING] | ||
| > You will need to update `docs/config.json` if you add a new documentation page. | ||
|
|
||
| ### Running examples | ||
|
|
||
| - Make sure you've installed dependencies in the repo's root directory. | ||
|
|
||
| ```bash | ||
| pnpm install | ||
| ``` | ||
|
|
||
| - If you want to run an example against your local changes, run the relevant package build/watch command from the repo root if needed. Otherwise, examples may run against the latest published TanStack DB release. | ||
|
|
||
| - Run the example from the selected example directory. | ||
|
|
||
| ```bash | ||
| pnpm dev | ||
| ``` | ||
|
|
||
| #### Note on standalone execution | ||
|
|
||
| If you want to run an example without installing dependencies for the whole repo, follow the instructions from the example's README.md file. It will then run against the latest TanStack DB release. | ||
|
|
||
| ## Changesets | ||
|
|
||
| This repo uses [Changesets](https://github.com/changesets/changesets) to automate releases. If your PR should release a new package version (patch, minor, or major), please run `pnpm changeset` and commit the generated file. If your PR affects docs, examples, styles, etc., you probably don't need to generate a changeset. | ||
|
|
||
| ## Pull requests | ||
|
|
||
| Maintainers merge pull requests by squashing all commits and editing the commit message if necessary using the GitHub user interface. | ||
|
|
||
| Use an appropriate commit type. Be especially careful with breaking changes. | ||
|
|
||
| ## Releases | ||
|
|
||
| For each new commit added to `main`, a GitHub Workflow is triggered which runs the [Changesets Action](https://github.com/changesets/action). This generates a preview PR showing the impact of all changesets. When this PR is merged, the package will be published to npm. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.