Skip to content
Jens Krefeldt edited this page May 13, 2016 · 2 revisions

TOC

Classes

LogWrapper

Class which defines a logger wrapper usable in this module.

NOTE: This class is not to be intended to be called from outside this module!

MdWriter

Class which writes Markdown file.

Md

Utility class which wraps a Markdown string and provides useful operations on this string.

PkgReader

Class which reads an validates (by JSON schema) a package.json file.

PkgToMd

Class which converts a package.json to a MD file.

Constants

UTF8 : string

The 'utf8' constant.

DEFAULT_MD_FILE : string

The default Markdown file: 'README.md'.

DEFAULT_PKG_FILE : string

The default package file: 'package.json'.

DEFAULT_REGISTRY : string

The default registry: 'https://registry.npmjs.org/'.

DEPENDENCY_TYPE_PROD : string

The production dependency type: ''.

DEPENDENCY_TYPE_DEV : string

The development dependency type: 'dev'.

DEPENDENCY_TYPE_BUNDLED : string

The bundled dependency type: 'bundled'.

DEPENDENCY_TYPE_OPTIONAL : string

The optional dependency type: 'optional'.

DEPENDENCY_TYPE_PEER : string

The peer dependency type: 'peer'.

Typedefs

Options : object

LogWrapper

Class which defines a logger wrapper usable in this module.

NOTE: This class is not to be intended to be called from outside this module!

Kind: global class

new LogWrapper([logger])

Constructs the LogWrapper.

Returns: LogWrapper - - The instance.

Param Type Default Description
[logger] logger | cli | console console Logger object.

Example

var logger = ...;
var logWrapper = new LogWrapper(logger);

logWrapper.info(msg)

Log the options with INFO level.

Kind: instance method of LogWrapper
Access: public

Param Type Description
msg string The message to log.

Example

var logger = ...;
var logWrapper = new LogWrapper(logger);
var msg = '...';
logWrapper.info(msg);

logWrapper.debug(msg)

Log the options with DEBUG level (if logger supports it, else with INFO).

Kind: instance method of LogWrapper
Access: public

Param Type Description
msg string The message to log.

Example

var logger = ...;
var logWrapper = new LogWrapper(logger);
var msg = '...';
logWrapper.debug(msg);

logWrapper.trace(msg)

Log the options with TRACE level (if logger supports it, else with DEBUG).

Kind: instance method of LogWrapper
Access: public
See: #debug

Param Type Description
msg string The message to log.

Example

var logger = ...;
var logWrapper = new LogWrapper(logger);
var msg = '...';
logWrapper.trace(msg);

logWrapper.error(msg)

Log the options with ERROR level.

Kind: instance method of LogWrapper
Access: public

Param Type Description
msg string The message to log.

Example

var logger = ...;
var logWrapper = new LogWrapper(logger);
var msg = '...';
logWrapper.error(msg);

logWrapper.verboseOptions(options) ⇒

Log the options with INFO level.

Kind: instance method of LogWrapper
Returns: A Promise containing the passed options object.
Access: public

Param Type Description
options Options The properties to log with INFO.

Example

var logger = ...;
var logWrapper = new LogWrapper(logger);
var options = {
    ...
};
logWrapper.verboseOptions(options)
    .then(function (options) {
        ...
    });

MdWriter

Class which writes Markdown file.

Kind: global class

new MdWriter()

Constructs the writer.

Returns: MdWriter - - The instance.

mdWriter.write(md, options) ⇒ bluebird | exports | module.exports

Kind: instance method of MdWriter
Access: public

Param
md
options

Md

Utility class which wraps a Markdown string and provides useful operations on this string.

Kind: global class

new Md(pkg, options, logger)

Constructs the Markdown string from given package object.

Returns: Md - - The instance.

Param Type Description
pkg object -
options object -
logger logger -

md.append(content, [amount]) ⇒ Md

Appends the given content to the Markdown string and adds newlines.

Kind: instance method of Md
Returns: Md - - This instance for concatenated calls.
Access: public

Param Type Default Description
content string The content to append.
[amount] number 2 The amount of newlines to add.

md.nl([amount]) ⇒ Md

Adds newlines of the given amount.

Kind: instance method of Md
Returns: Md - - This instance for concatenated calls.
Access: public

Param Type Default Description
[amount] number 2 The amount of newlines to add.

md.end([amount]) ⇒ *

Returns the Markdown string (optionally adds newlines).

Kind: instance method of Md

Param Type Description
[amount] number The final amount of newlines.

PkgReader

Class which reads an validates (by JSON schema) a package.json file.

Kind: global class

new PkgReader()

Constructs the constants.

Returns: PkgReader - - The instance.

pkgReader.read(options) ⇒ Promise.<T>

Kind: instance method of PkgReader

Param
options

PkgToMd

Class which converts a package.json to a MD file.

Kind: global class

new PkgToMd()

Constructs the ....

Returns: PkgToMd - - The instance.

pkgToMd.writeMarkdown(options) ⇒ Promise

Kind: instance method of PkgToMd
Returns: Promise - -

Param
options

UTF8 : string

The 'utf8' constant.

Kind: global constant
Access: public

DEFAULT_MD_FILE : string

The default Markdown file: 'README.md'.

Kind: global constant
Access: public

DEFAULT_PKG_FILE : string

The default package file: 'package.json'.

Kind: global constant
Access: public

DEFAULT_REGISTRY : string

The default registry: 'https://registry.npmjs.org/'.

Kind: global constant
Access: public

DEPENDENCY_TYPE_PROD : string

The production dependency type: ''.

Kind: global constant
Access: public

DEPENDENCY_TYPE_DEV : string

The development dependency type: 'dev'.

Kind: global constant
Access: public

DEPENDENCY_TYPE_BUNDLED : string

The bundled dependency type: 'bundled'.

Kind: global constant
Access: public

DEPENDENCY_TYPE_OPTIONAL : string

The optional dependency type: 'optional'.

Kind: global constant
Access: public

DEPENDENCY_TYPE_PEER : string

The peer dependency type: 'peer'.

Kind: global constant
Access: public

Options : object

Kind: global typedef
Properties

Name Type Default Description
origin string "yaml" The origin type.
target string "js" The target type.
src string | Readable | object The source.
dest string | Writable | object The destination.
indent number 4 The indention in files.
imports string The exports name for reading from JS source file or objects only.
exports string The exports name for usage in JS destination files only.

Clone this wiki locally