GithubHelp home page GithubHelp logo

pont's Introduction

pont

pont 在法语中是“桥”的意思,寓意着前后端之间的桥梁。

npm version npm downloads Gitter

原理

pont 能够获取多种接口文档数据(目前完美支持 Swagger),将其转换为类型完美的前端 Typescript 接口层代码!

快速使用

  • 1、在 vscode 中安装插件 pont。

    每个按钮依次是:更新同步数据源(sync) | 全量更新(all) | 选择要更新的模块(mod) | 选择要更新的实体类(bo) | 生成接口层代码(generate)

  • 2、在你的项目中配置一份 pont-config.json。vscode 会提示您可以配置的配置项及其含义。配置项及其含义如下:

  • 3、确保服务端提供的数据源接口是免登录的。如果不是,请后端帮忙简单配置一下即可。

谁在使用

  • 阿里巴巴

如何配置 pont-config.json

  • originUrl(string)

接口平台提供数据源的 open api url(需要免登)

  • outDir(string)

生成代码的存放路径

  • templatePath(string)

一份 ts 文件,可以配置自定义生成代码。

  • prettierConfig(object)

生成的代码会用 prettier 美化。这里可以配置 prettier。

自定义 template

可以参考 pont-demo 中的配置 pont-template

在这份 ts 代码中,用户可以覆盖默认 Generator 类的各种方法,以自定义生成代码。

能够覆盖的方法、以及各个方法的含义,都可以通过 Typescript 的提示来看到。

example

可以参考 pont-demo,来体验 pont。

其它接口平台接入

目前 pont 暂时只支持 Swagger 数据源。目前计划支持 DIP 和 RAP2。更希望社区可以踊跃贡献代码!

目前 pont 只需要写一份数据源格式转换代码,把其它接口平台的数据源格式转换为 pont 中的标准格式,即可快捷支持其他接口平台。

pont's People

Contributors

jasonhzq avatar wufenfen avatar

Stargazers

nnqiu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.