简体   繁体   English

打包 Node.js 应用程序

[英]Packaging a Node.js Application

I'm developing a Strapi base project (A headless cms written with node.js).我正在开发一个 Strapi 基础项目(用 node.js 编写的无头 cms)。 I want to package my app so I can install it in other projects as a dependency and take the development further from there (ie I want to develop an e-commerce web app or something like that in other areas).我想 package 我的应用程序,以便我可以将它作为依赖项安装在其他项目中,并从那里进一步开发(即我想开发电子商务 web 应用程序或其他领域的类似应用程序)。 My need is if there was ever a bug in the base project, after solving the bug, I want to go into the final projects and bump the base project version in package.json and prevent myself from repeating the bug fix on each final individual project (DRY).我的需要是,如果基础项目中有错误,在解决错误后,我想将 go 放入最终项目中,并将基础项目版本添加到package.json (干燥的)。

Any suggestions?有什么建议么?

Welcome to stackoverflow, this question is a bit broad, but it's your first one so I'll let ya have it.欢迎来到stackoverflow,这个问题有点宽泛,但这是你的第一个问题,所以我会让你知道的。 Normally you should show what you've tried, examples of code that isn't working etc. ;-)通常,您应该展示您尝试过的内容,无效的代码示例等。;-)

What you're talking about is a private npm package see this to start and then this for being able to use it via npm install.你在说的是一个私有的 npm package 看到这个开始然后这个能够通过 npm 安装使用它。

It's a fairly common pattern in teams that have shared libraries, an NPM package is simply a set of javascript functions you can install from npm for convenience.这是具有共享库的团队中相当常见的模式,NPM package 只是一组 javascript 函数,您可以从 javascript 安装方便。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM