
Security News
npm Tooling Bug Incorrectly Marks One-Character Packages as Security Holders
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.
api-initnpm install api-init --save-dev
npx api-init install
npx api-init install api
npx api-init docs
npx api-init docs api
api-initnpm install api-init --save-dev
// package.json
{
"scripts": {
"api-init": "api-init",
}
}
npm run api-init install
npm run api-init install api
4.生成接口文档(注:文档路径需要和接口 api 初始化路径相同)
npm run api-init docs
npm run api-init docs api
├── src
├── api
├── docs
└── index.js #生成接口文档明显
├── modules
├── example.js #接口模块配置
└── ...
├── request
├── config.js #公共请求方法配置
└── index.js #封装公共请求方法
├── docs.json #接口方法明显
└── index.js #自动生成接口方法
├── ...
在 api/modules 目录下添加对应的模块,按照规定添加对应配置项目,就可以生成对应的接口方法,如:
// 1、modules添加example.js模块
// 2、添加接口对应配置项
export default [
{
name: "query", // 接口方法名取接口url最后一个单词
method: "get", // 接口请求方法
url: "example/query", // 接口url
params: {}, // 接口默认传参
docs: "接口说明", // 接口说明注释
},
];
// api文件夹配置别名api
import api from 'api' // 或 import api from '@/api'
// 使用
api.example.query({ // 参数 })
api-init 文档地址: https://hugolgw.github.io/api-main
api-init npm 地址: https://www.npmjs.com/package/api-init
api-init 源码地址: https://github.com/hugolgw/api-main
原创不易,欢迎 star
MIT
FAQs
Web engineering project API initialization
The npm package api-init receives a total of 11 weekly downloads. As such, api-init popularity was classified as not popular.
We found that api-init demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.

Research
/Security News
Newer packages in this compromise use native extensions and .pth loaders to execute JavaScript stealers in developer environments.

Research
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.