版本
入门指南

发布

用法

要以编程方式使用 TanStack 配置 (TanStack Config),可以导入 publish 函数:

ts
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('包发布成功!')
  })
  .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('包发布成功!')
  })
  .catch(console.error)

此编程用法仅适用于 ESM 包 (ESM packages)。要支持此功能,必须在你的 package.json 文件中包含:

json
{
  "type": "module"
}
{
  "type": "module"
}

并使用 import 而非 require

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.