@36node/swagen
A module boilerplate for nodejs and web.
Last updated 6 days ago by zzswang .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @36node/swagen 
SYNC missed versions from official npm registry.

@36node/swagen

version downloads

Install

yarn global add @36node/template-cli

Usage

$ swagen -h

Usage: swagen [options] [command]

Options:
  -V, --version      output the version number
  -h, --help         output usage information

Commands:
  koa [options]      Generate code for koa server api
  sdk [options]      Generate code for client sdk
  postman [options]  Transform openapi file to postman collection file

Generate client sdk code

$ swagen sdk -h

Usage: sdk [options] [yamlFile] [name] [dist]

Generate code for client sdk

Options:
  -h, --help  output usage information


# example, default name is filename of yaml file or specified by name option
$ swagen sdk ./petstore.yaml ./sdk petstore

Generate koa server api code

$ swagen koa -h

Usage: koa [options] [yamlFile] [dist]

Generate code for koa server api

Options:
  -h, --help  output usage information


# example, if dist not specified, current dir will be used as default dist
$ swagen koa ./petstore.yaml ./koa

Generate postman collection from openapi

$ swagen postman -h

Usage: postman [options] [yamlFile] [targetFile]

Transform openapi file to postman collection file

Options:
  -h, --help  output usage information

# example, default targetFile name is the openapi info title properity
$ swagen postman ./petstore.yaml ./petstore.postman_collection.json

# will generate petstore.postman_collection.json in pwd
# then can use fastman to import collection to postman

$ fastman import ./petstore.postman_collection.json

Generate mock collection from openapi

$ swagen mock -h

Usage: mock [options] [yamlFile] [dist]

Transform openapi file to json-server data file

Options:
  -c, --count [count]  Add count of mock data to generate, default is 10
  -h, --help           output usage information

# example, default targetFile name is the openapi info title properity
$ swagen mock ./petstore.yaml ./mock/

# will generate data.json and routes.json in mock
# then can use json-server with these data and routes

$ json-server ./mock/db.json --routes ./mock/routes.json

More about json-server you can see here

Use remote file

# set name with 'petstore'
swagen sdk https://api.36node.com/petstore/v0/openapi.yaml . petstore

Contributing

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

Add new template

  1. Add new generator js file in src/generators, filename is the template name.
  2. In new generator js file, export default function which generate template.

Author

template-cli © 36node, Released under the MIT License.

Authored and maintained by 36node with help from contributors (list).

github.com/zzswang · GitHub @36node · Twitter @y

Current Tags

  • 0.17.11                                ...           latest (6 days ago)

60 Versions

  • 0.17.11                                ...           6 days ago
  • 0.17.10                                ...           a month ago
  • 0.17.9                                ...           a month ago
  • 0.17.8                                ...           a month ago
  • 0.17.7                                ...           a month ago
  • 0.17.6                                ...           a month ago
  • 0.17.5                                ...           a month ago
  • 0.17.4                                ...           a month ago
  • 0.17.3                                ...           a month ago
  • 0.17.2                                ...           2 months ago
  • 0.17.1                                ...           2 months ago
  • 0.17.0                                ...           2 months ago
  • 0.15.2                                ...           2 months ago
  • 0.15.1                                ...           2 months ago
  • 0.15.0                                ...           2 months ago
  • 0.14.0                                ...           2 months ago
  • 0.13.8                                ...           10 months ago
  • 0.13.6                                ...           10 months ago
  • 0.13.5                                ...           10 months ago
  • 0.13.4                                ...           a year ago
  • 0.13.3                                ...           a year ago
  • 0.13.2                                ...           a year ago
  • 0.13.1                                ...           a year ago
  • 0.13.0                                ...           a year ago
  • 0.12.6                                ...           a year ago
  • 0.12.5                                ...           a year ago
  • 0.12.4                                ...           a year ago
  • 0.12.3                                ...           a year ago
  • 0.12.2                                ...           a year ago
  • 0.12.1                                ...           a year ago
  • 0.12.0                                ...           a year ago
  • 0.11.5                                ...           a year ago
  • 0.11.4                                ...           a year ago
  • 0.11.2                                ...           a year ago
  • 0.11.0                                ...           a year ago
  • 0.9.5                                ...           2 years ago
  • 0.9.4                                ...           2 years ago
  • 0.9.3                                ...           2 years ago
  • 0.9.2                                ...           2 years ago
  • 0.9.1                                ...           2 years ago
  • 0.9.0                                ...           2 years ago
  • 0.8.0                                ...           2 years ago
  • 0.7.1                                ...           2 years ago
  • 0.7.0                                ...           2 years ago
  • 0.6.8                                ...           2 years ago
  • 0.6.7                                ...           2 years ago
  • 0.6.6                                ...           2 years ago
  • 0.6.5                                ...           2 years ago
  • 0.6.4                                ...           2 years ago
  • 0.6.3                                ...           2 years ago
  • 0.6.2                                ...           2 years ago
  • 0.6.1                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
Downloads
Today 1
This Week 84
This Month 96
Last Day 1
Last Week 16
Last Month 244
Dependencies (13)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |