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

@aliyun-obv/dashboard-validator

v0.0.3

Published

Dashboard/Chart validator for obviz-explorer

Readme

dashboard-validator

用于校验仪表盘 JSON / 图表 JSON 的命令行工具。

安装后直接使用

全局安装:

npm i -g @aliyun-obv/dashboard-validator
dashboard-validator --help

或不全局安装,使用 npx:

npx @aliyun-obv/dashboard-validator --help

用法

在仓库根目录执行:

pnpm dashboard-validator --dashboard --json ./dashboard.json

或校验单图:

pnpm dashboard-validator --chart --string '{"type":"linepro","title":"test","display":{"queryOptionMap":{"A":{"xAxisKey":"__time__","name":"A","yAxisKeys":["pv"]}},"graphOptions":{"lineWidth":2},"basicOptions":{"displayName":"test"}}}'

校验来源

工具在构建阶段从真实实现抽取 compact resource:

  • packages/dashboard/src/allCharts/registerForValidator.ts 和各图表的 getOptionBuilder 提取图表 display 配置结构,生成 src/validator/chart-resources.json
  • packages/interface/src/dashboard/core/dashboardChart.tspackages/dashboard/src/NewDashboard/util.tsxpackages/dashboard/src/NewDashboard/constant.ts 和默认 chart model 提取 dashboard / chart 顶层字段、ChartDisplay 通用字段、布局常量和保存前清理策略,生成 src/validator/dashboard-resources.json

发布后的 CLI 运行时只读取包内已打包的图表资源,不依赖业务仓库里的 dashboard 源码文件。

完整 dashboard 校验会额外检查:

  • dashboard 根字段:displayNamedashboardNamedescriptionattributecharts
  • attribute.type:仅允许 freegrid
  • 图表顶层字段:typetitledisplaysearchaction
  • 布局字段:xPosyPoswidthheightzIndexversion
  • dashboard 级关系:图表 title 唯一,connect / 容器类引用的 chart title 必须存在

未知图表类型会作为错误处理;attribute 中未知扩展字段只会产生 warning。

display 的结构会按真实保存结构校验,例如 linepro 的字段在分组下:

{
	"queryOptionMap": {
		"A": {
			"xAxisKey": "__time__",
			"name": "A",
			"yAxisKeys": ["pv", "uv"]
		}
	},
	"standardOption": {
		"format": "none",
		"unit": { "unit": "none" }
	},
	"yAxisOption": { "show": true, "position": 3, "stackingMode": "none" },
	"graphOptions": { "lineWidth": 2, "fillOpacity": 40 },
	"tooltipOption": { "mode": "all", "sortOrder": "none", "labelFormat": "" },
	"basicOptions": { "displayName": "test" }
}