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

@ccs-ui/plugin-floatbutton

v1.0.2

Published

### 特性

Downloads

208

Readme

open-api 可视化代码生成插件

特性

  • 本地打开 Swagger UI
  • 本地打开 Swagger UI TS 版本
  • 在线生成代码文件:http 请求和 typing.d 定义文件
  • typing 泛型化
  • 根据 controller 生成独立文件

插件安装

  • pnpm add @ccs-ui/open-api

插件启用

export default defineConfig({
  ccsOpenApi: [
    {
      projectName: 'default',
      serversPath: './src/service',
      schemaPath: 'http://136.25.60.144:30472/api/service-sysmgr/v3/api-docs',
      authorization: `Basic bWljcm86QE1pY3JvLC4xMjM=`,
      namespace: 'API',
      commonIntfs: ['Result<T>', 'PageRsp<T>', 'PageReq<T>', 'OrderProp'],
      requestImportStatement: `import { request } from '@/utils/http'`,
    },
    {
      projectName: 'easy-im',
      serversPath: './src/service',
      schemaPath: 'http://136.25.60.143:30314/easy/easy-im/v3/api-docs',
      authorization: `Basic bWljcm86QE1pY3JvLC4xMjM=`,
      namespace: 'APIM',
      commonIntfs: ['Result<T>', 'PageRsp<T>', 'PageReq<T>', 'OrderProp'],
      requestImportStatement: `import { request } from '@/utils/http'`,
    },
  ],
});

参数说明

  • projectName 项目服务名称。
  • serversPath 请求和定义文件生成目录。
  • schemaPath 接口信息地址,参考 swagger 获取的数据。
  • authorization 文档登录凭证。
  • namespace typing 定义的命名空间。
  • commonIntfs 公共类型,统一生成到 common.d.ts 文件中,避免冗余。
  • requestImportStatement: 本地 http 请求引入

生成结果示例

import { request } from '@/utils/http';

/** 清空所有缓存 */
export async function clearAllCachesUsingGet() {
  return request<API.Result<void>>(
    '/easy-im/access/CacheController/clearAllCaches',
    {
      method: 'GET',
    },
  );
}

/** 清空所有组织缓存 */
export async function clearAllOrgsCacheUsingGet() {
  return request<API.Result<void>>(
    '/easy-im/access/CacheController/clearAllOrgsCache',
    {
      method: 'GET',
    },
  );
}
declare namespace API {
  type Result<T> = {
    /** 错误编码 */
    code?: string;
    /** 业务数据 */
    data?: T;
    /** 错误信息 */
    msg?: string;
    /** 业务调用是否成功 */
    success?: boolean;
  };
}