Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
92 views
in Technique[技术] by (71.8m points)

How to build a Meteor smart package

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

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

question from:https://stackoverflow.com/questions/10114526/how-to-build-a-meteor-smart-package

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Meteor now supports a create --package command.

See the meteor docs.

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

meteor create --package cunneen:foo

Output:

cunneen:foo: created in your app

Results:

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 (empty file)

// 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 (empty file)

# cunneen:foo package

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...