1.0.18 • Published 7 years ago

nodewrite-core-plugins v1.0.18

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

Core Plugins

Build Status CodeClimate Coverage Status Dependency Status

Handles the registration of installed plugins.

Installation

npm install nodewrite-core-plugins --save

This is a core package and is installed by default.

Usage

The file structure for a plugin:

.
├── /config
|   └── default.yml
├── /assets
├── /models
├── /public
├── /test
├── /views
|   ├── /helpers
|   ├── /layouts
|   └── /partials
├── README.md [required]
├── icon.png
├── index.js [required]
└── package.json [required]

Helper Methods

server.getPluginRegistry(callback)

Returns an array of installed plugin objects.

  • callback - method to call with a signature of function(error, plugins).
    • error - any error encountered while trying to read.
    • plugins - registry array of plugins.
server.getPluginRegistry((error, plugins) => {
  if (error) throw error;
  const registry = plugins;
});

Resulting registry array:

[
  {
    package: {
      name: "nodewrite-plugin-stripe",
      version: "1.0.0",
      description: "stripe plugin for nodewrite",
      // package.json ..
    },
    short: {
      name: "plugin-stripe",
      url: "/plugins/stripe",
    }
  },
  // etc ...
]

server.getPluginReadMe(name, callback)

Returns contents of a plugin's README.md file.

  • name - plugin name of package to read.
  • callback - method to call with a signature of function(error, source).
    • error - any error encountered while trying to read.
    • source - contents of plugin README.md file.
server.getPluginReadMe('nodewrite-plugin-stripe', (error, source) => {
  if (error) throw error;
  const content = source;
});

Resulting content is the raw markdown:

## Stripe Plugin
etc ...

server.getPlugin(name, callback)

Returns a single plugin object from the installed plugins registry.

  • name - plugin name of package to read.
  • callback - method to call with a signature of function(error, plugin).
    • error - any error encountered while trying to read.
    • plugin - registry object for plugin.
server.getPlugin('nodewrite-plugin-stripe', (error, plugin) => {
  if (error) throw error;
  const registry = plugin;
});

Resulting plugin registry object:

{
  package: {
    name: "nodewrite-plugin-stripe",
    version: "1.0.0",
    description: "stripe plugin for nodewrite",
    // package.json ..
  },
  short: {
    name: "plugin-stripe",
    url: "/plugins/stripe",
  }
}

Getting Help

Open an issue on this repository!

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago