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

@scxfe/api-tool

v0.4.2

Published

根据 Swagger/OpenAPI 3.0 和 Apifox 的接口定义生成 TypeScript/JavaScript 的接口类型及其请求函数代码。

Readme

@scx/api-tool

一个强大的 Node.js CLI 工具,专门用于从各种 API 管理平台(如 Swagger/OpenAPI 3.0、Apifox)自动生成 TypeScript/JavaScript 代码。

✨ 主要特性

  • 🚀 多平台支持: 支持 Swagger、Apifox 等主流 API 管理平台
  • 📝 类型生成: 自动生成完整的 TypeScript 类型定义
  • 🔧 代码生成: 自动生成 HTTP 请求函数和接口代码
  • 🎨 模板定制: 支持自定义代码生成模板
  • ⚙️ 配置灵活: 丰富的配置选项和钩子函数
  • 📦 多格式输出: 支持 TypeScript 和 JavaScript

🚀 快速开始

安装

# 全局安装(推荐)
pnpm install -g @scxfe/api-tool

# 或项目本地安装
pnpm install --save-dev @scxfe/api-tool

# 或使用 npx
npx @scxfe/api-tool

基本使用

# 1. 初始化配置文件
npx api-power init

# 2. 编辑配置文件 api-power.config.ts / api-power.config.js

# 3. 生成代码
npx api-power

features

[x] 请求方法与数据类型分离 [x]

📖 文档

🔧 配置示例

import { defineConfig } from '@scxfe/api-tool';

export default defineConfig([
  {
    serverUrl: 'https://api.apifox.com',
    serverType: 'apifox',
    apifoxProjectId: 'your-project-id',
    typesOnly: false,
    target: 'typescript',
    outputDir: 'src/service',
    projects: [
      {
        token: 'your-project-token',
        categories: [{ id: 0 }],
      },
    ],
  },
]);

📁 项目结构

project/
├── api-power.config.ts          # 配置文件
├── src/
│   └── service/               # 生成的代码目录
│       ├── types.ts           # 类型定义
│       ├── request.ts         # 请求函数
│       └── index.ts           # 导出文件
└── package.json

🛠️ 开发

# 安装依赖
pnpm install

# 开发模式
pnpm run docs:dev

# 构建文档
pnpm run docs:build

# 预览构建结果
pnpm run docs:preview

📄 许可证

MIT License - 详见 LICENSE 文件

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📞 联系方式