0.1.0 • Published 3 years ago
create-with-generator v0.1.0
create-with-generator
use
pnpm create/yarn create/npm initwith yeoman generator
Install
$ pnpm add create-with-generatorAPI
require('create-with-generator').runGenerator({ __dirname })options
| key | type | required | description |
|---|---|---|---|
__dirname | string | true | your __dirname, used to detect who is calling runGenerator, if running in a symlinked environment, you need pass __dirname explicitly |
name | string | false | generator name, can be bareName(like augular or @scope/augular ) or fullname name(like generator-angular or @scope/generator-angular) |
subname | string | false | generator subname, defaults empty, stands for yo <name>:app |
Usage Guide
example we have generator-angular, and we want to build the create-angular package
- init package.json via
npm init - install deps:
pnpm add create-with-generator 'generator-angular@*' - add
index.jswith contents below - add
main&binfield of package.json toindex.js - tweak your package.json as you want, then run
npm publish - start create using
pnpm create angular
index.js
require('create-with-generator').runGenerator({ __dirname })package.json
{
"main": "index.js",
"bin": "index.js"
}Changelog
License
the MIT License http://magicdawn.mit-license.org