Assist in publishing NPM packages, git tag git release
pnpm add @cn_zth/npm-cli -D
import { cli } from '@cn_zth/npm-cli'
import type { TContext, TPlugin } from '@cn_zth/npm-cli'
const config: TPlugin = async function (ctx: TContext) {
ctx.config.logPrefix = 'npm-cli'
ctx.config.allowedBranch = ['master']
ctx.config.packageManage = 'pnpm'
ctx.config.ignoreGitChangeFiles?.push(...['package.json'])
ctx.config.pkgName = 'your pkg name'
ctx.config.firstCall = 'publishNpm'
}
config.lifecycle = 'config'
// ... some other plugins
// For more information, please refer to the scripts/publish.ts under the current project
const before: TPlugin[] = [config]
const after: TPlugin[] = []
await cli([...before, ...after])
name | type | default | description |
---|---|---|---|
logPrefix | string | npm-cli | Typescript: string | undefined . Log printing prefix |
registry | string | https://registry.npmjs.org/ | Typescript: string | undefined . Npm source url |
pkgName | string | - | Typescript: string | undefined . Package name to be published |
packageManage | string | pnpm | Typescript: npm | yarn | pnpm | undefined . package management tools |
allowedBranch | array | ['master'] | Typescript: string[] | undefined . Branches that allow operations |
firstCall | string | createTag | Typescript: publishNpm | createTag | createRelease | undefined . Scheduling sequence |
ignoreGitChangeFiles | array | ['yarn.lock', 'yarn-error.log', 'package-lock.json', 'pnpm-lock.yaml'] | Typescript: string[] | undefined . Ignore files with git changes |
MIT