[英]How to modify an npm package built with TypeScript
I want to try and make some changes to a package published in npm? 我想尝试对npm中发布的软件包进行一些更改吗? (I've suggest some changes as an issue but I think they are simple enough for me to attempt them).
(我建议将一些更改作为问题,但我认为这些更改很简单,我可以尝试一下)。
https://www.npmjs.com/package/bt-presence#contributing--modifying https://www.npmjs.com/package/bt-presence#contributing--modifying
The author supplies some information on how to modify the package, but not really enough for someone doing it for the first time. 作者提供了有关如何修改程序包的一些信息,但对于初次使用该程序包的人来说确实不够。
npm run build
- where is this run from? npm run build
从哪里运行? The root folder of the package where the package.json
is? package.json
所在的package.json
的根文件夹? package.json
? package.json
吗? In general what is the best way to develop something like this for npm? 通常,为npm开发类似内容的最佳方法是什么? I've worked on packages before but they were simply Javascript.
我之前曾研究过软件包,但它们只是Javascript。
bt-presence
package in isolation, you can put the cloned repository anywhere. bt-presence
包,则可以将克隆的存储库放在任何地方。 If you want to use your modified version of bt-presence
in combination with an application, my recommended approach is to register bt-presence
as a dependency in the application's package.json
file with the version set to a relative path to your bt-presence
repository; bt-presence
版本,我建议的方法是在应用程序的package.json
文件中将bt-presence
注册为依赖项,并将版本设置为bt-presence
的相对路径。库; then running npm install
in the application will make a symlink from node_modules/bt-presence
in the application to your bt-presence
repository. npm install
将建立从应用程序中的node_modules/bt-presence
到您的bt-presence
存储库的符号链接。 npm run build
should indeed be run from the root folder that contains the package.json
of bt-presence
. npm run build
应该从包含bt-presence
的package.json
的根文件夹中运行。 bt-presence
, you won't need to modify its package.json
. bt-presence
的代码,则无需修改其package.json
。 You would only modify the package.json
if you need to change any of the settings in there, eg, if you need to add additional dependencies to your version of bt-presence
. bt-presence
版本添加其他依赖项)时,才修改package.json
。 None of the above is really specific to TypeScript. 以上内容都不是真正针对TypeScript的。 (Some JavaScript packages have build processes too if they need to transform or package the JavaScript files in some way.)
(如果某些JavaScript程序包需要以某种方式转换或打包JavaScript文件,它们也具有构建过程。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.