kopy

The backbone of a scaffolding tool.

Currently the API of v9 is not stable, come back later!
Last updated 2 years ago by egoist .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install kopy 
SYNC missed versions from official npm registry.








kopy 1








NPM version NPM downloads CircleCI package size donate chat


The backbone of a scaffolding tool.

Features

  • Zero-dependency, very light-weight (940KB) compared to Yeoman (12MB)
  • Ultra-simple, this module exists because writing Yeoman generator is hard and time-consuming

Install

yarn add kopy

Usage

const kopy = require('kopy')

const config = {
  prompts() {
    return [
      {
        type: 'input',
        name: 'name',
        message: 'what is your name'
      }
    ]
  },
  actions() {
    return [
      {
        type: 'copy',
        files: '**',
        cwd: '/path/to/templates',
        // When specified, transform the files with `ejs`
        data: this.answers
      }
    ]
  },
  completed() {
    console.log('Done!')
  }
}

const generator = kopy(config)

generator
  .run({
    outDir: './out'
  })
  .catch(kopy.handleError)

Testing:

const kopy = require('kopy')

test('it works', async () => {
  const generator = kopy(config)
  await generator.emulate()
  expect(generator.answers).toEqual({ name: '' })
})

Read more docs on our website.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

kopy © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).

Website · GitHub @EGOIST · Twitter @_egoistlily

Current Tags

  • 9.4.2                                ...           latest (2 years ago)

44 Versions

  • 9.4.2 [deprecated]           ...           2 years ago
  • 9.4.1 [deprecated]           ...           2 years ago
  • 9.4.0 [deprecated]           ...           2 years ago
  • 9.3.0 [deprecated]           ...           2 years ago
  • 9.2.1 [deprecated]           ...           2 years ago
  • 9.2.0 [deprecated]           ...           2 years ago
  • 9.1.0 [deprecated]           ...           2 years ago
  • 9.0.0 [deprecated]           ...           2 years ago
  • 8.3.1                                ...           2 years ago
  • 8.3.0                                ...           3 years ago
  • 8.2.5                                ...           3 years ago
  • 8.2.4                                ...           3 years ago
  • 8.2.3                                ...           3 years ago
  • 8.2.2                                ...           3 years ago
  • 8.2.1                                ...           3 years ago
  • 8.2.0                                ...           3 years ago
  • 8.1.0                                ...           3 years ago
  • 8.0.1                                ...           3 years ago
  • 8.0.0                                ...           3 years ago
  • 7.1.0                                ...           3 years ago
  • 7.0.3                                ...           3 years ago
  • 7.0.2                                ...           3 years ago
  • 7.0.1                                ...           3 years ago
  • 7.0.0                                ...           3 years ago
  • 6.1.0                                ...           3 years ago
  • 6.0.0                                ...           3 years ago
  • 5.1.1                                ...           3 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.5                                ...           4 years ago
  • 5.0.4                                ...           4 years ago
  • 5.0.3                                ...           4 years ago
  • 5.0.2                                ...           4 years ago
  • 5.0.1                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
  • 4.1.0                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.4.0                                ...           4 years ago
  • 2.3.0                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago

Copyright 2014 - 2017 © taobao.org |