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 🙏

© 2025 – Pkg Stats / Ryan Hefner

sjta

v1.13.0

Published

swagger json to axios

Downloads

59

Readme

swagger-to-axios

根据 swagger json schema 生成 Frontend API Config 文件。

特性

  • 仅支持 swagger json v3
  • 按照 tag 划分为多个文件
  • 支持参数类型标注 以及 返回值类型标注
  • 将所有的类型提取到一个文件中
  • 支持配置本地的 swagger json 文件 或者 http 资源

用法

安装

# 局部安装
yarn add sjta
# 全局安装
yarn add sjta -g

使用

# 全局安装时
sjta -o example/auto-service -s "http://task.airtlab.com/static/document.json"

# 局部安装时
npx sjta -o example/auto-service -s "http://task.airtlab.com/static/document.json"

支持选项:

-o --outDir # 输出目录,如果目录不存在,则自动创建目录
-s --source # swagger json 文件目录, 如果以http开头,则为远程文件
-b --banner # 每个文件顶部内部, 默认 为 `import { request } from "@/utils/request"`

配置远程的 swagger json 文件:

sjta -o example/auto-service -s "http://task.airtlab.com/static/document.json"

配置本地的 swagger json 文件:

sjta -o example/auto-service -s "./example/document.json"

配置文件

工作目录下 sjta.config.json

{
  "banner": "import { request } from \"@/utils/request\"",
  "requestMethod": "request"
}
  • banner 顶部内容
  • requestMethod 发起请求的方法

调试

npx ts-node lib/entry -o example/auto-service -s ./example/document.json