To install the package, run the following command:
pnpm add -D @tanstack/publish-config
To use the TanStack Config programmatically, you can import the publish function:
import { publish } from '@tanstack/publish-config'
publish({
branchConfigs: configOpts.branchConfigs,
packages: configOpts.packages,
rootDir: configOpts.rootDir,
branch: process.env.BRANCH,
tag: process.env.TAG,
ghToken: process.env.GH_TOKEN,
})
.then(() => {
console.log('Successfully published packages!')
})
.catch(console.error)
The programmatic usage is only available for ESM packages. To support this, you have to have:
json{ "type": "module" }in your package.json file and use import instead of require.
Trusted publishing is the new npm strategy to allow publishing packages without npm tokens, using OIDC authentication. It currently requires you to set up for each package individually; however, once enabled, no further interaction is required!
