Singpath package script helpers.

Usage no npm install needed!

<script type="module">
  import singpathTools from 'https://cdn.skypack.dev/@singpath/tools';


Singpath's tools

Singpath package script helpers.


npm install --save-dev @singpath/tools



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.


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'


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

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


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');


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'
  () => console.log('archive created')