Skip to content

Commit 6f6e3bf

Browse files
chore: Introduce changesets
See also: TanStack/config#218
1 parent 2f1d250 commit 6f6e3bf

File tree

7 files changed

+776
-425
lines changed

7 files changed

+776
-425
lines changed

.changeset/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": [
4+
"@svitejs/changesets-changelog-github-compact",
5+
{ "repo": "TanStack/config" }
6+
],
7+
"commit": false,
8+
"access": "public",
9+
"baseBranch": "main",
10+
"updateInternalDependencies": "patch",
11+
"fixed": [],
12+
"linked": [],
13+
"ignore": ["@tanstack/integration-*"]
14+
}

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: pr
1+
name: PR
22

33
on:
44
pull_request:
Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
name: ci
1+
name: Release
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
tag:
7-
description: override release tag
8-
required: false
94
push:
105
branches: [main, alpha, beta]
116

@@ -19,10 +14,11 @@ env:
1914
permissions:
2015
contents: write
2116
id-token: write
17+
pull-requests: write
2218

2319
jobs:
24-
test-and-publish:
25-
name: Test & Publish
20+
release:
21+
name: Release
2622
if: github.repository_owner == 'TanStack'
2723
runs-on: ubuntu-latest
2824
steps:
@@ -34,13 +30,13 @@ jobs:
3430
uses: tanstack/config/.github/setup@main
3531
- name: Run Tests
3632
run: pnpm run test:ci
37-
- name: Publish
38-
run: |
39-
git config --global user.name 'Tanner Linsley'
40-
git config --global user.email 'tannerlinsley@users.noreply.github.com'
41-
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
42-
pnpm run cipublish
33+
- name: Run Changesets (version or publish)
34+
uses: changesets/action@v1.4.9
35+
with:
36+
version: pnpm run changeset:version
37+
publish: pnpm run changeset:publish
38+
commit: 'ci: Version Packages'
39+
title: 'ci: Version Packages'
4340
env:
44-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4542
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
46-
TAG: ${{ inputs.tag }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.12.0
1+
22.13.1

CONTRIBUTING.md

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# Contributing
2+
3+
## Questions
4+
5+
If you have questions about implementation details, help or support, then please use our dedicated community forum at [GitHub Discussions](https://github.com/TanStack/virtual/discussions) **PLEASE NOTE:** If you choose to instead open an issue for your question, your issue will be immediately closed and redirected to the forum.
6+
7+
## Reporting Issues
8+
9+
If you have found what you think is a bug, please [file an issue](https://github.com/TanStack/virtual/issues/new/choose). **PLEASE NOTE:** Issues that are identified as implementation questions or non-issues will be immediately closed and redirected to [GitHub Discussions](https://github.com/TanStack/virtual/discussions)
10+
11+
## Suggesting new features
12+
13+
If you are here to suggest a feature, first create an issue if it does not already exist. From there, we will discuss use-cases for the feature and then finally discuss how it could be implemented.
14+
15+
## Development
16+
17+
If you have been assigned to fix an issue or develop a new feature, please follow these steps to get started:
18+
19+
- Fork this repository.
20+
- Install dependencies
21+
22+
```bash
23+
pnpm install
24+
```
25+
26+
- We use [pnpm](https://pnpm.io/) v9 for package management (run in case of pnpm-related issues).
27+
28+
```bash
29+
corepack enable && corepack prepare
30+
```
31+
32+
- We use [nvm](https://github.com/nvm-sh/nvm) to manage node versions - please make sure to use the version mentioned in `.nvmrc`
33+
34+
```bash
35+
nvm use
36+
```
37+
38+
- Build all packages.
39+
40+
```bash
41+
pnpm build:all
42+
```
43+
44+
- Run development server.
45+
46+
```bash
47+
pnpm run watch
48+
```
49+
50+
- Implement your changes and tests to files in the `src/` directory and corresponding test files.
51+
- Document your changes in the appropriate doc page.
52+
- Git stage your required changes and commit (see below commit guidelines).
53+
- Submit PR for review.
54+
55+
### Editing the docs locally and previewing the changes
56+
57+
The documentations for all the TanStack projects are 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/virtual` docs.
58+
59+
> [!NOTE]
60+
> The website fetches the doc pages from GitHub in production, and searches for them at `../config/docs` in development. Your local clone of `TanStack/virtual` needs to be in the same directory as the local clone of `TansStack/tanstack.com`.
61+
62+
You can follow these steps to set up the docs for local development:
63+
64+
1. Make a new directory called `tanstack`.
65+
66+
```sh
67+
mkdir tanstack
68+
```
69+
70+
2. Enter that directory and clone the [`TanStack/virtual`](https://github.com/TanStack/virtual) and [`TanStack/tanstack.com`](https://github.com/TanStack/tanstack.com) repos.
71+
72+
```sh
73+
cd tanstack
74+
git clone git@github.com:TanStack/virtual.git
75+
# We probably don't need all the branches and commit history
76+
# from the `tanstack.com` repo, so let's just create a shallow
77+
# clone of the latest version of the `main` branch.
78+
# Read more about shallow clones here:
79+
# https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/#user-content-shallow-clones
80+
git clone git@github.com:TanStack/tanstack.com.git --depth=1 --single-branch --branch=main
81+
```
82+
83+
> [!NOTE]
84+
> Your `tanstack` directory should look like this:
85+
>
86+
> ```
87+
> tanstack/
88+
> |
89+
> +-- virtual/ (<-- this directory cannot be called anything else!)
90+
> |
91+
> +-- tanstack.com/
92+
> ```
93+
94+
3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:
95+
96+
```sh
97+
cd tanstack.com
98+
pnpm i
99+
# The app will run on https://localhost:3000 by default
100+
pnpm dev
101+
```
102+
103+
4. Now you can visit http://localhost:3000/virtual/latest/docs/overview in the browser and see the changes you make in `TanStack/virtual/docs` there.
104+
105+
> [!WARNING]
106+
> You will need to update the `docs/config.json` file (in `TanStack/config`) if you add a new documentation page!
107+
108+
You can see the whole process in the screen capture below:
109+
110+
https://github.com/fulopkovacs/form/assets/43729152/9d35a3c3-8153-4e74-9cb2-af275f7a269b
111+
112+
### Running examples
113+
114+
- Make sure you've installed the dependencies in the repo's root directory.
115+
116+
```bash
117+
pnpm install
118+
```
119+
120+
- If you want to run the example against your local changes, run below in the repo's root directory. Otherwise, it will be run against the latest TanStack Virtual release.
121+
122+
```bash
123+
pnpm run watch
124+
```
125+
126+
- Run below in the selected examples' directory.
127+
128+
```bash
129+
pnpm run dev
130+
```
131+
132+
#### Note on standalone execution
133+
134+
If you want to run an example without installing dependencies for the whole repo, just follow instructions from the example's README.md file. It will be then run against the latest TanStack Virtual release.
135+
136+
## Online one-click setup
137+
138+
You can use Gitpod (An Online Open Source VS Code like IDE which is free for Open Source) for developing online. With a single click it will start a workspace and automatically:
139+
140+
- clone the `TanStack/virtual` repo.
141+
- install all the dependencies in `/` and `/docs`.
142+
- run below in the root(`/`) to Auto-build files.
143+
144+
```bash
145+
npm start
146+
```
147+
148+
- run below in `/docs`.
149+
150+
```bash
151+
npm run dev
152+
```
153+
154+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/TanStack/virtual)
155+
156+
## Changesets
157+
158+
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 run `pnpm changeset` and commit the file. If needed, changeset descriptions can be more descriptive, and will be included in the changelog. If your PR affects docs, examples, styles, etc., you probably don't need to generate a changeset.
159+
160+
## Pull requests
161+
162+
Maintainers merge pull requests by squashing all commits and editing the commit message if necessary using the GitHub user interface.
163+
164+
Use an appropriate commit type. Be especially careful with breaking changes.
165+
166+
## Releases
167+
168+
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.

package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
"dev": "pnpm run watch",
2828
"prettier": "prettier --ignore-unknown '**/*'",
2929
"prettier:write": "pnpm run prettier --write",
30-
"cipublish": "node scripts/publish.js",
31-
"cipublishforce": "CI=true pnpm cipublish"
30+
"changeset": "changeset",
31+
"changeset:version": "changeset version && pnpm install && pnpm prettier:write",
32+
"changeset:publish": "changeset publish"
3233
},
3334
"nx": {
3435
"includedScripts": [
@@ -37,17 +38,19 @@
3738
]
3839
},
3940
"devDependencies": {
40-
"@tanstack/config": "^0.16.3",
41+
"@changesets/cli": "^2.28.1",
42+
"@svitejs/changesets-changelog-github-compact": "^1.2.0",
43+
"@tanstack/config": "^0.17.1",
4144
"@testing-library/jest-dom": "^6.6.3",
42-
"@types/node": "^22.10.1",
45+
"@types/node": "^22.13.6",
4346
"eslint": "^9.21.0",
4447
"jsdom": "^25.0.1",
4548
"knip": "^5.45.0",
46-
"nx": "^20.4.6",
49+
"nx": "^20.5.0",
4750
"premove": "^4.0.0",
4851
"prettier": "^3.5.3",
4952
"prettier-plugin-svelte": "^3.3.3",
50-
"publint": "^0.3.7",
53+
"publint": "^0.3.8",
5154
"sherif": "^1.4.0",
5255
"typescript": "5.2.2",
5356
"vite": "^5.4.14",

0 commit comments

Comments
 (0)