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 🙏

© 2024 – Pkg Stats / Ryan Hefner

umi-plugin-mock-manager

v1.0.5

Published

`mock`管理插件,在已有的`mock`基础功能上,增加页面用来更细粒度的`mock`控制,可以精确到某一条`mock`启用状态。

Downloads

3

Readme

umi-plugin-mock-manager

mock管理插件,在已有的mock基础功能上,增加页面用来更细粒度的mock控制,可以精确到某一条mock启用状态。

功能

  • [x] 提供ui页面可以更精确的控制mock状态

  • [x] 缓存记录每一次的配置修改

  • [x] 统一增加前缀,适配requestbaseURL功能

  • [x] 点击跳转到对应的源码文件

安装

npm install -D umi-plugin-mock-manager

配置

config.ts文件增加如下配置

export default {
  // 插件的相关配置
  mockManager: {
    // mock 文件夹是默认包含在内的,如果有需要可以手动添加, 支持通配符
    include: ["src/**/mock/**.mock.ts"],
    // 如果 request 设置了 baseURL,则需要增加该前缀,如果定义的每个 mock 记录已包含,则可以不用设置
    prefix: "/api",
    // 默认的 mock 管理页面路由是 /_mock ,可以自定义前缀 /abc , 则访问的路由变为 /abc/_mock
    routeBasename: "",
    // 是否禁用默认的 umi mock 插件, 默认禁用
    autoDisableUmiMock: true,
  },
  // 添加插件
  plugins: ["umi-plugin-mock-manager"]
};

启动项目

新增package.jsonscript

{
  "script":{
    "dev:run-mock": "cross-env REACT_APP_ENV=dev UMI_ENV=dev MOCK_MANAGER=enable max dev"
  }
}

启动项目后,访问/_mock地址即可

注意:执行的npm命令需要保证umi的启动命令名是devMOCK_MANAGER变量需要是enable(默认是不启用的),当本插件启用后会禁用umi的预设插件mock