[英]How to build /dist in an unpublished version of an npm module?
Working on a pull request for this module: https://github.com/echoulen/react-pull-to-refresh ...处理此模块的拉取请求: https://github.com/echoulen/react-pull-to-refresh ...
I believe the published module builds /dist
in the package.json prepublish
npm script.我相信已发布的模块在 package.json prepublish
npm 脚本中构建/dist
。 I am using the module locally with my github branch installed via yarn add https://github.com/jbeuckm/react-pull-to-refresh
.我在本地使用该模块,我的 github 分支通过yarn add https://github.com/jbeuckm/react-pull-to-refresh
安装。
The problem is when I try to build my (consuming) project in a bitbucket pipeline.问题是当我尝试在 bitbucket 管道中构建我的(消费)项目时。 The pipeline fails when the react-js-pull-to-refresh
module can not be resolved.当react-js-pull-to-refresh
模块无法解析时,管道失败。 I suspect this is because the /dist
folder is built in prepublish
and my version is not published.我怀疑这是因为/dist
文件夹是在prepublish
中构建的,而我的版本没有发布。
How can I tell npm to build /dist
in my unpublished repo module when building the consuming project?在构建消费项目时,如何告诉 npm 在我未发布的 repo 模块中构建/dist
?
You can change the prepublish
script in your package.json
to prepare
instead.您可以更改package.json
中的prepublish
脚本以进行prepare
。 The prepare
script should run on the consuming project when installing the dependency.安装依赖项时, prepare
脚本应在使用项目上运行。
According to the docs ( https://docs.npmjs.com/cli/install under the bullet-point npm install <git remote url>
):根据文档( https://docs.npmjs.com/cli/install下的项目符号npm install <git remote url>
):
If the package being installed contains a
prepare
script, its dependencies and devDependencies will be installed, and the prepare script will be run, before the package is packaged and installed.如果正在安装的 package 包含prepare
脚本,则在 package 打包安装之前,将安装其依赖项和 devDependencies,并运行 prepare 脚本。
Check out https://docs.npmjs.com/misc/scripts#prepublish-and-prepare查看https://docs.npmjs.com/misc/scripts#prepublish-and-prepare
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.