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 🙏

© 2025 – Pkg Stats / Ryan Hefner

cmoslee

v0.0.1

Published

cmos_webpack

Readme

brush

构建项目流程工具,可以生成相应目录和代码,同时对项目进行编译 一次安装,到处运行 注:全局命令为brush

功能一览

创建项目

  • [x] 生成项目、模块、页面、组件文件结构

编译预览

  • [x] 轻量组件化功能
  • [x] 本地预览
  • [x] 数据模拟
  • [x] 更新组件

安装

基于node,请确保已具备较新的node环境(>=6.X),,这样不仅可以很方便地切换node版本,而且全局安装时候也不用加sudo了。

下载地址 http://nodejs.cn/

私服设置

cmoc-brush只在私服发布,相关资源也是从npm私服获取,使用前将本地的node环境的npm仓库地址设置为私服地址 打开命令行输入:

npm set registry http://192.168.100.10:20899

安装本项目 brush

$ [sudo] npm install -g cmos-brush

安装本项目 brush

生成新项目

根据输入的项目名称和选择的项目框架,生成一个新的项目目录

命令:
$ brush init 

启动一个服务

根据项目目录下的brush.json 配置 启动一个服务器

命令:
$ brush connect 

更新组件

切换到 项目的根目录 如: src/main/webapp下,执行 brush compts --update[版本号]更新组件 (若组件输出路径需要修改,请参照的brush.json配置)

命令:
$ brush compts --update 
更新到某一个版本
  brush compts --update [version]
例如:brush compts --update 0.0.1`更新0.0.1版本

更新组件(单更新)(测试中..)

切换到 项目的根目录 如: src/main/webapp下,执行 brush compts --install [组件名]@[版本号]更新组件 (若组件输出路径需要修改,请参照的brush.json配置)

命令:
按brush.json配置的dependencies批量更新组件
$ brush compts --install 
更新某一个特点版本的组件
$ brush compts --install [email protected]
更新某一个最新版本的组件
$ brush compts --install pc-list

组件版本查看

切换到 项目的根目录 如: src/main/webapp下,执行 brush compts --v查看组件当前版本号

命令:
brush compts --v
输出入:
compts version is: 1.1.2
pc-date version is: 1.0.7
pc-list version is: 1.0.4

更新静态资源url

切换到 项目的根目录 如: src/main/webapp下,执行 brush static --update [版本号]更新静态资源引用url (执行前请先确认static配置,请参照的brush.json配置)

命令: 
更新某一个特点版本的静态资源url
$ brush static --update 1.0.6
更新某一个最新版本的静态资源url
$ brush static --update 

注:brush static --update是根据配置查找对应文件进行替换url的操作,首次请在需要替换的位置使用@{{currentUrl}},如下:

第一次编写:
<link rel="stylesheet" href="@{{currentUrl}}ng-common.css">
执行brush static --update后———>
<link rel="stylesheet" href="http://192.168.91.242:8888/static/ngcs-common/0.0.5/ng-common.css">
执行brush static --update 0.0.2后———>
<link rel="stylesheet" href="http://192.168.91.242:8888/static/ngcs-common/0.0.2/ng-common.css">

通过这样方式改变静态资源url

其他命令

参数 -h 查看已有命令

参数 -V 查看当前版本号

brush.json 配置说明

属性名|类型|说明 -----|:--|:-- name |string|项目名 appDir|path|项目源路径(项目打包时配置) connect |object{}:port---端口(默认8110) mockport---json-server端口号(默认9000) mockJsonDir ---模拟数据资源路径 jsonConfig---[]配置json-server其它参数(例如routes)|服务配置 compts|object: output--组件更新输出路径 source--组件源名称(默认:compts_npm) |组件配置 frameVersion|string|框架版本号 comptsVersion|string|组件版本号

brush.json配置说明

{
    //项目名称
    "name": "cmos",
    //服务启动配置
    "connect": {
        "port": 8892,
        //0.2.0 以后移除功能
        "mockport":9001,
        //0.2.0 以后移除功能
        "mockJsonDir": "./data/db.json",
        //0.2.0 以后改名mockConfig
        "jsonConfig": []
        //模拟数据配置json文件
        "mockConfig":"./data/db.json",
        //模拟的json文件文件目录配置,可为空
        dataDir:"./data/"
    },
	//项目打包配置
	"release": {
		"excludeAll":["text","style"], //配置优化模块后,通过配置excludeAll排除掉这些模块不打包合并到模块内
		"modulesFile": "./moduleList.js",//列出要优化的模块通过该js 单独配置,moduleList.js格式如下
		"appDir": "./src/", //应用程序的顶级目录
		"baseUrl": "./", //默认情况下,所以的模块都相对于这个路径存在(有人称为脚本的跟路径),如果baseUrl没有明确指定的话,那么所有的模块路径都相对与build构建文件的路径。如果appDir已设置,那么baseUrl 的路径是相对与appDir
		"optimize": "none",//优化脚本文件的方式 有值none、uglify2
		"mainConfigFile": "./testSrc/requirejsMain.js" //requirejsMain 地址
	},
    "compts": {
		//反向代理开关
		"isProxy":false,
		//反向代理地址配置
		"proxy":"http://192.168.91.248:8889",
        //组件更新输出文件位置
        "output": "./src/assets/",
        //单组件更新时项目对单组件的依赖组件以及版本
        "dependencies": {
            "pc-test": "1.0.7",
            "pc-list": "1.0.4"
        }
    },
    //框架版本号
    "frameVersion": "0.0.1",
    //组件版本号,针对于组件整体更新
    "comptsVersion": "0.0.1",
    //静态资源更新配置项 执行brush static --update 必须配置
    "static": {
        //静态资源更新配置项之 静态资源名称 ,必须配置
        "name": "ngcs-common",
        //静态资源更新配置项之 静态资源服务器位置 可以不配置,不配置按默认,一般不用单独配置
        "origin": "http://localhost:8888",
        //需要替换的url的文件
        "include": "./**/*.html",
        //静态资源更新配置项之 当前静态资源url 不用配置 执行命令后自动生成
        "currentUrl": "http://localhost:8888/static/ngcs-common/0.0.5/",
        //静态资源更新配置项之 当前静态资源版本 不用配置 ,执行命令后自动生成
        "version": "0.0.5"
    }
}

模拟数据 示例

{
  "api/v1/blog/user!getUserInfo":"userInfo.json",
  "api/v1/blog/page/{*}":{
    "method=GET":"list_notice.json",  
    "method=POST":"selectTree.json"
  },
  "api/v2/blog/user!getUserInfo":{
	//其中uuid是参数值为user 即匹配 
	//api/v2/blog/user!getUserInfo?uuid=user  api/v2/blog/user!getUserInfo?uuid=user&t=0 等的get请求 
    "method=GET&uuid=user":"list_notice.json",
    "method=POST":"selectTree.json"
  },
  "api/{*}/{*}":{
    "uid=2&t=3":"topMenu.json"
  },
  "api/{*}/{*}/detail":"topMenu.json"
}

modulesFile配置 moduleList.js示例

// moduleList.js 应该返回一个数组
module.exports = [
	{name:'test'},
	{name: 'js/index/index',exclude:['Util','Compts']}
]

版本更新日志

版本|时间|更新内容 -----|:--|:-- 0.0.1 |2017-03-08|将brush connect 虚拟服务命令支持resetful格式接口 0.1.0|2017-04-07|更新brush工具支持组件单独更新 0.2.0 |2017-04-28|增加brush工具支持静态资源url版本更新.增加查看组件版本命令.修改组件更新后brush.json配置不更新问题.修改brush connect 虚拟服务命令支持resetful格式,去除json-server. 0.2.1|2017-05-03|解决缺少minimatch模块报错问题 0.2.3|2017-05-17|增加项目js压缩功能(测试阶段) 0.2.5|2017-06-06|解决js压缩文件路径问题,ie8问题 0.2.6|2017-06-07|解决js压缩文件字体文件ie8问题 0.2.7|2017-06-14|增加反向代理功能.当设置isProxy为true(默认为false)时。请求接口代理到proxy地址请求并返回。

  • 注:配置文件会随框架下载时配置好,一般不需要修改