MeteorCommunity / discussions

Track technical discussions in the Meteor community
89 stars 7 forks source link

Lookup code documentation from Meteor CLI #16

Open raix opened 9 years ago

raix commented 9 years ago

Say I'm writing an app - and I want the code documentation for some api in meteor or packages...

It would be nice if one could do:

$ meteor add cfs:power-queue

# What is exported from this package?
$ meteor show cfs:power-queue
"PowerQueue is a powerful tool for handling async tasks, throtling etc."
PowerQueue is a native Meteor package for memory-backed job queue processing.

Exports:
* PowerQueue (Anywhere)

Weak dependencies:
* cfs:reactive-list "ReactiveList provides a small, fast queue/list built for Power-Queue"
* cfs:micro-queue "Micro-queue provides a small, fast queue/list built for Power-Queue"

Repository: https://github.com/CollectionFS/Meteor-power-queue

# What exports are available in my app code?
$ meteor doc
This app have following api from packages:
* Meteor
* Tracker
* Mongo
...
* PowerQueue

# Look at code documentation, lets check out the exported "PowerQueue" in our app scope
$ meteor doc PowerQueue
new PowerQueue([options])  Anywhere
Creates an instance of a power queue 

Arguments
  * options {object} (Optional)
    Settings
      * filo {boolean} (Default = false)
        Make it a first in last out queue
      * isPaused {boolean} (Default = false)
        Set queue paused
      * autostart {boolean} (Default = true)
        May adding a task start the queue
      * name {string} (Default = "Queue")
        Name of the queue
      * maxProcessing {number} (Default = 1)
        Limit of simultanous running tasks
      * maxFailures {number} (Default = 5)
        Limit retries of failed tasks, if 0 or below we allow infinite failures
      * jumpOnFailure {number} (Default = true)
        Jump to next task and retry failed task later
      * debug {boolean} (Default = false)
        Log verbose messages to the console
      * reactive {boolean} (Default = true)
        Set whether or not this queue should be reactive
      * spinalQueue {SpinalQueue} (Optional)
        Set spinal queue uses pr. default MicroQueue or ReactiveList if added to the project
PowerQueue = function(options) { ... power-queue.js:27

# Maybe list the functions mounted on this scope helping the developer search and explorer
# the api in order to search for:
$ meteor doc cfs:power-queue PowerQueue.isPaused
"powerqueue.isPaused()"  (Anywhere)
This method isPaused is defined in PowerQueue

Returns {boolean} (is reactive) Status of the paused state of the queue

self.isPaused = self._paused.get; power-queue.js:129

Could be better formatted like https://github.com/CollectionFS/Meteor-power-queue/blob/master/api.md

Ref:

dandv commented 9 years ago

Nice to have, for those who don't want to leave the terminal. I'd prefer the CLI to output a hyperlink, which my terminal makes clickable, so I can read the doc in a browser, with syntax highlight, hyperlink following etc.

raix commented 9 years ago

@dandv agree - I would be nice to use a better ui - would be nice if the browser made it easier to add/remove packages - maybe added some debugging/ performance stats etc. on the longer term?

$ meteor
[[[[[ ~/dev/test/test-app ]]]]]            

=> Started proxy.                             
=> Started MongoDB.                           
=> Started your app.

=> App running at: http://localhost:3000/
=> CLI running at: http://localhost:3001/