简体   繁体   English

Visual Studio NodeJS工具-如何打包项目? 创建NPM?

[英]Visual Studio NodeJS Tools - How to Package Project? Create NPM?

I've got a VS2013 solution with a mix of NodeJS (using TypeScript) and C# class library projects (they're bound together by EdgeJS). 我有一个VS2013解决方案,其中混合了NodeJS(使用TypeScript)和C#类库项目(它们由EdgeJS绑定在一起)。 Where the NodeJS projects are concerned, one can be considered a library (for a RabbitMQ bus implementation), two are applications which are meant to be hosted as part of a fourth project with both using the bus. 在涉及NodeJS项目的地方,可以将一个视为库(对于RabbitMQ总线实现),两个是应作为第四项目的一部分托管的应用程序,两者均使用该总线。

So, one project ( host ) which will depend on three projects ( bus , app1 and app2 ) (it starts the bus , and passes it to app1 and app2 ). 因此,一个项目( 主机 )将依赖于三个项目( busapp1app2 )(它将启动bus并将其传递给app1app2 )。

Of course, I could just lump all these projects together and be done with it - but that's a horrible idea. 当然,我可以将所有这些项目放在一起并完成它-但这是一个可怕的想法。

How do I package these projects up for proper reuse and referencing (like assemblies in traditional .NET)? 如何打包这些项目以进行正确的重用和引用(如传统.NET中的程序集)?

Is that best done with NPM? NPM最好做到吗? If so, does VS provide anything in this area? 如果是这样,VS是否在这方面提供任何服务? If not, then what? 如果没有,那又如何?

Note that, aside from the Bus project, I'm not looking to release these publicly - I'm not sure if that changes anything. 请注意,除了Bus项目外,我不想公开发布这些内容-我不确定这是否会改变任何内容。

In general, if something can be bundled together as an independent library, then it's best to consider this a Node package and thus, refactor that logic out to it's own project. 通常,如果可以将某些东西捆绑在一起作为一个独立的库,那么最好将其视为Node包,从而将逻辑重构到自己的项目中。 It sounds like you've already done this to some extent, separating out your bus , app1 , and app2 projects. 听起来您已经完成了一定程度的工作,将busapp1app2项目分离了出来。 I would recommend they each have their own Git repositories if they are separate packages. 如果它们是单独的软件包,我建议它们每个都有自己的Git存储库。

Here's some documentation to get you started with Node packages: https://www.npmjs.org/doc/misc/npm-developers.html 以下是一些文档,可帮助您开始使用Node软件包: https : //www.npmjs.org/doc/misc/npm-developers.html

The host project, if it's not something you would package but instead deploy, probably does not need to be bundled as a Node package. host项目,如果不是您要打包的东西,而是部署的话,可能不需要捆绑为Node包。 I would instead just consider this something that would be pulled down from Git and started on some server machine. 相反,我会考虑将其从Git下拉并在某些服务器上启动的东西。

With all that said, your last line is important: 综上所述,您的最后一行很重要:

I'm not looking to release these publicly 我不想公开发布这些内容

GitHub does have private repositories, but as of now npmjs.org does not have private repositories. GitHub确实有私有存储库,但是到目前为止npmjs.org还没有私有存储库。 There are options to create your own private repository ( Sinopia and Kappa offer different ways of accomplishing this), but if you don't want this code available for everyone do not deploy it do npmjs.org. 您可以选择创建自己的私有存储库( SinopiaKappa提供了不同的方法来实现此目的),但是如果您不希望每个人都可以使用此代码,请不要部署npmjs.org。 You can still package it up in the way I've outlined it above, just not deploy it as of yet. 您仍然可以按照我上面概述的方式打包它,只是暂时不部署它。

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

相关问题 如何使用zeit / pkg npm软件包将NodeJs项目打包为可执行文件? - How to package NodeJs project into an executable with zeit/pkg npm package? 如何在Visual Studio 2015中禁用NPM包还原? - How can I disable NPM package restore in Visual Studio 2015? 我对 npm package nexe 和 Visual Studio 有问题,试图在 an.exe 中转换 nodejs 应用程序 - I have a problem with npm package nexe and visual studio, trying to convert a nodejs app in an .exe 使用Angular和NodeJS Tools for Visual Studio构建NodeJS应用程序 - Structuring a NodeJS app using Angular and NodeJS Tools for Visual Studio 如何构建和部署在 Visual Studio 中创建的 Nodejs 控制台项目 - How to build and deploy a Nodejs console project created in Visual Studio Visual Studio 2015 Node.js工具NPM版本 - Visual Studio 2015 Node.js tools npm version 是否可以为SailsJs项目创建npm包? - is it possible to create npm package for SailsJs project? 使用 yarn 在 Visual Studio Code 中运行 NodeJS 项目 - Running NodeJS project in Visual Studio Code with yarn Visual Studio 2013 NodeJS工具,TypeScript,保留注释 - Visual Studio 2013 NodeJS Tools, TypeScript, Keep Comments 如何通过一组脚本而不是“npm start”从 Visual Studio 运行和调试 NodeJS 项目? - How do I run and debug NodeJS projects from Visual Studio through a set of scripts instead of "npm start"?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM