0.0.8 • Published 10 years ago

@singpath/tools v0.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

Singpath's tools

Singpath package script helpers.

Install

npm install --save-dev @singpath/tools

Usage

exec

const tools = require('@singpath/tools');

// Execute shell command synchronously.
tools.exec('ls -la dist', {
  // by default it will print the command to the stdout
  printCmd: true,

  // by default, the command will inherit the node script stdout;
  // set this property to `true` to ignore the command stdout
  ignoreStdout: false,

  // same for the command stderr
  ignoreStderr: false
});

For more complex usage like piping, try shelljs's exec.

clean

const tools = require('@singpath/tools');

tools.clean(['dist', 'coverage'], {
  // force removing the folders when this is set to `true`
  force: false,

  // info message prefix
  message: 'Removing build/test artifacts'
});

mocha

const tools = require('@singpath/tools');

tools.mocha(my-app/my-app.specs.js, {
  // Mocha ui
  ui: 'bdd'
});

instanbul

const tools = require('@singpath/tools');

tools.instanbul(my-app/my-app.specs.js, {
  // Mocha ui
  ui: 'bdd',

  // path to coverage directory (the directory must exist)
  coverage: path.resolve('./coverage'),

  // instanbul report types
  reports: ['lcov', 'text'],

  // exclude function factory
  exclude: function(baseURL) {
    return function excludeModule(path) {
      return path.startsWith(baseURL + 'jspm_packages') || path.endsWith('specs.js');
    }
  }
});

zip

const tools = require('@singpath/tools');

tools.zip('dist/my-app', 'dist/my-app.zip', {
  // where to save the directory in the archive; uses the directory name
  // by default.
  root: 'my-app'
}).then(
  () => console.log('archive created')
);
0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago