npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

type-generation

v0.2.3

Published

Swagger-UI 接口类型文件生成工具

Downloads

2

Readme

type-generation

NPM Status

Swagger-UI 接口类型文件生成工具

特点

  • [x] 支持单个接口的类型生成
  • [x] 支持 Eslint 优化代码样式
  • [x] 拉取模块的进度展示
  • [ ] 暂不支持 api 文件生成

安装

npm i --save-dev type-generation
或者
yarn add --dev type-generation

配置

在根目录或者根目录下的 config 文件夹内新建 type-generation.js 配置文件如下:

module.exports = {
  baseUrl: 'http://192.168.10.2:8882/',
  swaggerList: [
    {
      dir: 'src/models/business/model',
      name: 'saas-business-application',
    },
    {
      dir: 'src/models/notice/model',
      name: 'saas-notice-application',
    },
    {
      dir: 'src/models/settings/model',
      name: 'saas-settings-application',
    },
    {
      dir: 'src/models/vehicle/model',
      name: 'saas-vehicle-application',
    },
  ],
};

配置支持的字段

| 字段 | 类型 | 说明 | | ----------- | ------ | ------------------------ | | baseUrl | String | 拉取的地址 | | swaggerList | Array | 每个工程的配置 | | dir | String | 生成的类型文件的保存路径 | | name | String | 对应的每个工程名称 |

使用

拉取配置中的每个工程的所有类型

npx type-generation

拉取对应 api 所涉及的类型

默认的工程名取 api 中 saas-api 后面一词形成的组合 saas-{ $arg }-application,如下工程名取 saas-business-application。

npx type-generation -a=/saas-api/business/vip-card/bind-car/query
或者
npx type-generation --api=/saas-api/business/vip-card/bind-car/query

需特殊处理如 saas-crm-canal-new-application 这样的,则需要加上 --name=saas-crm-canal-new-application 或者 -n=saas-crm-canal-new-application