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

@unoapi/cli

v2.3.1

Published

UnoAPI 的命令行工具

Readme

@unoapi/cli

NPM Version License

@unoapi/cli 是 UnoAPI 的命令行界面工具。它专为喜欢终端操作或需要集成到 CI/CD 流程的开发者设计。

✨ 功能特性

  • 🚀 快速初始化: 一键生成项目配置文件。
  • ⚡ 代码生成: 基于配置自动生成 API 接口和类型定义。
  • 📥 离线使用: 下载并缓存 OpenAPI 文档。
  • 🔍 交互式体验: 提供友好的命令行交互提示。

📦 安装

推荐全局安装以便在任何地方使用:

npm install -g @unoapi/cli
# 或
pnpm add -g @unoapi/cli

uno -h

也可以使用 npx 临时运行:

npx @unoapi/cli -h

🚀 快速开始

1. 初始化项目

在项目根目录下运行:

uno init

这将引导你创建一个 unoapi.config.ts 配置文件。

2. 下载文档

uno download -h

这将根据配置的 URL 下载 OpenAPI 文档并缓存到本地。

3. 生成代码

uno api -h

这将根据配置生成 API 接口和类型定义文件。

📖 命令参考

| 命令 | 别名 | 说明 | | :--- | :--- | :--- | | uno init | i | 初始化配置文件 | | uno api | gen | 生成 API 代码 | | uno download | dl | 下载 OpenAPI 文档 | | uno help | - | 查看帮助信息 |

⚙️ 配置文件

CLI 会自动读取项目根目录下的 package.jsonunoapi.config.jsunoapi.config.ts

  • package.json

    {
      "name": "your-project",
      "version": "1.0.0",
      "unoapi": {
        "input": "https://api.example.com/v3/api-docs",
        "output": "src/api",
        // ...其他配置
      }
    }
  • unoapi.config.js

    module.exports = {
      input: 'https://api.example.com/v3/api-docs',
      output: 'src/api',
      // ...其他配置
    };
  • unoapi.config.ts

    要使用 tsconfig.json 配置,必须安装 @unoapi/core 依赖。

    import { defineUnoConfig } from '@unoapi/core';
    
    export default defineUnoConfig({
      input: 'https://api.example.com/v3/api-docs',
      output: 'src/api',
      // ...其他配置
    });

更多配置选项请参考 @unoapi/core 文档

🔗 相关链接