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

manifest-builder

v0.1.4

Published

manifest.json builder

Readme

manifest-builder

一个 manifest.json 生成器,它会遍历目标路径并且递归输出 hash, 并且使用无头浏览器爬取目标站点,根据请求顺序排序对资源进行排序

安装

$ yarn add manifest-builder -D

配置 scripts:

{
  "scripts": {
    "manifest-builder": "manifest-builder"
  }
}

开始

在项目根目录输入以下命令, 创建配置文件:

$ yarn manifest-builder init

调整配置文件,使用命令执行项目:

$ yarn manifest-builder --config manifest-builder.js
# or
$ yarn manifest-builder

.gitignore 请忽略 chromeCache, 它存储着浏览器的配置

配置

manifest-builder init 生成的配置文件如下,已有详细注释

module.exports = () => {
  return {
    // 列入资源的类型
    files: 'js|css|jpg|png|jpge',
    // 等待 fastify 启动
    waitServierTime: 500,
    // md5的长度
    md5Length: 7,
    // 是否输出文件尺寸
    useSize: false,
    // 检索的文件夹
    dir: 'build',
    // 输出的文件路径
    out: 'build/precache-manifest.json',
    // 静态服务的端口
    port: 14512,
    // 是否仅输出无头浏览器捕获的资源
    onlyPuppeteer: false,
    // 输入URL列表,会按序使用无头浏览器,自动爬取首URL中请求的资源,根据请求顺序排序
    puppeteerUrls: [
      'http://127.0.0.1:14512/#/home',
      'http://127.0.0.1:14512/#/order/list',
    ],
    // puppeteer的代理配置
    puppeteerProxys: [
      {
        // 可选,匹配请求类型
        method: 'GET',
        // 可选,用于校验请求路径
        metch: new RegExp(`\\/hello-test-proxy\\/`),
        // 可选,用于排除请求路径
        ignore: new RegExp(`\\/ignore-url\\/`), // new RegExp,
        // 可选,用于关闭请求
        abort: false,
        // 可选,目标url
        url: 'https://www.baidu.com',
        // 可选,替换目标url
        replace: 'http://127.0.0.1:14512',
      },
    ],
    // 操作page,进行交互, url 为当前访问的url,page 为当前浏览器Page对象,next 表示执行下一个url,close表示遇到异常进行关闭
    puppeteerDoing: async (url, page, next, close) => {
      await page.setCookie({
        name: 'hello',
        value: 'world',
        domain: '.baidu.com',
      });
      await page.goto(url);
      await page.waitFor(3000);
      next();
    },
    // 获取 package.json 中的版本号
    package: 'package.json',
    // 处理 reduce 的路径
    reduce: (manifest, fetchList) => {
      return manifest;
    },
  };
};