Skip to content

Commit f87d53a

Browse files
docs: Separate publish docs from overview
1 parent c2c6697 commit f87d53a

4 files changed

Lines changed: 67 additions & 55 deletions

File tree

docs/build.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ title: Build
55

66
The Vite build setup provided is the culmination of several attempts to make the TanStack libraries work in all environments, including ESM, CJS, the various TypeScript module resolution options, and a diverse bundler ecosystem.
77

8-
# Usage
8+
## Usage
99

1010
The build config is quite opinionated, as it is designed to work with our internal libraries. If you follow the below instructions, it _may_ work for your library too!
1111

12-
## package.json
12+
### package.json
1313

1414
- Ensure `"type": "module"` is set.
1515
- Ensure you have [Vite](https://www.npmjs.com/package/vite) installed. Installing [Publint](https://www.npmjs.com/package/publint) is also recommended.
@@ -34,12 +34,12 @@ The build config is quite opinionated, as it is designed to work with our intern
3434
}
3535
```
3636

37-
## tsconfig.json
37+
### tsconfig.json
3838

3939
- Ensure your `"include"` field includes `"vite.config.ts"`.
4040
- Set `"moduleResolution"` to `"bundler"`.
4141

42-
## vite.config.ts
42+
### vite.config.ts
4343

4444
- Import `mergeConfig` and `tanstackBuildConfig`.
4545
- Merge your custom config first, followed by `tanstackBuildConfig`.
@@ -63,6 +63,6 @@ export default mergeConfig(
6363
)
6464
```
6565

66-
# Caveats
66+
## Caveats
6767

6868
While this config _will_ work with most frameworks with a Vite adapter, it doesn't mean you _should_ use it for all frameworks. For instance, Svelte publishes [@sveltejs/package](https://www.npmjs.com/package/@sveltejs/package), and Angular publishes [ng-packagr](https://www.npmjs.com/package/ng-packagr). When a framework-specific build tool exists, this should be preferred.

docs/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
{
1717
"label": "Build",
1818
"to": "build"
19+
},
20+
{
21+
"label": "Publish",
22+
"to": "publish"
1923
}
2024
]
2125
}

docs/overview.md

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ id: overview
33
title: Overview
44
---
55

6-
TanStack Config allows you to publish, update, and maintain your packages
7-
without having to provide complex configuration.
6+
TanStack Config allows you to publish, update, and maintain your packages without having to provide complex configuration.
87

9-
# Required Pre-Requisites
8+
## Utilities
9+
10+
- [Build](./build)
11+
- [Publish](./publish)
12+
13+
## Required Pre-Requisites
1014

1115
The following tools are required to be installed on the system running TanStack Config scripts:
1216

@@ -17,56 +21,10 @@ The following tools are required to be installed on the system running TanStack
1721

1822
> PNPM is currently the only supported package manager for TanStack Config.
1923
20-
# Installation
24+
## Installation
2125

2226
To install TanStack Config, run the following command:
2327

2428
```bash
2529
pnpm add --save-dev @tanstack/config
2630
```
27-
28-
# Usage
29-
30-
You have two options for using TanStack Config:
31-
32-
- [CLI Usage](#cli-usage)
33-
- [Programmatic Usage](#programmatic-usage)
34-
35-
## CLI Usage
36-
37-
To run the publish script for your package, run the following command:
38-
39-
```bash
40-
pnpm run tanstack-config publish
41-
```
42-
43-
## Programmatic Usage
44-
45-
To use the TanStack Config programmatically, you can import the `publish` function:
46-
47-
```ts
48-
import { publish } from '@tanstack/config';
49-
50-
publish({
51-
branchConfigs: configOpts.branchConfigs,
52-
packages: configOpts.packages,
53-
rootDir: configOpts.rootDir,
54-
branch: process.env.BRANCH,
55-
tag: process.env.TAG,
56-
ghToken: process.env.GH_TOKEN,
57-
})
58-
.then(() => {
59-
console.log('Successfully published packages!');
60-
})
61-
.catch(console.error)
62-
```
63-
64-
> The programmatic usage is only available for ESM packages. To support this, you have to have:
65-
>
66-
> ```json
67-
> {
68-
> "type": "module"
69-
> }
70-
> ```
71-
>
72-
> in your `package.json` file and use `import` instead of `require`.

docs/publish.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
id: publish
3+
title: Publish
4+
---
5+
6+
## Usage
7+
8+
You have two options for using TanStack Config to publish:
9+
10+
- [CLI Usage](#cli-usage)
11+
- [Programmatic Usage](#programmatic-usage)
12+
13+
### CLI Usage
14+
15+
To run the publish script for your package, run the following command:
16+
17+
```bash
18+
pnpm run tanstack-config publish
19+
```
20+
21+
### Programmatic Usage
22+
23+
To use the TanStack Config programmatically, you can import the `publish` function:
24+
25+
```ts
26+
import { publish } from '@tanstack/config';
27+
28+
publish({
29+
branchConfigs: configOpts.branchConfigs,
30+
packages: configOpts.packages,
31+
rootDir: configOpts.rootDir,
32+
branch: process.env.BRANCH,
33+
tag: process.env.TAG,
34+
ghToken: process.env.GH_TOKEN,
35+
})
36+
.then(() => {
37+
console.log('Successfully published packages!');
38+
})
39+
.catch(console.error)
40+
```
41+
42+
> The programmatic usage is only available for ESM packages. To support this, you have to have:
43+
>
44+
> ```json
45+
> {
46+
> "type": "module"
47+
> }
48+
> ```
49+
>
50+
> in your `package.json` file and use `import` instead of `require`.

0 commit comments

Comments
 (0)