![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@xm-fe/create-api
Advanced tools
鲜沐科技 前端API生成工具
Apifox
客户端summerfarm-manage
请让后端在接口文档上直接生成(不是后端手动改文档)❗❗❗因为所有的流程都是工具生成, 前后端对接口文档的操作请勿手动修改,以免后来的同学覆盖了原来手动修改的接口
npm i @xm-fe/create-api -g
运行capi
命令时,会读取当前项目根目下的的 capi.config.js
文件,该文件中的配置会覆盖默认配置文件。
capi.config.js 具体配置及解释看文末
在项目根目录下新建 capi.config.js
文件
运行命令后,生成的请求文件会生成到 apix/项目projectId对应的文件名/接口名
下
capi http://127.0.0.1:4523/export/openapi/5?version=3.0
直接使用导出的地址,无需再拼写 projectId
备注:此方法不适用于 全部导出,如需全部导出请使用 方式二 或 三
capi http://127.0.0.1:4523/export/openapi/9?version=3.0 954456
命令组成:capi apifox导出的URL projectId
capi
读取项目根目录配置文件 capi.config 中的 remotePath
{
954456: 'SAAS',
1164722: 'summerfarm-manage',
1164725: 'pms-service',
1295278: 'summerfarm-crm',
1409074: 'tms',
1965722: 'summerfarm-wms',
2020406: 'OFC',
2437205: 'saas-manage',
2437206: 'saas-oms',
2437207: 'saas-mall',
2517920: 'summerfarm-wnc',
2546551: 'saas-pms',
2546569: 'SCP',
2546585: 'SRM',
2546600: 'bms-service',
2737704: 'summerfarm-mall'
}
缺少的项目 请联系我加进去 禁止私自手动修改文件名
module.exports = {
remotePath: `http://127.0.0.1:4523/export/openapi/4?version=3.0&projectId=xxxx`,
language: 'js',
// 插入的模板代码
getApiCodeTpl(api) {
const pathParams = api.pathParams
.map((param) => `${param.name},`)
.join('\r\n')
return `
import net from '@/libs/net'
/**
* ${api.summary}
*/
export function ${api.fileName || api.name}(
${pathParams ? pathParams : ''}
${api.queryParams ? `params,` : ''}
${api.bodyParams ? `data,` : ''}
) {
return net(
{
url: \`${api.url}\`,
method: '${api.method}',
${api.queryParams ? `params,` : ''}
${api.bodyParams ? ` data` : ''}
}
)
}`
}
}
module.exports = {
remotePath: `http://127.0.0.1:4523/export/openapi/4?version=3.0&projectId=xxxx`,
language: 'ts', // 生成的语言的使用方式 默认 'ts', 可选值:'js' | 'ts'
// 插入的模板代码
getApiCodeTpl(api) {
const pathParams = api.pathParams
.map((param) => `${param.name}${param.required ? '' : '?'}: ${param._type},`)
.join('\r\n')
return `
import net from '@/utils/net'
import { NetConfig } from '@/interface/IAxiosConfig'
/**
* ${api.summary}
*/
export function ${api.fileName || api.name}(
${pathParams ? pathParams : ''}
${api.queryParams ? `params?: ${api.queryParams._name},` : ''}
${api.bodyParams ? `data?: ${api.bodyParams._name},` : ''}
config?: NetConfig
): Promise<${api.resType}> {
return net(
{
url: \`${api.url}\`,
method: '${api.method}',
${api.isDownload ? `_download: true,` : ''}
${api.queryParams ? `params,` : ''}
${api.bodyParams ? ` data,` : ''}
},
config
)
}
`
}
}
# 安装依赖
npm i
# 发布流程
# 编译
npm run build
# 本项目
npm link
# 引用调试的项目
npm link 包名
# 取消关联
npm unlink 包名
# 查看
npm ls -g
FAQs
API快速导入
The npm package @xm-fe/create-api receives a total of 11 weekly downloads. As such, @xm-fe/create-api popularity was classified as not popular.
We found that @xm-fe/create-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.