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 - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

2

package.json
{
"name": "@aplus-frontend/api-generate-cli",
"version": "1.0.5",
"version": "1.0.6",
"description": "aplus api generate cli for aplus-frontend team.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -30,7 +30,7 @@ # Aplus API Generate Cli

## 使用
## 命令行交互界面使用
命令行终端进入到项目src目录,然后可以选择如下两种方式`agc create`或`agc generate`
> **提示:** 需要注意要自己指定`生成接口目标路径`
1. 命令行交互界面创建
命令行终端进入到项目根目录,然后可以选择如下两种方式`agc create`或`agc generate`

@@ -51,4 +51,10 @@ 运行如下命令,vscode打开项目,根据提示一步步来

2. 命令行指定`OPEN Api 3.0`json文件
> **提示:** 命令工作目录说明,包内部使用了process.cwd() 根据当前命令运行的工作目录,所以在输入`生成接口目标路径`时候需要自己指定。例如你需要生成的接口路径是基于`项目根路径`下`src/api/demo`当中去生成接口文件,那这里的输入`生成接口目标路径`就填入`src/api/demo`
## 命令行创建使用
> **重要** `agc generate`方式不会询问现有接口是否已创建,会直接覆盖现有文件。
命令行指定`OPEN Api 3.0`json文件
```bash

@@ -58,3 +64,3 @@

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

@@ -67,4 +73,24 @@ #或简写

> 特殊说明:以上2中方式,二选一即可,一般来说,第一种`create`方式需要配合`apiFox`本地导出服务。第二种需要在`api`同级别`src`目录下临时创建open.json文件放入符合`OPENAPI3.0`格式的json文件。
> **提示:** 以上2中方式,二选一即可,一般来说,第一种`create`方式需要配合`apiFox`本地导出服务。第二种需要在`api`同级别`src`目录下临时创建open.json文件放入符合`OPENAPI3.0`格式的json文件。
## 配置文件使用
为了避免频繁的输入操作,可以在项目根目录下配置`.aplus-generate-rc`文件,接收一个json配置。
以下是一个例子:
```json
{
"apiUrl": "http://demo/export/openapi/18?version=3.0",
"outputDir": "src/api/example",
"serviceName": "exampleService"
}
```
| 配置参数 | 配置值描述 | 类型 |
| ----------- | ------------------------------------------------------------------------------------------------------------------- | -------- |
| apiUrl | ApiFox的远端地址,或者返回了符合`OPENApi 3.0`接口对象的接口地址 | `string` |
| outputDir | 需要生成的目标服务路径地址,基于命令运行工作目录。`例如:运行命令路径是项目根路径,需要输出到src/api/demo下` | `string` |
| serviceName | 后端微服务网关路径地址,会拼接到生成的请求url上。`例如:/wms/aplus/getList,wms就是网关地址,不用加/,内部会自动拼接` | `string` |
## 帮助

@@ -71,0 +97,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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