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

pont-slock

v1.1.20

Published

<div align="center"> <h2>Swagger to TS Network Request Code</h2> </div>

Downloads

325

Readme

介绍

change to use slock & templock

Inspired by alibaba/pont

将 Swagger 数据源自动生成为符合 TS 规范的网络请求层代码及相应的类型定义代码.

命令

配置 项目根目录的 pont-config.json, 一般只有在初始化和有新的后端服务加入(在配置中的 origins 中增加)的时候才会修改, 示例(CC 项目):

{
  "outDir": "./src/services/auto-gen-api/src",
  "templatePath": "./generate-api-template",
  "originType": "SwaggerV2",
  "prettierConfig": {
    "singleQuote": true,
    "trailingComma": "all",
    "tabWidth": 2,
    "endOfLine": "lf",
    "printWidth": 100,
    "proseWrap": "never"
  },
  "origins": [
    {
      "originType": "SwaggerV2",
      "originUrl": "http://peppa-cc-manage.qa.huohua.cn/v2/api-docs?group=api",
      "name": "customerConsultant",
      "usingMultipleOrigins": true,
      "usingOperationId": true
    },
    {
      "originType": "SwaggerV2",
      "originUrl": "http://cti-manage.qa.huohua.cn/v2/api-docs?group=web",
      "name": "callCenter",
      "usingOperationId": true,
      "usingMultipleOrigins": true
    }
  ]
}

初始化

# 全量拉取配置文件中的数据源, 只会在第一次初始化时使用, 开发迭代过程中禁止使用
yarn initApi

Diff 检查远端更新

# Diff检查远端更新, 按照提示进行交互即可
yarn diff

更新接口 Interface(Swagger 中的 paths)

# 拿到需求后先跟后端约定接口, 等后端接口swagger出来后根据约定更新对应的接口, 按照提示进行交互即可
yarn updatInterface

更新模块 Mod(Swagger 中的 Controller 或者 Tags)

# 如果按约定新增加的是一个模块, 则使用本命令, 按照提示进行交互即可
yarn updatMod

更新基类 Bo(Swagger 中的 definitions)

# 更新完接口后, 去生成的代码进行简单review, 如果发现有未同步的基类, 则使用本命令, 按照提示进行交互即可
yarn updatBo