使用Meteor JS编写命令行工具? [英] Use Meteor JS to write command line tool?

查看:81
本文介绍了使用Meteor JS编写命令行工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据流星文档,每次运行 meteor create 时,都会安装一个基本的 webapp 软件包,以提供流星应用中的webapp功能。 文档说:

According to meteor documentation, a fundamental webapp package is installed every time you run meteor create to provide the "webapp" functionality in your meteor app. The documentation says:


...您可以轻松地构建没有它的Meteor应用程序-例如,如果您要制作仍使用Meteor软件包系统和DDP的命令行工具。

...You can easily build a Meteor app without it - for example if you wanted to make a command-line tool that still used the Meteor package system and DDP.

我将其理解为可以删除软件包,但是当我运行 meteor remove webapp 时,它会吐回来:

I understood this as "you can remove the package", but when I run meteor remove webapp it spits this back:

webapp is not in this project.




  1. 为什么告诉我这个软件包不在项目中? / li>
  2. 如何删除它,以便可以利用软件包和ddp编写命令行实用程序而不必为不必要的Web服务器占用端口?


推荐答案

是的,每个流星应用程序都需要一个主要功能,如果您使用流星平台,则会自动添加webapp软件包其中包括一个主要的。您可以删除流星平台,它是对所有核心流星软件包执行api.imply的包装程序,并手动从流星添加所需的软件包(例如mongo,tracker等),然后添加主要功能。

Yes you can, every meteor app needs a main function and if you use meteor-platform, the webapp package will be automatically added which includes a main. You can remove meteor-platform, which is a wrapper package that does api.imply of all the core meteor packages, and add the packages you need from meteor manually, such as mongo, tracker, etc., and then add a main function.

我写了一篇有关用流星编写命令行程序的博客文章:

I have written a blog post about writing command line programs with meteor:

http://practicalmeteor.com/writing-command-line-programs-with-meteor/

此外,作为用流星编写许多命令行程序的一部分,我们创建了 pracitcalmeteor:mcli 软件包,它为您提供了一些不错的功能,包括命令注册,命令行选项和参数解析,以及在开发模式下运行命令的工具,其中开箱即用无法进行命令行解析。让我知道它的工作原理。

In addition, as part of writing many command line programs with meteor, we created the pracitcalmeteor:mcli package which provides you with some nice extras, including command registration, command line options and argument parsing, and tools to run your commands in development mode, where command line parsing is not possible out of the box. Let me know how it works for you.

干杯,
Ronen

Cheers, Ronen

这篇关于使用Meteor JS编写命令行工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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