根据 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.
- 为什么它告诉我这个包不在项目中?
- 如何删除它以便我可以利用软件包和 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/