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

@yuku123/z-frontend-common

v0.2.9

Published

z-opc 共享前端组件库 - AppLayout / StatusTag / LoginPage / ErrorBoundary + 统一 createRequest 工厂

Readme

@yuku123/z-frontend-common

z-opc 共享前端组件库 · React 19 + Ant Design 6

安装

npm install @yuku123/z-frontend-common
# 国内用户加速
# .npmrc: @yuku1231:registry=https://registry.npmmirror.com/

导出能力

组件

  • AppLayout — 统一布局(Sider + Header + Content)
  • StatusTag — 状态标签
  • LoginPage — 统一登录页
  • ErrorBoundary — React 错误边界

请求工具

  • request — 默认实例(baseURL=/api,识别 {code, data, message} 后端响应)
  • authRequest — 同上(语义区分)
  • createRequest({baseURL, tokenKey, userInfoKey, unauthorizedRedirect, timeout}) — 工厂
  • setupInterceptors(instance, options) — 自定义拦截器

使用示例

import { AppLayout, LoginPage, request } from '@yuku123/z-frontend-common'

// 业务模块推荐:在 src/utils/request.js 写 2-10 行适配层
import { createRequest } from '@yuku123/z-frontend-common'
const request = createRequest({ baseURL: '/meta', tokenKey: 'token' })
export default request

统一后端响应格式

{ "code": 200, "data": T, "message": "ok" }
  • code=200 → 自动返回 data
  • 其他 code → reject
  • 响应无 code 字段 → pass-through 透传

长期方案

  • 模板从 z-meta 拉取(数据库驱动)
  • 业务侧 res.data.xxx 写法统一

仓库

https://github.com/yuku123/z-opc/tree/main/z-frontend-common

License

MIT