GithubHelp home page GithubHelp logo

miguelramosfdz / unified-engine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from unifiedjs/unified-engine

0.0 2.0 0.0 202 KB

Engine to process multiple files with unified

Home Page: https://unifiedjs.github.io

License: MIT License

JavaScript 100.00%

unified-engine's Introduction

unified-engine Build Status Coverage Status

Engine to process multiple files with unified, allowing users to configure from the file-system.

Projects

The following projects wrap the engine:

Installation

npm:

npm install unified-engine

Usage

The following example processes all files in the current directory with a markdown extension with remark, allows configuration from .remarkrc and package.json files, ignoring files from .remarkignore files, and more.

var engine = require('unified-engine');
var remark = require('remark');

engine({
  processor: remark,
  files: ['.'],
  extensions: ['md', 'markdown', 'mkd', 'mkdn', 'mkdown'],
  pluginPrefix: 'remark',
  rcName: '.remarkrc',
  packageField: 'remarkConfig',
  ignoreName: '.remarkignore',
  color: true
}, function (err) {
  if (err) throw err;
});

Table of Contents

API

engine(options, callback)

Process files according to options and invoke callback when done.

options
  • processor (Processor) — Unified processor to transform files
  • cwd (string, default: process.cwd()) — Directory to search files in, load plug-ins from, and more
  • files (Array.<string|VFile>, optional) — Paths or globs to files and directories, or virtual files, to process
  • extensions (Array.<string>, optional) — If files matches directories, include files with extensions
  • streamIn (ReadableStream, default: process.stdin) — Stream to read from if no files are found or given
  • filePath (string, optional) — File path to process the given file on streamIn as
  • streamOut (WritableStream, default: process.stdout) — Stream to write processed files to
  • streamError (WritableStream, default: process.stderr) — Stream to write the report (if any) to
  • out (boolean, default: depends) — Whether to write the processed file to streamOut
  • output (boolean or string, default: false) — Whether to write successfully processed files, and where to
  • alwaysStringify (boolean, default: false) — Whether to always compile successfully processed files
  • tree (boolean, default: false) — Whether to treat both input and output as a syntax tree
  • treeIn (boolean, default: tree) — Whether to treat input as a syntax tree
  • treeOut (boolean, default: tree) — Whether to treat output as a syntax tree
  • rcName (string, optional) — Name of configuration files to load
  • packageField (string, optional) — Property at which configuration can be found in package.json files
  • detectConfig (boolean, default: whether rcName or packageField is given) — Whether to search for configuration files
  • rcPath (string, optional) — File-path to a configuration file to load
  • settings (Object, optional) — Configuration for the parser and compiler of the processor
  • ignoreName (string, optional) — Name of ignore files to load
  • detectIgnore (boolean, default: whether ignoreName is given) — Whether to search for ignore files
  • ignorePath (string, optional) — File-path to an ignore file to load
  • silentlyIgnore (boolean, default: false) — Skip given files if they are ignored
  • plugins (Object, optional) — Map of plug-in names or paths to their options
  • pluginPrefix (string, optional) — When given, optional prefix to use when searching for plug-ins
  • configTransform (Function, optional) — Transform config files from a different schema
  • reporter (string or function, default: require('vfile-reporter')) — Reporter to use
  • reporterOptions (Object?, optional) — Config to pass to the used reporter
  • color (boolean, default: false) — Whether to report with ANSI colour sequences
  • silent (boolean, default: false) — Report only fatal errors
  • quiet (boolean, default: silent) — Do not report successful files
  • frail (boolean, default: false) — Call back with an unsuccessful (1) code on warnings as well as errors

function callback(err[, code, context])

Callback invoked when processing according to options is complete. Invoked with either a fatal error if processing went horribly wrong (probably due to incorrect configuration), or a status code and the processing context.

Parameters
  • err (Error) — Fatal error.
  • code (number) — Either 0 if successful, or 1 if unsuccessful. The latter occurs if fatal errors happen when processing individual files, or if frail is set and warnings occur.
  • context (Object) — Processing context, containing internally used information and a files array with the processed files.

Plug-ins

doc/plug-ins.md describes in detail how plug-ins can add more files to be processed and handle all transformed files.

Configuration

doc/configure.md describes in detail how configuration files work.

Ignoring

doc/ignore.md describes in detail how ignore files work.

License

MIT © Titus Wormer

unified-engine's People

Contributors

greenkeeperio-bot avatar wooorm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.