Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chimi

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chimi

Validate JavaScript code from your README

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by150%
Maintainers
1
Weekly downloads
 
Created
Source

chimi

Run JavaScript snippets from your Markdown files.

How it works

chimi parses Markdown files and runs the JavaScript snippets to check if everything is alright.

Installation

$ yarn add chimi --dev
$ npm i chimi --save-dev

# global works too

$ yarn global add chimi
$ npm i -g chimi

Usage

  Run JavaScript snippets from your markdown files

  Usage
  $ chimi -f <file> -c <config-file>

  Options
    --file,    -f      File or glob matching multiple files (default: "README.md")
    --config,  -c      Use configuration from this file     (default: ".chimirc")
    --help,    -h      Show help
    --version, -v, -V  Show version

  Examples
    $ chimi -f README.md

    $ chimi -f doc/*.md

    $ chimi -c chimi.config.js

Configuration

To let chimi find the snippets you have to indicate the snippet language using either js or javascript like so:

```js
```javascript

You can configure chimi using a configuration file, it might be a JSON or JavaScript file and also an object as the chimi property in the package.json:

{
  "dependencies": { 
    "trae": "trae",
    "lodash": "_",
    "./config": "config",
    "es6-promise: ""
  },
  "file": "readme.md",
  "timeout": 5000
}

NOTE: the .chimirc file has to be a valid JSON.

NOTE: if it is a JavaScript file, an object has to be exported.

dependencies: object

A list of dependencies to be required on each snippet. Each key represents the path name and the value is the variable name, if the value is an empty string the require statement will be not assigned to a variable.

The depenencies in the example will generate these requires:

let trae   = require('trae')
let _      = require('lodash')
let config = require('./config')

require('es6-promise')

These dependencies will be added to your snippet before running it so you don't have to do it on every snippet.

file: string

Default: README.md.

The path to the file/s you want to parse. It can also be a glob. Be sure to specify only .md files.

timeout: number

Default: 5000.

The time, in miliseconds, to wait for the snippet execution before considering it a failure.

TODO

V1

  • Tests
  • CLI
    • Configuration (.chimi.js(on)?|.chimirc).
    • --help.
    • Log failures.
    • Debug option for printing the wrapped snippet.

Future

  • CLI
    • Improve current interface. Jest like interface when running/watching.
  • Process code
    • Transpile with Babel. Check for project Babel config. (?)
    • Lint with Eslint. If project has Eslint configured.(?)
  • Environment. Use jsdom?
  • Snippet metadata. Using MD snippets flags
  • Provide a programmatic API.

FAQs

Package last updated on 25 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc