cogs
The fast file transform pipeline.
Last updated 2 months ago by caseywebdev .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cogs 
SYNC missed versions from official npm registry.

Cogs

The fast file transform pipeline. Build Status

George Jetson's workweek is typical of his era: an hour a day, two days a week. His boss is Cosmo Spacely, the diminutive yet bombastic owner of Spacely Space Sprockets. Spacely has a competitor, H. G. Cogswell, owner of the rival company Cogswell Cogs (sometimes known as Cogswell's Cosmic Cogs).

Install

npm install cogs

Usage

Cogs leverages a simple command line interface paired with a powerful declarative config file.

Usage: cogs [options]

The fast file transform pipeline.


Options:

  -V, --version             output the version number
  -c, --config-path [path]  load config from [path] (default: cogs.js)
  -d, --debounce [seconds]  trigger a build at most every [seconds] seconds (default: 0.1)
  -w, --watch-paths [path]  rebuild if [path] changes, can be specified multiple times
  -p, --use-polling         use stat polling instead of fsevents when watching
  -s, --silent              do not output build information, only errors
  -C, --no-color            disable colored output
  -h, --help                output usage information

Config

Every good project needs a Cogs config file. This file can be JavaScript or JSON, as long as requireing the file returns the config object. Here's an example in JavaScript:

module.exports = {

  // Define the transformer pipeline here.
  transformers: [
    {
      // This is the name of the transformer to use for this piece of the
      // pipeline. It can be shorthand like this, or the fully-qualified package
      // name like 'cogs-transformer-babel'.
      name: 'babel',

      // The "only" key can be used to define a glob or array of globs, one of
      // which must be matched for the file to go through this transformer.
      only: 'src/**/*.js',

      // "except" is the opposite of only. Paths that match these globs will not
      // go through the transformer.
      except: [
        'src/some/outlier/file.js',
        'src/more/outliers/**/*.js'
      ],

      // "options" will be passed directly to the transformer.
      options: {
        presets: ['stage-0', 'es2015', 'react']
      }
    },

    // Impromptu transformers are as easy as specifying a function.
    {
      fn: ({file: {buffer}, options}) => ({buffer: Buffer.from(`${buffer}!`)),
      only: '**/*.exciting'
    },

    // Some other examples...
    {
      name: 'uglify-js',
      only: '**/*.js',
      except: '**/*+(-|_|.)min.js'
    },
    {
      name: 'sass',
      only: 'src/**/*.scss'
    },
    {
      name: 'clean-css',
      only: '**/*.+(css|scss)'
    }
  ],

  // Define source globs and targets here. This is where you define what to
  // transform and where it should go.
  builds: {
    'src/index.es6': {base: 'src', dir: 'public'},

    'src/public/**/*': {base: 'src/public', dir: 'public'},

    // Save to public dir and rename .es6 files to .js and .scss files to .css
    'src/foo/**/*': {
      base: 'src',
      dir: 'public',
      ext: {
        '.es6': '.js',
        '.scss': '.css'
      }
    }
  }
};

Transformers

Transformers are generally node modules that can be downloaded from npm. Alternatively, you can create your own transformers for your projects and reference them in the transformers array.

Here are some transformers to get you started

Develop

git clone git@github.com:caseywebdev/cogs
cd cogs
npm install
bin/watch-test

Current Tags

  • 4.5.6                                ...           latest (2 months ago)

217 Versions

  • 4.5.6                                ...           2 months ago
  • 4.5.5                                ...           3 months ago
  • 4.5.4                                ...           3 months ago
  • 4.5.3                                ...           3 months ago
  • 4.5.2                                ...           3 months ago
  • 4.5.1                                ...           4 months ago
  • 4.5.0                                ...           4 months ago
  • 4.4.9                                ...           a year ago
  • 4.4.8                                ...           a year ago
  • 4.4.7                                ...           a year ago
  • 4.4.6                                ...           a year ago
  • 4.4.5                                ...           a year ago
  • 4.4.4                                ...           a year ago
  • 4.4.3                                ...           a year ago
  • 4.4.2                                ...           a year ago
  • 4.4.1                                ...           a year ago
  • 4.4.0                                ...           a year ago
  • 4.3.2                                ...           a year ago
  • 4.3.1                                ...           a year ago
  • 4.3.0                                ...           a year ago
  • 4.2.10                                ...           a year ago
  • 4.2.9                                ...           a year ago
  • 4.2.8                                ...           a year ago
  • 4.2.7                                ...           a year ago
  • 4.2.6                                ...           a year ago
  • 4.2.5                                ...           a year ago
  • 4.2.4                                ...           a year ago
  • 4.2.3                                ...           a year ago
  • 4.2.2                                ...           a year ago
  • 4.2.1                                ...           a year ago
  • 4.2.0                                ...           a year ago
  • 4.1.1                                ...           a year ago
  • 4.1.0                                ...           a year ago
  • 4.0.0                                ...           2 years ago
  • 4.0.0-rc5                                ...           2 years ago
  • 4.0.0-rc4                                ...           2 years ago
  • 4.0.0-rc3                                ...           2 years ago
  • 4.0.0-rc2                                ...           2 years ago
  • 4.0.0-rc1                                ...           2 years ago
  • 3.2.1                                ...           2 years ago
  • 3.2.0                                ...           2 years ago
  • 3.1.6                                ...           2 years ago
  • 3.1.5                                ...           3 years ago
  • 3.1.4                                ...           3 years ago
  • 3.1.3                                ...           3 years ago
  • 3.1.2                                ...           3 years ago
  • 3.1.1                                ...           3 years ago
  • 3.1.0                                ...           3 years ago
  • 3.0.8                                ...           3 years ago
  • 3.0.7                                ...           3 years ago
  • 3.0.6                                ...           3 years ago
  • 3.0.5                                ...           3 years ago
  • 3.0.4                                ...           3 years ago
  • 3.0.3                                ...           3 years ago
  • 3.0.2                                ...           3 years ago
  • 3.0.1                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.0.9                                ...           3 years ago
  • 2.0.8                                ...           3 years ago
  • 2.0.7                                ...           3 years ago
  • 2.0.6                                ...           3 years ago
  • 2.0.5                                ...           4 years ago
  • 2.0.4                                ...           4 years ago
  • 2.0.3                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 2.0.0-rc2                                ...           4 years ago
  • 2.0.0-rc1                                ...           4 years ago
  • 1.0.8                                ...           4 years ago
  • 1.0.7                                ...           4 years ago
  • 1.0.6                                ...           4 years ago
  • 1.0.5                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 1.0.0-rc2                                ...           4 years ago
  • 1.0.0-rc1                                ...           4 years ago
  • 0.33.9                                ...           4 years ago
  • 0.33.8                                ...           4 years ago
  • 0.33.7                                ...           4 years ago
  • 0.33.6                                ...           4 years ago
  • 0.33.5                                ...           4 years ago
  • 0.33.4                                ...           4 years ago
  • 0.33.3                                ...           4 years ago
  • 0.33.2                                ...           4 years ago
  • 0.33.1                                ...           4 years ago
  • 0.33.0                                ...           4 years ago
  • 0.32.10                                ...           4 years ago
  • 0.32.9                                ...           4 years ago
  • 0.32.8                                ...           4 years ago
  • 0.32.7                                ...           4 years ago
  • 0.32.6                                ...           4 years ago
  • 0.32.5                                ...           4 years ago
  • 0.32.4                                ...           4 years ago
  • 0.32.3                                ...           4 years ago
  • 0.32.2                                ...           4 years ago
  • 0.32.1                                ...           4 years ago
  • 0.32.0                                ...           4 years ago
  • 0.31.5                                ...           4 years ago
  • 0.31.4                                ...           4 years ago
  • 0.31.3                                ...           4 years ago
  • 0.31.2                                ...           4 years ago
  • 0.31.1                                ...           4 years ago
  • 0.31.0                                ...           4 years ago
  • 0.30.2                                ...           5 years ago
  • 0.30.1                                ...           5 years ago
  • 0.30.0                                ...           5 years ago
  • 0.29.4                                ...           5 years ago
  • 0.29.3                                ...           5 years ago
  • 0.29.2                                ...           5 years ago
  • 0.29.1                                ...           5 years ago
  • 0.29.0                                ...           5 years ago
  • 0.28.3                                ...           5 years ago
  • 0.28.2                                ...           5 years ago
  • 0.28.1                                ...           5 years ago
  • 0.28.0                                ...           5 years ago
  • 0.27.2                                ...           5 years ago
  • 0.27.1                                ...           5 years ago
  • 0.27.0                                ...           5 years ago
  • 0.26.2                                ...           5 years ago
  • 0.26.1                                ...           5 years ago
  • 0.26.0                                ...           5 years ago
  • 0.25.4                                ...           5 years ago
  • 0.25.3                                ...           5 years ago
  • 0.25.2                                ...           5 years ago
  • 0.25.1                                ...           5 years ago
  • 0.25.0                                ...           5 years ago
  • 0.24.3                                ...           5 years ago
  • 0.24.2                                ...           5 years ago
  • 0.24.1                                ...           5 years ago
  • 0.24.0                                ...           5 years ago
  • 0.23.0                                ...           5 years ago
  • 0.22.2                                ...           5 years ago
  • 0.22.1                                ...           5 years ago
  • 0.22.0                                ...           5 years ago
  • 0.21.8                                ...           5 years ago
  • 0.21.7                                ...           5 years ago
  • 0.21.6                                ...           5 years ago
  • 0.21.5                                ...           5 years ago
  • 0.21.4                                ...           5 years ago
  • 0.21.3                                ...           5 years ago
  • 0.21.2                                ...           5 years ago
  • 0.21.1                                ...           5 years ago
  • 0.21.0                                ...           5 years ago
  • 0.20.3                                ...           5 years ago
  • 0.20.2                                ...           5 years ago
  • 0.20.1                                ...           5 years ago
  • 0.20.0                                ...           5 years ago
  • 0.19.3                                ...           5 years ago
  • 0.19.2                                ...           5 years ago
  • 0.19.1                                ...           5 years ago
  • 0.19.0                                ...           5 years ago
  • 0.18.1                                ...           5 years ago
  • 0.18.0                                ...           5 years ago
  • 0.17.1                                ...           6 years ago
  • 0.17.0                                ...           6 years ago
  • 0.16.3                                ...           6 years ago
  • 0.16.2                                ...           6 years ago
  • 0.16.1                                ...           6 years ago
  • 0.16.0                                ...           6 years ago
  • 0.15.9                                ...           6 years ago
  • 0.15.8                                ...           6 years ago
  • 0.15.7                                ...           6 years ago
  • 0.15.6                                ...           6 years ago
  • 0.15.5                                ...           6 years ago
  • 0.15.4                                ...           6 years ago
  • 0.15.3                                ...           6 years ago
  • 0.15.1                                ...           6 years ago
  • 0.15.0                                ...           6 years ago
  • 0.14.2                                ...           6 years ago
  • 0.14.1                                ...           6 years ago
  • 0.14.0                                ...           6 years ago
  • 0.13.5                                ...           6 years ago
  • 0.13.4                                ...           6 years ago
  • 0.13.3                                ...           6 years ago
  • 0.13.2                                ...           6 years ago
  • 0.13.1                                ...           6 years ago
  • 0.13.0                                ...           6 years ago
  • 0.12.0                                ...           6 years ago
  • 0.11.2                                ...           6 years ago
  • 0.11.1                                ...           6 years ago
  • 0.11.0                                ...           6 years ago
  • 0.10.15                                ...           6 years ago
  • 0.10.14                                ...           6 years ago
  • 0.10.13                                ...           6 years ago
  • 0.10.12                                ...           6 years ago
  • 0.10.11                                ...           6 years ago
  • 0.10.10                                ...           6 years ago
  • 0.10.9                                ...           6 years ago
  • 0.10.8                                ...           6 years ago
  • 0.10.7                                ...           6 years ago
  • 0.10.6                                ...           6 years ago
  • 0.10.5                                ...           6 years ago
  • 0.10.4                                ...           6 years ago
  • 0.10.1                                ...           6 years ago
  • 0.10.0                                ...           6 years ago
  • 0.9.11                                ...           6 years ago
  • 0.9.10                                ...           6 years ago
  • 0.9.9                                ...           6 years ago
  • 0.9.8                                ...           6 years ago
  • 0.9.7                                ...           6 years ago
  • 0.9.6                                ...           6 years ago
  • 0.9.5                                ...           6 years ago
  • 0.9.4                                ...           6 years ago
  • 0.9.3                                ...           6 years ago
  • 0.9.2                                ...           6 years ago
  • 0.9.1                                ...           6 years ago
  • 0.9.0                                ...           6 years ago
  • 0.8.1                                ...           6 years ago
  • 0.8.0                                ...           6 years ago
  • 0.7.3                                ...           6 years ago
  • 0.7.2                                ...           6 years ago
  • 0.7.1                                ...           6 years ago
  • 0.7.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 6
Last Day 0
Last Week 2
Last Month 653
Dependencies (8)
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |