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. tkinter中Partial Function Example

    from functools import partial as pto from tkinter import Tk, Button, X from tkinter.messagebox impor ...

  2. Spring Boot与mybatis整合

    完整的项目截图 一:pom依赖 新增ojdbc6及batis-spring-boot-starter依赖 <dependency> <groupId>com.oracle< ...

  3. 初学zipkin搭建链路追踪服务注意事项

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/fsy9595887/article/det ...

  4. 使用 kill 命令杀死 java进程,你用对了吗?

    在本地调试agent相关功能,需要经常性的杀掉Java进程,验证一些极端情况. 每次都是本能执行如下步骤 jps kill -9 <pid> reboot 有一次验证,发现代码中添加的Sh ...

  5. System.InvalidOperationException:“寄宿 HWND 必须是子窗口。”

    原文:System.InvalidOperationException:"寄宿 HWND 必须是子窗口." 当试图在 WPF 窗口中嵌套显示 Win32 子窗口的时候,你有可能出现 ...

  6. 浏览器提示:源映射错误:request failed with status 404 源 URL:http://xxx.js 源映射 URL:jquery.min.map

    浏览器 jquery1.9.1min.js 报脚本错误 无jquery.min.map 文件 最近在浏览个人网站的时候就遇到了这个问题 我先说一下什么是source map文件. source map ...

  7. zookeeper介绍(4)zookeeper的完整分布式

    参考: zookeeper的单机和伪分布式教程请参考:zookeeper介绍(1)zookeeper介绍与安装 Zookeeper的完整分布式集群搭建: 准备好三台centos主机:(在这我使用的是z ...

  8. Java多线程 常见问题整理

    线程 什么是线程 线程是指程序在执行过程中,能够执行程序代码的一个执行单元. 线程和进程的区别 线程:一段程序执行过程中的一个执行单元,各个线程之间共享程序的内存空间以及一些进程级的资源,各线程拥有自 ...

  9. pycharm 专业注册

    pycharm的bin目录下pycharm.exe.vmoptions和pycharm64.exe.vmoptions两个配置文件添加 这个路径  -javaagent:E:\PyCharm 2017 ...

  10. ajax请求处理概要

    /** *不关心参数传递与参数返回的形式. */ url = ctxPath + '/ccb/xxx '; $.get(url); $.post(url); /** * 常见形式. */ var ur ...