javascript - 用Meteor JS写命令行工具?

标签 javascript configuration meteor

根据 meteor 文档,每次运行 meteor create 时都会安装一个基本的 webapp 包,以在您的 meteor 应用程序中提供“webapp”功能。 documentation说:

...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 时,它会返回:

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

最佳答案

是的,每个 meteor 应用程序都需要一个 main 函数,如果您使用 meteor-platform,webapp 包将自动添加,其中包含一个 main.可以去掉meteor-platform这个对所有核心meteor包做api.imply的wrapper包,手动从meteor中添加你需要的包,比如mongo,tracker等,然后添加一个main函数。

我写了一篇关于用 meteor 编写命令行程序的博文:

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

此外,作为使用 meteor 编写许多命令行程序的一部分,我们创建了 pracitcalmeteor:mcli包,它为您提供了一些不错的额外功能,包括命令注册、命令行选项和参数解析,以及在开发模式下运行命令的工具,在开发模式下命令行解析是不可能开箱即用的。让我知道它如何为您服务。

干杯, 罗嫩

关于javascript - 用Meteor JS写命令行工具?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26247875/

相关文章:

visual-studio - 使用网站项目在 Visual Studio Dev Server 上设置静态端口号

java - EMR - 在 Hadoop(和 YARN)中使用自定义日志记录附加程序

node.js - Meteor 1.3模块结构

javascript - struts2 textarea只给一个word添加样式

javascript - html/css3 - 曲线

javascript - react : controlled inputs in functional components using useState

javascript - npm install package.json 中指定的确切包版本

javascript - Javascript如何存储数值?

.net - 如何创建包含集合集合的配置节?

javascript - Meteor 中无限滚动实现的订阅行为