您应该将流类型的文件夹发布到NPM吗? [英] should you publish your flow-typed folder to NPM?

查看:59
本文介绍了您应该将流类型的文件夹发布到NPM吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否以及在什么条件下将flow-typed文件夹发布到软件包中的NPM.也许(以及我一直在想的)答案永远不会过去,这取决于应用程序开发人员使用流类型化的自身,但是flow-typed install可能只为他们声明自己的依赖项定义,而不是为程序包中的依赖项定义.

I'm wondering if and under what conditions you should publish your flow-typed folder to NPM in your packages. Perhaps (and what I've been thinking) the answer is never, and it's up to application developers to use flow-typed themselves, but perhaps flow-typed install only picks up definitions for dependencies they have declared themselves, rather than dependencies within packages.

因此,简而言之,如果您的程序包具有非对等流程类型的依赖关系,我应该发布我的flow-typed文件夹还是我应该忽略它?

So in short, if your package has non-peer flow-typed dependencies, should I be publishing my flow-typed folder or I should I npmignore it?

推荐答案

您永远不要发布此文件夹.我认为,除非您不必要地增加了程序包的大小,否则如果您发布它,不会有任何不好的事情发生.但是也不会发生什么好事.

You should never publish this folder. I don't think anything bad will happen if you do publish it, besides just unnecessarily increasing your package size. But nothing good will happen either.

flow-typed的要点是,如果使用这些库定义,则Flow 不必检查库代码.相反,它采用给定的库定义.如果我使用了您的库,则项目中的Flow不会类型检查您的库.因此,它不需要了解有关您的依赖项的任何信息.

The point of flow-typed is that if you use those library definitions, Flow does not have to check the library code. Instead, it takes the library definitions as given. If I consume your library, Flow in my project is not type checking your library. Therefore, it does not need to know anything about your dependencies.

当然,这取决于您还将库接口发布到flow-typed.不幸的是,尚不存在使此操作变得容易的工具,但这是正确的做法.如果您只是将源发布到npm,则客户端可能使用的Flow版本与您使用的版本不同,因此客户端可能会看到由于版本差异而导致的无法操作的错误消息(因为几乎每个Flow版本都是一项重大更改).您可能还具有不同的.flowconfig选项,即使Flow版本匹配,也可能导致错误.

Of course, this hinges upon you publishing your library interface to flow-typed as well. Unfortunately, the tools do not yet exist to make this easy, but it is the correct thing to do. If you just publish your source to npm, clients may be using a different version of Flow than you used, and so they may see unactionable error messages that are simply due to version differences (since nearly every Flow release is a breaking change). You may also have different .flowconfig options which could result in errors even if the Flow version matches.

这篇关于您应该将流类型的文件夹发布到NPM吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆