要以程式化的方式使用 TanStack Config (TanStack 配置),你可以匯入 publish 函式:
import { publish } from '@tanstack/config/publish'
// 或
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)
import { publish } from '@tanstack/config/publish'
// 或
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)
程式化使用方式僅適用於 ESM (ES 模組) 套件。要支援此功能,你必須在 package.json 檔案中包含:
json{ "type": "module" }
{ "type": "module" }
並使用 import 而非 require。
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.