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

cybmock

v1.4.0

Published

塞伯坦前端数据模拟服务器

Downloads

6

Readme

  • Mac系统推荐使用 iterm2oh my zsh
  • 类 Unix 系统,请打开任意终端输入命令执行。
  • Windows 用户请先安装 git,然后在 Git Bash 下执行命令。

安装

1. 安装 Node 和 NPM

  • 官网下载安装Node: https://nodejs.org
  • node >= 6.x,建议使用最新稳定版(LTS)。
  • Ubuntu 用户使用 apt-get 安装 node 后,安装的程序名叫 nodejs,需要软链成 node
  • Windows 用户安装完成后需要在 CMD 下确认是否能执行 node 和 npm。

设置 npm config set loglevel=http 可以查看npm包的下载和安装进度。

2. 全局安装 CYBMOCK

npm install -g cybmock #或者 yarn global add cybmock

某些window系统若不能正常安装CYBMOCK,请使用管理员身份先安装windows-build-tools

使用

1. 进入MOCK数据存放目录

# 新建目录
mkdir cybmock-demo

# 或者进入已有项目目录
cd project

2. 运行MOCK服务

cybmock start

在命令执行目录会自动生成cybmock.config.js配置文件及mock示例。

.
└── cybmock.config.js
//cybmock.config.js 示例
const proxy = {
  'GET /api/demoGet': {
    tips: '用于演示GET请求',
    name: '塞伯坦前端模块化工程构建工具',
    github: 'https://github.com/jd-cyb/cyb-cli'
  },
  'POST /api/demoPost': {
    tips: '用于演示POST请求',
    name: '塞伯坦前端数据模拟服务器',
    github: 'https://github.com/jd-cyb/cybmock'
  }
}

module.exports = proxy

为了便于复杂项目MOCK数据的管理,请在与cybmock.config.js同级新建mock目录,用于存放更多的MOCK数据模块,并支持使用ES Module或CommonJS的模块化管理MOCK数据。

.
├── cybmock.config.js
├── mock
│   ├── demo-get.js
│   └── demo-post.js
├── node_modules
│   └── mockjs
└── package.json


//cybmock.config.js

import demoGet from './mock/demo-get'
import demoPost from './mock/demo-post'
import mockjs from 'mockjs'

const proxy = {
    'GET /api/demoGet': demoGet,
    'POST /api/demoArray': demoPost,
    'GET /api/demoMockjs': mockjs.mock('@string("lower", 5)')
}
module.exports = proxy

CYBMOCK 会自动打开默认浏览器进入MOCK数据服务环境,并罗列出cybmock.config.js配置的所有 MOCK接口,cybmock.config.jsmock目录中任意MOCK数据文件的更改都会自动更新接口,请尽情享用CYBMOCK为你带来高效、愉悦的MOCK服务体验!

  • 启动MOCK服务器
cybmock start

零配置快速启动MOCK服务器,如果命令执行目录cybmock.config.js配置文件不存在,会默认创建cybmock.config.js并生成demo数据,同时自动打开默认浏览器进入MOCK数据服务环境,并罗列出cybmock.config.js配置的MOCK接口,任何MOCK数据文件的更改都会自动更新接口。

  • 使用npm升级
npm update -g cybmock
  • 使用yarn升级
yarn global upgrade cybmock

使用文档:http://cybmock.hestudy.com/docs/

官方网站:http://cybmock.hestudy.com/

塞伯坦CYB:http://cyb.hestudy.com/

MIT

Copyright (c) 2018, 塞伯坦前端架构组