npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

short-jsdoc

v0.2.8

Published

short and simple jsdoc Object Oriented syntax format and implementation

Downloads

56

Readme

Build Status

Guide

#Online HTML5 project demo.

Online Example Demo

Unit Tests - Descriptions

This own project jsdocs

Command line

Install it globally with this command:

sudo npm install -g short-jsdoc

then use it like this:

 node bin/short-jsdoc-cli.js --input src --output foo --vendor backbone

nodejs API

var ShortJsDoc = require('short-jsdoc');
ShortJsDoc.make({
    input: ['./src/folder1', './src/folder2', './src/folder3/file.js']
,   output: 'jsdoc'
,   projectMetadata: './package.json'
,   vendor: ['javascript', 'html', 'backbonejs', 'jquery', 'xml-dom']
}); 

#Options

  • input: comma separated folders form where consume .js files. Example: --input src/model,third/base
  • output: the output folder which will be generated with a ready to use html document
  • projectMetadata: path to a package.json like file that describe the source project
  • vendor: a comma separated list of vendor names - which jsdoc will also be included. See folder vendor-jsdoc to see which are supported.

#Features

##Short

If you want you can define a whole method signature in one line like this:

//@method add adds a new tool @param {Array<Tool>} tools @return {Promise} solved when all ends
ToolCollection.prototype.add = function(tool){...}

##Flexible comment syntax and rich text input

Support all comment types, like /* /** // .

Also the jsdoc text can be written in in plain text, html or markdown. This means you are free to choose to be minimalistic (writing single-line comments) or very exhaustive and styled (writing multiple paragraph html or mardown text), or what is best, do both things and choose where to put the big texts !

##Simple annotation syntax

Simple annotation syntax based in a unique pattern:

@annotation {Type} name text.  

Also use the concept of primary annotations @module, @class, @method, @property that contains secondary annotations like @extends @returns @static

The mission is that you can just add @annotations to existing source comments without having to re-write them or change its format.

##Rich Object Oriented Concepts support

short-jsdoc supports a rich set of Object oriented concepts out of the box: module, @class, @property, @method, @event, @constructor, @extend, and many more!

Rich types support

Heavy support for Types - they are optional but it is important for getting a navigable API. Support Type Generic syntax. multiple types, object literals and custom type definitions.

Read all at Supported Types Guide

Generic

The parser read the sources and generate a Abstract Syntax Tree (AST) of ALL the @annotations. THEN it is 'beautified' with shortcuts for properties and methods. But the original AST with ALL the annotations is there for those who want to define its own semantics and annotations.

Extendable

User can subscribe to interesting processing 'moments' to add its own semantics. Read all at Complete Extensibility Guide

Browser and nodejs

Jsdoc generator is usable both in nodejs or in the browser.

Rich, generic and reusable output

The parser generates a json file with all jsdoc meta data that can be consumed and shared easily. By default a a nice html5 single page application is delivered that shows generated jsdocs in a very rich way and easy to customize. Also you can distribute the folder with the jsdocs and others can just open the local html file in the browser without running a server for easy reading.

License

short-jsdoc is open sourced under the MIT License.

Do what you need with this project, if you can, contribute you enhancements back :)

Running development web demo

If you want to taste this project then you should do it in a development environment: First, install grunt (only one time)

sudo npm install -g grunt

then we can invoke grunt from command line and debug the apps in the browser

grunt run
firefox http://localhost:8080/html/index-dev.html

Or execute the Unit tests - located in folder /test/spec/ : http://localhost:8080/test/SpecRunner.html

Interesting commands

cd short-jsdoc

Generates the test-project json data:

node src/shortjsdoc.js --input test/test-project/,vendor-jsdoc/ --project-metadata ./test/test-project/package.json > html/data.json

Generates the front end js application jsdocs itself:

node src/shortjsdoc.js--input html/src/ --project-metadata ./package.json > html/data.json 

Or do both and add javascript API and js library APIs:

node src/shortjsdoc.js --input "test/test-project/,html/src/,vendor-jsdoc/javascript" --project-metadata ./test/test-project/package.json > html/data.json

generate shortjsdoc documentation:

node generate-apidocs.js

full rebuild and recreate

rm html/data.json; node src/shortjsdoc.js --input "test/test-project/,html/src/,vendor-jsdoc/javascript" --project-metadata ./test/test-project/package.json > html/data.json

Generate and run a full distro from github:

git clone https://github.com/cancerberoSgx/short-jsdoc.git
cd short-jsdoc
npm install
grunt run
firefox http://localhost:8080/html/index-dev.html

#Unit test

Run unit tests in the browser:

grunt run
firefox http://localhost:8080/test/SpecRunner.html

Run unit tests in node:

node node_modules/jasmine/bin/jasmine.js

#Motivation notes These are some notes about my initial motivation when started the project

TODO

TODO file is a very important file at this 'current age' of the project.

Dependencies

The parser depends on esprima and underscore and browserify to run in the browser. Can run on the browser or nodejs. For extracting jsdocs from project in filesystem then you need nodejs.

The html5 web application is built with underscore, jquery, bootstrap and backbone,.