@kinngyo/np
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

np

基于 npm 命令快速生成发布版本,方便发布npm包

免安装(推荐)

# 查看使用
npx @kinngyo/np --help

# 查看版本
npx @kinngyo/np --version

# 发布
npx @kinngyo/np --remote=false --tag=beta --access=public --registry=https://registry.npmjs.org/

安装

yarn add @kinngyo/np -D
# 或者
npm i @kinngyo/np --save-dev

命令使用

# 查看使用
np --help

# 查看版本
np --version

# 发布
np --remote=false --tag=beta --access=public --registry=https://registry.npmjs.org/

命令参数

参数 类型 必填 可选 说明 默认值
-h, --help string -- 查看帮助 --
-v,--version string -- 版本 --
--remote boolean --- 是否远程查询该包版本 true
---no-remote boolean -- 禁止远程查询该包版本 --
--tag string -- 发布时候的 tag 标签 --
--access string - 私有包访问权限 public
--registry string -- 发布源 --

API使用

import NpmPublish from '@kinngyo/np'

const np = new NpmPublish(root:string)

np.publish(option: Partial<INpOption>)

type

interface INpOption {
    remote: boolean
    tag: string
    access: string
    registry: string
}

API参数

属性 类型 必填 可选 说明 默认值
remote boolean true/false 是否远程查询该包版本 true
tag string - 发布时候的 tag 标签 'latest'
access string 私有包访问权限 'public'
registry string - 发布源 --

publishConfig

  • 命令、api调用都可以通过publishConfig设置
{
    "publishConfig": {
        "registry": "https://registry.npmjs.org/",
        "access": "public",
        "tag": "beta"
    }
}

优先级别

命令(API)参数 > publishConfig > 默认

注意

  • 1.请确保npm login登录状态
  • 2.如果是远程git代码,需要commit本地代码

Readme

Keywords

none

Package Sidebar

Install

npm i @kinngyo/np

Weekly Downloads

1

Version

0.0.3

License

none

Unpacked Size

18.3 kB

Total Files

6

Last publish

Collaborators

  • kinngyo