node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


go with ease npm

Go is the toolset to manage boilerplates with less effort.


$ npm install --save-dev go
# or 
$ npm install --global go


Without plugins Go has two features methods:

  1. go.use(plugin[, options]) - to register plugin
  2. go.isUsed(plugin) - to check if plugin is registered

The plugin is either a function, or an object with install method that will be called with the prototype object, and with given options. This way Go features are extended:

const go = require('go')
const plugin = (proto) => { proto.log = console.log.bind(console) }
// or
const plugin = { install: (proto) => { proto.log = console.log.bind(console) }}
go.log('Hello, Go!')

Several plugins are bundled with Go:

CLI tool

To use Go abilities from CLI — go-cli is installed with the package. This tool can trigger commands registered with go-plugin-cli.

// gofile.js
const go = require('go')
go.registerCommand('ping', () => { console.log('pong') })
$ go ping

If you don't want to install Go globally, you can run it using npx (it is bundled with >= npm@5.2) or with npm scripts.


Using go-cli to execute tasks

// goifle.js
const go = require('go')
go.registerCommand('install', async () => {
  if (await go.confirm('run installation?')) {
$ go install

Generating app components

├── gofile.js
└── .templates/
    └── component.js
└── app/
    ├── components/
    └── main.js
// gofile.js
const go = require('go')
const prepareName = name => name.toLowerCase().replace(/[^a-z\d]/ig, '-')
go.registerCommand('create', async (argv) => {
  const type = argv._[1] // extract word after `create` command
  if (type !== 'component') throw `${type} is not suppoted`
  // try to extract name from arguments or ask to enter it
  const name = || await go.ask({
    message: 'name the component',
    default: 'new-component',
    validate: (input) => input.trim() ? true : 'component name can not be empty'
  const fileName = prepareName(name)
  go.processTemplate('component.js', `components/${fileName}.js`)
$ go create component
# or 
$ go create component --name my-component


MIT © Stanislav Termosa