Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
106 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...