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. MyBatis 学习笔记(七)批量插入ExecutorType.BATCH效率对比

    MyBatis 学习笔记(七)批量插入ExecutorType.BATCH效率对比一.在mybatis中ExecutorType的使用1.Mybatis内置的ExecutorType有3种,默认的是s ...

  2. leetcode动态规划笔记一---一维DP

    动态规划 刷题方法 告别动态规划,连刷 40 道题,我总结了这些套路,看不懂你打我 - 知乎 北美算法面试的题目分类,按类型和规律刷题 题目分类 一维dp House Robber : 求最大最小值 ...

  3. mysql连接不释放

    环境: 持久层:JPA 数据库连接池:druid 数据库中间件:Mycat 数据库:Mysql 报错: Unable to acquire JDBC Connection 排查步骤: 方法一: 1.d ...

  4. 2019 拼多多java面试笔试题 (含面试题解析)

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

  5. python基础知识(七)---数据类型补充、"雷区"、编码

    数据类型补充."雷区".编码 1.数据类型补充 str: #字符串数据类型补充 s1=str(123) #常用于类型转换 print(s1) #capitalize()首字母大写 ...

  6. iptables限制访问

    iptables限制访问 常用命令 # 查看规则 iptables -L INPUT --line-numbers # 开放指定的端口 iptables -A INPUT -p tcp --dport ...

  7. 十大Intellij IDEA快捷键(附IDEA快捷键详细列表及使用技巧)

    十大Intellij IDEA快捷键(附IDEA快捷键详细列表及使用技巧) Intellij IDEA中有很多快捷键让人爱不释手,stackoverflow上也有一些有趣的讨论.每个人都有自己的最爱, ...

  8. 使用Prometheus针对自己的服务器采集自定义的参数

    用一个简单的例子来说明. 我用express和http搭了一个最简单的服务器,监听在8081端口上. 在metrics endpoint上,我会打印出这个服务器从启动至今,服务了多少次请求.这里我只是 ...

  9. Spark实现二次排序

    一.代码实现 package big.data.analyse.scala.secondsort import org.apache.log4j.{Level, Logger} import org. ...

  10. day 20 作业

    作业 1.下面这段代码的输出结果将是什么?请解释. class Parent(object): x = 1 class Child1(Parent): pass class Child2(Parent ...