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

tubao-dir

v1.0.7

Published

可以自由灵活的获取到特定目录的文件名字数组以便于配合webpack进行整体工程打包

Readme

tubao-dir

​ 兔宝核心是兔宝世界游戏产品设计的解决方案

tubao-dir是一款小巧的目录获取工具,其目的是为了配合webpack进行多文件打包而存在,提供了排除特定文件类型,排除特定文件名字功能,基本上实现了获取目录文件内容列表的绝大多数需求。

如果你满足以下情况请使用兔宝-目录

​ 1.你希望用webpack进行对自己的工程项目打包

​ 2.你希望打包的是一个类库而不是直接上线的代码

​ 3.你希望打包的是整个目录内所有文件而不是单个文件

​ 4.你希望你类库中所有枚举,接口,类,都可以在打包的类库中使用

如果你满足这4点或者只是单纯的想要使用目录获取功能,那么请尽情使用吧,想了解更多请访问兔宝世界官网:https://www.tubao.cc/

安装使用兔宝核心-目录

cnpm i tubao-dir

1.随便找一个你的工程可以找到的目录把tubao-dir安装上

tubao-dir中,你可以看见bin目录,bin目录下面有tubao-dir文件夹,这个就是要在你工程里面导入的包。

const tubao = require('../../../tubao-dir/index');

2.创建实例,并且写好排除文件数据

const tubao = require('../../../tubaoDir/index');

var dir = new tubao.tubaoDir([字符串数组1],[字符串数组2])

字符串数组1:这里放你想要排除的文件类型,比如你想排除掉txt和json文件格式那就可以写成['.txt','.json']

字符串数组2:这里放你想要排除的文件名字,比如你想要排除掉名字为aaa和bbb的文件那么就这样写['aaa','bbb']

const tubao = require('../../../tubaoDir/index');

var dir = new tubao.tubaoDir(['.txt','.json'],['aaa','bbb'])

3.获取文件夹内文件名字列表,并且链接到webpack工作

然后就是获取文件目录名字列表了

const tubao = require('../../../tubaoDir/index');
var dir = new tubao.tubaoDir()

dir.read(想要获取的目录)

想要获取的目录:这里放你想要获取的目录内容字符串,比如当前目录下src目录下所有的文件列表那么就这样写"./src/"

目录字符串千万不要忘记加最右面的斜杠

同时你还应该知道webpack一个属性entry,这个属性表示要被编译的文件内容,下面这是一个typescript+webpack的简单配置


module.exports = {
    mode: 'development',
    entry: './src/index.ts',
    devtool: 'source-map',//inline-source-map
    target: 'async-node',
    module: {
        rules: [
            {
                test: /\.ts?$/,
                use: 'ts-loader',
                exclude: /node_modules/
            }
        ]
    },
    resolve: {
        extensions: ['.ts', '.js']
    },
    output: {
        filename: 'index.js',
        path: path.resolve(__dirname, './bin/token'),
        libraryTarget: "umd",
        globalObject: 'globalThis',


    },
    externals: {
        lodash: {
            commonjs: 'lodash',
            commonjs2: 'lodash',
            amd: 'lodash',
            root: '_'
        }
    }
};

我们需要修改module.exports中entry属性对应的值为dir.read('./src/')

也就表示原始部分代码:

entry: './src/index.ts',

修改为

entry: dir.read('./src/'),

其中的dir是我们刚刚创建的实例

4.开始让tubao-dir工作吧

在cmd控制台,运行webpack命令npx webpack执行webpack编译。

本项目开源协议为MIT开源协议,无任何限制流转