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

custom-dashboard-vue

v0.1.7

Published

✅ 已完成工作

Readme

✅ 已完成工作

  1. 库构建配置 (Library Mode)

    • 修改 vite.config.ts,配置了 build.lib 选项,指定 src/index.ts 为入口。
    • 配置了 rollupOptionsvue, pinia, element-plus 等作为外部依赖(External),避免打包进库文件中,减小体积。
    • 集成了 vite-plugin-dts,自动生成 TypeScript 类型声明文件 (.d.ts)。
  2. 入口文件封装

    • 创建 src/index.ts,统一导出了核心组件 (DashboardContainer)、状态管理 (useDashboardStore)、类型定义及 i18n 实例。
    • 提供了默认的 Vue 插件安装方法 (install),支持通过 app.use(CustomDashboard) 快速注册。
  3. NPM 发布配置

    • 更新 package.json
      • 设置 main (UMD), module (ESM), types (DTS) 字段。
      • 将核心依赖移动至 peerDependencies,确保宿主环境版本一致性。
      • 配置 files 字段,仅发布 dist 目录。
  4. 环境验证

    • 构建验证npm run build 成功生成 dist/ 目录,包含 ES Module 和 UMD 格式产物及类型文件。
    • 开发验证npm run dev 运行正常(端口 5174),本地演示环境可正常加载仪表盘组件。

🚀 如何使用

1. 本地开发与调试

npm run dev

启动本地服务器,通过 src/main.ts 入口调试组件功能。

2. 构建发布

npm run build
npm publish

构建产物将输出到 dist/ 目录,随后即可发布到 NPM 仓库。

3. 在其他项目中使用 安装包后:

import { createApp } from 'vue';
import CustomDashboard from 'custom-dashboard-vue';
import 'custom-dashboard-vue/dist/custom-dashboard-vue.css'; // 引入样式

const app = createApp(App);
app.use(CustomDashboard); // 全局注册组件

现在项目已准备就绪,您可以随时进行发布或继续添加更多部件。

🔄 变更详情

  1. 更新入口文件 (src/index.ts)

    • 新增导出了 DashboardEditor 组件。
    • 在默认插件安装 (install) 方法中注册了全局组件 <DashboardEditor>
  2. 调整构建配置 (vite.config.ts)

    • 修改了 vite-plugin-dts 的配置,从排除列表 (exclude) 中移除了 src/views/DashboardEditor.vue,确保为其生成 TypeScript 类型声明文件。

📦 验证结果

执行 npm run build 构建成功,无错误。 现在,使用该库的项目可以通过以下方式引入编辑器组件:

import { DashboardEditor } from 'custom-dashboard-vue';

// 或者在模板中直接使用(如果使用了 app.use 安装插件)
// <DashboardEditor />

请注意,DashboardEditor 组件依赖于 dashboardStore 中的状态,使用前请确保 Pinia Store 已正确初始化。

常见问题 element-plus部分组件需要手动引入,否则会报错 alt text