@nhz.io/slush-um

1.1.5 • Public • Published

Micro module generator (@nhz.io scoped)

Travis Build NPM Version

You get:

  • TDD Dev environment configured for tiny packages
  • Literate Coffeescript template to start with (README.litcoffee)
  • npm start - to start TDD
  • npm build
  • .travis.yml for scoped publish (public) - just set NPM_AUTH_TOKEN

Install

npm i -g slush @nhz.io/slush-um

Usage

mkdir um && cd um

slush @nhz.io/um

Literate Source

Imports

Builtins

path     = require 'path'

General

gulp     = require 'gulp'
pump     = require 'pump'
inquirer = require 'inquirer'

Gulp plugins

install  = require 'gulp-install'
conflict = require 'gulp-conflict'
template = require 'gulp-template'
rename   = require 'gulp-rename'

String utils imports

slugify   = require 'slugify'
camelcase = require 'camelcase'

Default task

gulp.task 'default', ->

  answers = await inquirer.prompt [
    {
      name: 'pkgName'
      message: 'Package name?'

Strip scope prefix from default package name

      default: (path.basename process.cwd()).replace /^(nhz-io-)?/, ''
    }
    {
      name: 'pkgDescription'
      message: 'Description?'
    }
    {
      name: 'pkgVersion'
      message: 'Version?'
      default: '0.0.0'
    }
    {
      type: 'confirm'
      name: 'continue'
      message: 'Continue?'
    }
  ]

  return done() unless answers.continue

Strip scope prefix from package name

  answers.pkgName = answers.pkgName.replace(/^nhz-io-/, '')

Slugify

  answers.pkgNameSlug = slugify answers.pkgName, '-'

Camel Case

  answers.pkgNameCamelCase = camelcase answers.pkgName

Generate package

  pump [
    gulp.src __dirname + '/templates/**'

    template answers

    rename (f) -> if f.basename[0] is '_' then f.basename = ".#{ f.basename.slice 1 }"

    conflict './'

    gulp.dest './'

    install()
  ]

Version 1.1.5

License MIT

Package Sidebar

Install

npm i @nhz.io/slush-um

Weekly Downloads

0

Version

1.1.5

License

MIT

Last publish

Collaborators

  • nhz-io
  • ishi.ruy