recink-comment

1.0.5 • Public • Published

REciNK Component for commenting things

This is a REciNK component that submits comments to different backends.

Prerequisites

  • Git >= v1.x
  • Node.js >= v6.x
  • NPM >= v3.x
  • REciNK

Use nvm to install and manage different versions of Node.js; Ideally, use v8+ for faster performance

Installation

  • npm install -g recink-comment

Note that the component is installed automatically when running recink component add comment

Configuration

.recink.yml configuration:

$:
  preprocess:
    '$.comment.providers.github.0.token': 'eval'
    # '$.comment.listen': 'eval' 
  comment:
    # listen: '`${ process.cwd() }/recink.comment`'     # Listen for file input (including initial content; think "tail -f") 
    providers:                                          # Supported providers: github 
      github:
        token: 'process.env.GITHUB_TOKEN'

.travis.yml configuration:

script: 'recink run unit -c recink-comment'  
before_install:
  # other before_install scripts... 
  - 'npm install -g recink-comment'

Or using the registry:

before_install:
  # other before_install scripts... 
  - 'recink component add comment'

Add the GITHUB_TOKEN to .travis.yml:

recink travis encrypt -x 'GITHUB_TOKEN=1234'

If you are using Travis Pro read this guide to properly encrypt the environment variable

Usage

GITHUB_TOKEN=1234 recink run unit -c recink-comment

Pushing Messages Using Programatic API

Let's assume you're in a component context (e.g. pagespeed-component.js):

  /**
   * @param {Emitter} emitter 
   * 
   * @returns {Promise} 
   */
  run(emitter) {
    const commentComponent = emitter.component('comment');
 
    return commentComponent 
      ? commentComponent.comment(`Hello from ${ Date() }`) 
      : Promise.resolve();
  } 

Pushing Messages to Input Stream

Let's assume that ~/recink.comment is the input stream comment component is listening to:

echo "Test message" >> ~/recink.comment

Note that the initial ~/recink.comment content would be submitted as a single comment.

Dependents (0)

Package Sidebar

Install

npm i recink-comment

Weekly Downloads

0

Version

1.0.5

License

MPL-2.0

Unpacked Size

11.6 kB

Total Files

9

Last publish

Collaborators

  • mitocgroup