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

rap2itf

v1.0.6

Published

rapper接口转换为typescirpt interface

Downloads

2

Readme

rap2itf 是什么?

rap2itf 是在[rapper][https://www.yuque.com/rap/rapper/readme] 的基础上封装的一个工具,根据rapper接口文档生成为你生成 TypeScript 类型定义本地接口类型的工具。

为什么要单独开发这么一个工具?

rapper官方团队的工具包含的请求的封装,有些情况下,我仅仅需要生成 TypeScript的类型定义,

快速开始

  1. 安装
npm i rap2itf -D

yarn add rap2itf -D
  1. 在项目根目录添加配置文件.raprc.js 添加一下配置内容
module.exports = {
    /** 必须 项目id */
    projectId: '',
    /**可选 rap服务器地址 这里配置的都是默认值*/
    rapUrl: 'http://rap2.taobao.org',
     /**可选 rapapi地址 */
    apiUrl: 'http://rap2api.taobao.org',
     /**可选 文件保存路径 */
    rapperPath: './src/types',
     /** 必须 token */
    token: '',
     /**可选 接口的id */
    interfaceId: '',
     /**可选 截取当前接口的的最后n位作为文件名和interface名,接口多解决文件名重复时可调整这个参数 */
    split: 2
}
  1. 执行
 yarn rap 

 yarn rap2itf 

如果使用npm执行,需要在package.json 的 scripts中配置

"scripts": {
       ...
        "rap": "rap" 
    },

然后执行

 npm run rap
  1. 命令行参数
  .option('--apiUrl <apiUrl>', '设置Rap平台后端地址')
  .option('--rapUrl <rapUrl>', '设置Rap平台前端地址')
  .option('--rapperPath <rapperPath>', '设置生成代码所在目录')
  .option('--i <i>', '接口id')
  .option('--interfaceId <interfaceId>', '接口id')
  .option('--projectId <projectId>', '项目id')
  .option('--p <p>', '项目id')
  .option('--token <token>', '用户token')
  .option('--split <split>', '截取路径长度作为文件名')
  .option('--s <s>', '截取路径长度作为文件名')

参考文档

没有文档了

有需要请参考rapper的文档:https://www.yuque.com/rap/rapper/install