New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aplus-frontend/api-generate-cli

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aplus-frontend/api-generate-cli

aplus api generate cli for aplus-frontend team.

  • 1.1.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Aplus API Generate Cli

NPM Version NPM Downloads NPM License

命令行使用教程

aplus接口生成命令行工具,支持GETPOST请求。

提示: 当为GET请求时候参数会被Partial,这样做的原因是通常情况下查询参数都是可选的,传参时候需要注意

建议使用方式

npx @aplus-frontend/api-generate-cli create

全局安装

npm install @aplus-frontend/api-generate-cli -g

安装是否成功运行agc -v,看到帮助信息代表成功

命令行交互界面使用

提示: 需要注意要自己指定生成接口目标路径

命令行终端进入到项目根目录,然后可以选择如下两种方式agc createagc generate

运行如下命令,vscode打开项目,根据提示一步步来


 #bash 运行

agc create

 #或简写

agc cre

提示: 命令工作目录说明,包内部使用了process.cwd() 根据当前命令运行的工作目录,所以在输入生成接口目标路径时候需要自己指定。例如你需要生成的接口路径是基于项目根路径src/api/demo当中去生成接口文件,那这里的输入生成接口目标路径就填入src/api/demo

命令行创建使用

重要 agc generate方式不会询问现有接口是否已创建,会直接覆盖现有文件。

命令行指定OPEN Api 3.0json文件


 #bash 运行

agc generate --file open.json  --target src/api/demo   --service wms

 #或简写

agc gen -f open.json  -t demo   -s wms

提示: 以上2中方式,二选一即可,一般来说,第一种create方式需要配合apiFox本地导出服务。第二种需要在api同级别src目录下临时创建open.json文件放入符合OPENAPI3.0格式的json文件。

配置文件使用

为了避免频繁的输入操作,可以在项目根目录下配置.aplus-generate-rc文件,接收一个json配置。

以下是一个例子:

{
  "apiUrl": "http://demo/export/openapi/18?version=3.0",
  "outputDir": "src/api/example",
  "serviceName": "exampleService"
}
配置参数配置值描述类型
apiUrlApiFox的远端地址,或者返回了符合OPENApi 3.0接口对象的接口地址string
outputDir需要生成的目标服务路径地址,基于命令运行工作目录。例如:运行命令路径是项目根路径,需要输出到src/api/demo下string
serviceName后端微服务网关路径地址,会拼接到生成的请求url上。例如:/wms/aplus/getList,wms就是网关地址,不用加/,内部会自动拼接string

帮助


#查看帮助

agc -h

#或

agc --help

Keywords

FAQs

Package last updated on 16 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc