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

bangbang

v1.0.0

Published

bangbang.js ================= 用来做什么 ----- 完成批量复制,合并文本文件,扫描目录自定义回调处理

Readme

bangbang.js

用来做什么

完成批量复制,合并文本文件,扫描目录自定义回调处理

为什么要重复造轮子

自动化的工具很多,但发现学习成功很高。如果只是要完成“批量复制,合并,扫描目录自定义回调处理”可以试试这款。

应用场景

  1. 批量复制,合并文本文件。
  2. 对一批目录下特定文件进行逐个处理。
  3. 维护代码库.例如我们写了一个代码库如:modulesA,我们把它放在d:/myproject/modulesA这个目录下,同时做为git目录进行维护。 然后我们要需要针对这个库写一些测试demo 于是在:d:/myproject/modulesA_demo 然后这里会引用node_modules/modulesA,我们在写demo测试这个代码库里,可以直接在node_modules/modulesA修改,然后利用bangbang进行拷贝到d:/myproject/modulesA 来方便更新。

如何使用

  1. 安装
npm i git://github.com:smallerbird/bangbang.js.git -g
  1. 使用说明
#进入配置文件运行配置文件
bangbang --file 配置文件

详细配置说明和demo

  1. 完整的deom页面及运行方法
#test/test.bangbang.js
cd test
bangbang --file test.bangbang.js
  1. 关于deom配置详细说明。
//扫描的回调方法
function scanCallbak(file) {
    console.log('scanCallbak:'+file)
}

module.exports={
    //描述说明
    describe:"测试从from文件夹里,移动一些文件到to文件夹里,同时合并一个文件",
    //复制 注:可选
    script:[
        //from 从哪里拷贝 fromResolve from是相对还是绝对 to 拷贝到哪里 toResolve to是相对还是绝对
        {from:'./from/ac/',fromResolve:true, to:'./to/ac',toResolve:true, },  
        {from:'./from/a/',to:'./to/a'},
        {from:'./from/js.js',to:'./to/js.js'},
    ],
    //合并 注:可选
    merge:[
        {
            //合并的文件列表
            files:[
                //from 文件地址  toResolve文件地址是相对还是绝对
                {from:'./from/m1.js',toResolve:true},
                {from:'./from/m2.js',toResolve:true},
                {from:'./from/m3.js',toResolve:true},
             ],
             //合并后地址
            name:{file:'./to/m.js',toResolve:true}
        },
    ],
    //扫描 注:可选
    scan:{
        //扫描的目录列表
        dir:[
            {from:'./test',toResolve:true,callback:scanCallbak},
            {from:'D:\\fei\\myproject\\bangbang.js\\lib',toResolve:false,callback:scanCallbak},
        ],
        //不扫描文件的规则
        ignoreScan:[/node_modules/,/\.git/,/\.idea/]
    }
}

更新日志