Before we publish our package, we want to make sure everything is set up correctly. We’ll cover versioning, preparing our package, adding a proper README, and updating our package.json.

Using npm version:

The reason to use npm version to prumping the version, is because it create a version commit and tag.

npm version patch

Setup a pre- and post- scripts:

"prepare": "yarn run build",
"postpublilsh": "git push --tags"

peerDependenices:

You might also need to update peerDependencies in order to info the user which verison of react is minimue required.

"peerDependencies": {
"react": ">=16.8.6"
}

publishConfig:

Depend on your package name:

// A
"name": "some-react-hooks" //B
"name": "@zhentiw/some-react-hooks" //@<user-name>/package-name

If you are using B version, it default to a private npm package, if you want to make it public:

"publishConfig": {
"access": "public"
}

[NPM + React] Prepare a Custom React Hook to be Published as an npm Package的更多相关文章

  1. [React] Write a Custom React Effect Hook

    Similar to writing a custom State Hook, we’ll write our own Effect Hook called useStarWarsQuote, whi ...

  2. [React] Write a Custom State Hook in React

    Writing your own custom State Hook is not as a daunting as you think. To keep things simple, we'll r ...

  3. 【React 资料备份】React Hook

    Hooks是React16.8一个新增项,是我们可以不用创建class组件就能使用状态和其他React特性 准备工作 升级react.react-dom npm i react react-dom - ...

  4. [React] Reduce Code Redundancy with Custom React Hooks

    In this lesson, we'll cover how to create a custom React hook for managing the state of any input. T ...

  5. React报错之React Hook 'useEffect' is called in function

    正文从这开始~ 总览 为了解决错误"React Hook 'useEffect' is called in function that is neither a React function ...

  6. React报错之React hook 'useState' cannot be called in a class component

    正文从这开始~ 总览 当我们尝试在类组件中使用useState 钩子时,会产生"React hook 'useState' cannot be called in a class compo ...

  7. [React] Validate Custom React Component Props with PropTypes

    In this lesson we'll learn about how you can use the prop-types module to validate a custom React co ...

  8. React报错之React Hook useEffect has a missing dependency

    正文从这开始~ 总览 当useEffect钩子使用了一个我们没有包含在其依赖数组中的变量或函数时,会产生"React Hook useEffect has a missing depende ...

  9. React报错之React hook 'useState' is called conditionally

    正文从这开始~ 总览 当我们有条件地使用useState钩子时,或者在一个可能有返回值的条件之后,会产生"React hook 'useState' is called conditiona ...

随机推荐

  1. JVM性能调优的6大步骤,及关键调优参数详解

    JVM性能调优方法和步骤1.监控GC的状态2.生成堆的dump文件3.分析dump文件4.分析结果,判断是否需要优化5.调整GC类型和内存分配6.不断分析和调整JVM调优参数参考 对JVM内存的系统级 ...

  2. python并发编程之IO模型 同步 异步 阻塞 非阻塞

    IO浅谈 首先 我们在谈及IO模型的时候,就必须要引入一个“操作系统”级别的调度者-系统内核(kernel),而阻塞非阻塞是跟进程/线程严密相关的,而进程/线程又是依赖于操作系统存在的,所以自然不能脱 ...

  3. 深度学习-生成对抗网络GAN笔记

    生成对抗网络(GAN)由2个重要的部分构成: 生成器G(Generator):通过机器生成数据(大部分情况下是图像),目的是“骗过”判别器 判别器D(Discriminator):判断这张图像是真实的 ...

  4. Scala 安装 Scala for Eclipse安装及运行hello word

    Scala下载安装地址:https://www.scala-lang.org/download/ .windows版本的安装包是scala-2.12.8.msi.直接滑动到网页最下面,下载对应的系统的 ...

  5. android studio下 library打包文件(.aar)和本地引用

    关键点: 利用Gradle发布本地maven库支持android library 打包文件(*.aar) 的本地引用 开发环境: windows7 64位操作系统 android studio0.5. ...

  6. ELK学习笔记之配置logstash消费kafka多个topic并分别生成索引

    0x00 filebeat配置多个topic filebeat.prospectors: - input_type: log encoding: GB2312 # fields_under_root: ...

  7. drf中的各种view,viewset

    drf中的各种view,viewset Django REST framework里有各种各样的view,让我有点蒙,得好好捋一捋这关系. 视图的作用 Django用"视图"这个概 ...

  8. 继承与构造函数(base关键字)

    1.背景 我:虽然通过继承减少了代码冗余,但是,每一个子类的构造函数还是需要给所有属性赋值的,很麻烦的. 师:这个好办,用base就行啦. 我:贝司?还吉他呢! 师:别急,首先我们先介绍下实例化子类对 ...

  9. 遍历切片slice,结构体struct,映射map,interface{}的属性和值

    1 前言 说明:interface{}必须是前三者类型 2 代码 /** * @Author: FB * @Description: * @File: testOutput.go * @Version ...

  10. 2019 朗玛信息java面试笔试题 (含面试题解析)

    本人3年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.朗玛信息等公司offer,岗位是Java后端开发,最终选择去了朗玛信息. 面试了很多家公司,感觉大部分公司考察的点 ...