如何构建 Meteor 智能包 [英] How to build a Meteor smart package

查看:17
本文介绍了如何构建 Meteor 智能包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何构建一个 Meteor 智能包,它会出现在 meteor list?

How can one build a Meteor smart package that would show up in meteor list?

构建Atmosphere 包相当不错已记录,但未构建 Meteor 包.

Building Atmosphere packages is reasonably well documented, but building Meteor packages isn't.

推荐答案

Meteor 现在支持 create --package 命令.

Meteor now supports a create --package command.

请参阅流星文档.

示例(将cunneen"替换为您自己的meteor 开发者帐户):

Example (substitute your own meteor developer account for "cunneen"):

meteor create --package cunneen:foo

输出:

cunneen:foo:在你的应用中创建

结果:

packages/cunneen:foo/package.js

Package.describe({
  name: 'cunneen:foo',
  version: '0.0.1',
  // Brief, one-line summary of the package.
  summary: '',
  // URL to the Git repository containing the source code for this package.
  git: '',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.0.3.1');
  api.addFiles('cunneen:foo.js');
});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('cunneen:foo');
  api.addFiles('cunneen:foo-tests.js');
});

packages/cunneen:foo/foo.js(空文件)

// Write your package code here!

packages/cunneen:foo/foo-tests.js

// Write your tests here!
// Here is an example.
Tinytest.add('example', function (test) {
  test.equal(true, true);
});

packages/cunneen:foo/README.md(空文件)

# cunneen:foo package

一个好的(非常全面的)例子,看看iron-router.

For a good (VERY comprehensive) example, take a look at iron-router.

这篇关于如何构建 Meteor 智能包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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