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 🙏

© 2024 – Pkg Stats / Ryan Hefner

web-scouter

v0.0.12

Published

web scouter

Downloads

10

Readme

web-scouter

用于发版后对网页做健康检查

示例:

安装

项目依赖安装

# 加速puppeteer的下载
npm set puppeteer_download_host https://npm.taobao.org/mirrors

# 全局安装puppeteer时设置不安全模式
npm config set unsafe-perm true

# 全局安装
npm i -g web-scouter

# 恢复安全模式
npm config set unsafe-perm false

不同操作系统需要安装的依赖

  • centos7 及以上版本(不支持 6 版本)
# 1.
sudo yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc

# 2.
yum update nss -y

使用

# 查看版本
web-scouter -v

# 查看帮助
web-scouter -h

# 检查网页  start <url>
web-scouter start https://www.baidu.com

# 检查移动端网页   命令缩写 -m,--min
web-scouter start https://m.baidu.com -m

输出信息

cdn

文件是否通过 cdn 方式引入

  1. 未通过 cdn 引入,需要检查
  2. 未命中 cdn 缓存,偶尔会出现检查误差
  3. 命中 cdn 缓存, ✔

例如:

cdn ✔ index.js  未通过 cdn 引入
cdn ✖ index.css  命中 cdn 缓存
cdn ✖ app.js  没有命中cdn缓存

cache

文件是否开启缓存机制,首页 index.html 不需要被缓存

  1. index.html 不能开强缓存
  2. 其他静态资源都需要开启强缓存

例如:

cache ✖ vendor.js 没有开启资源本地强缓存,请检查
cache ✔ index.js  开启了资源本地缓存

sourceSize

js,css 打包文件大小的检测(经过 gzip 或 br 等在传输中压缩后的大小),小于 10kb 的文件跳过检查

例如:

sourceSize ✔ index.js  大小 0.65 mb

hsts

HTTP 严格传输安全模式是否开启

例如:

hsts ✖ 站点未启用HSTS,有SSL剥离威胁

zip

文件压缩格式(gzip、compress、deflate、br 等等)

例如:

zip ✔ index.html   开启了 gzip 压缩
zip ✔ index.css   开启了 br 压缩

mainSite

主站的检测

index.html 缓存:不应该开启缓存 http 压缩方式 重定向检测:不允许重定向 hsts 检测 https 证书:检测 https 证书信息,时长,剩余时长小于 3 个月警告 跨域配置安全检测: Access-Control-Allow-Credentials 被设置为“true”时,Access-Control-Allow-Origin 不应该设置为“*”,一来非常不安全,二来部分浏览器也会直接报错以示抗议。

例如:

mainSite ✔ index.html  没有开启资源本地缓存,正确
mainSite ✔ index.html  开启了 gzip 压缩
mainSite ✔ https 证书时长剩余 699 天
mainSite ✔ HSTS 已正确开启
mainSite ✔ 没有产生重定向
mainSite ✖ 存在跨域安全问题,请检查

metrics

网站性能指标检测,

  1. 首页加载时间
  2. 首页加载全部请求资源大小

例如:

metrics ✔ 首页加载时间为 1.606 s
metrics ✔ 加载资源总大小 9.434 mb