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

lkl-builder

v1.1.7

Published

开箱即用的JavaScript库打包工具,内部使用rollup实现

Readme

library builder

开箱即用的JavaScript库打包工具,内部使用rollup实现

安装

npm install --save-dev lkl-builder --registry=http://npm.lkangle.cn

全局安装可支持使用create命令

使用

$ npx builder -h
Usage: builder [command] [options]

Options:
  -v, --version                    查看工具版本号
  -h, --help                       查看帮助

Commands:
  build [options]                  library打包 (默认命令)
  add <library>                    添加库,支持: ts, jest, eslint, babel
  create [options] <project-name>  使用模板初始化一个项目
  help                             查看命令帮助

$ npx builder help build
Usage: builder build [options]

library打包 (默认命令)

Options:
  -i, --input <input>    输入文件 (default: "index.js")
  -o, --output <output>  输出文件 (default: "dist/index.js")
  -f, --format <format>  输出的文件类型 (default: "iife")
  -n, --name <name>      模块名
  -s, --sourcemap        输出sourcemap文件 (default: false)
  -t, --terser           使用terser进行压缩 (default: false)
  -w, --watch            监听文件变化 (default: false)
  -h, --help             查看帮助

$ npx builder help create
Usage: builder create [options] <project-name>

使用模板初始化一个项目

Options:
  --ts        使用typescript (default: false)
  --jest      添加jest (default: false)
  --eslint    添加eslint (default: false)
  -h, --help  查看帮助
  
$ npx builder help add
Usage: builder add [options] <library>

添加库,支持: ts, jest, eslint, babel

Options:
  -h, --help  查看帮助

支持使用配置文件

在项目根目录下创建build.config.js,默认配置

{
  input: '',               // 入口文件
  plugins: [],             // 要使用的插件
  extensions: ['.ts', '.js', '.json'],
  alias: {                 // 配置别名 @rollup/plugin-alias
    '@': '/src'
  },
  output: [],              // 打包输出文件
  server: {                // 开发服务器配置
    contentBase: '/dist',
    port: 4002
  },
  terser: false            // 代码压缩配置 rollup-plugin-terser
  // 可写其他rollup支持的配置
}

内建的插件

  • @rollup/plugin-commonjs

暂未向外暴露配置

  • @rollup/plugin-node-resolve

支持 extensions 配置

  • @rollup/plugin-alias

通过 alias 配置

  • rollup-plugin-serve

在启用-w时会自动启用。可通过server来指定配置

  • rollup-plugin-terser

terser不为false时启用,可以通过terser来指定配置

  • @rollup/plugin-babel

当项目跟目录下存在的babel的配置时会启用,当启用babel时必须要安装相关的babel库

插件默认配置如下,暂不支持配置

{
  exclude: 'node_modules',
  babelHelpers: 'bundled',
  extensions: '${extensions}'
}
  • @rollup/plugin-eslint

当项目下存在eslint的配置时会自动启用,启用需要安装对应的eslint依赖

插件默认配置,不支持修改

{
  throwOnError: true
}