npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

generator-singularity-swagger-api

v0.1.2

Published

根据swagger地址生成接口代码

Readme

generator-singularity-swagger-api

一款基于 Yeoman 的swagger 接口代码生成器 ,借助这个软件包,可以生成一个访问swagger api 的类.

安装

需要同时安装Yeoman 和 generator-singularity-swagger-api

npm install -D yo
npm install -D generator-singularity-swagger-api

使用

yo singularity-swagger-api

输入提示

  • ?请输入swagger地址,如:http://localhost:8080/ (http://localhost:8080/) 根据地址访问swagger接口数据
  • ?请输入请求类地址 (src/utils/request.js) 请求类文件路径
  • ?请输入输出文件位置 (src/utils/api/) 文件输出位置

可通过命令行直接穿参

yo singularity-swagger-api --swaggerUrl=http://localhost:8080 --outputFile=src/utils/api/ --requestPath=src/utils/request.js

参数

  • swaggerUrl 后台链接地址
  • outputFile api文件保存路径
  • requestPath 请求累访问路径

生成代码示例

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
// @ts-ignore
var request_js_1 = require('../request.js');
/**
 * TCBA api
 * TCBA API工具
 * Fri Dec 25 2020 10:59:32 GMT+0800 (China Standard Time)
 */
var RequireApi = /** @class */ (function () {
	function RequireApi() {}
	/**
	 * 清空未读通知
	 * -
	 */
	RequireApi.AnnouncementCleanNotRead = function (body) {
		return request_js_1.default.connection('post', '/Announcement/CleanNotRead', body);
	};
	/**
	 * 获取通知列表
	 * -
	 */
	RequireApi.AnnouncementList = function (query) {
		return request_js_1.default.connection('get', '/Announcement/List', query);
	};
	/**
	 * 查询未读通知数量
	 * -
	 */
	RequireApi.AnnouncementNotRead = function (query) {
		return request_js_1.default.connection('get', '/Announcement/NotRead', query);
	};
	return RequireApi;
})();
exports.default = RequireApi;

使用

import RequireApi from '../../utils/api';

RequireApi.AnnouncementCleanNotRead({}).then(res => { console.log(res)})