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

vue-snippet-gen

v0.0.31

Published

解析 Vue 组件库,生成项目 snippet

Downloads

3

Readme

vue-snippet-gen

demo 地址

安装

推荐以 NPX 方式调用。

npm install vue-snippet-gen --save-dev

配置

  1. 需在 package.json 中配置。见 demo

使用

--filter

  1. 配合 vue-ui-kit-helper ,尽可能还原 helper 插件的自动补全体验。
  2. 项目 snippet 仅显示文件中标注 @show 的 prop/event,默认隐藏 slot。
npx vue-snippet-gen --conf --filter

产物

  1. .code-snippet 文件,负责控制初始标签的显示;
  2. .json 文件,负责为 vue-ui-kit-helper 提供自动补全的数据源。

效果

演示-vue-ui-kit-helper.gif

--conf

  1. 生成带备注的项目 snippet;
  2. 支持在 vue / javascript 文件中使用。
npx vue-snippet-gen --conf

效果

演示-vue-snippet-gen-conf.gif

JSDocs 标记支持

  1. description - 不带标注的备注;
  2. @enum - 默认值列表;
  3. @default - 修改默认值;
  4. @show - 在 --filter 模式下,显示指定的属性、方法;
  5. @ignore - 忽略该 prop / method / slot 的解析。--conf / --filter,均不可见。

默认值优先级

@enum > @default > 文件明文 default

标记演示.png

注意点

  1. A 项目引入了 element-ui,这个组件库使用了 element 作为 alias,但他是给 webpack 使用的,node.js 是不识别这个别名;

可能会出现这样的报错:

报错案例.png

vue-snippet-gen 引入了 module-alias 来解决这个问题;

需要在 A 项目的 package.json 中配置:

{
  "_moduleAliases": {
    "element-demo": "./node_modules/element-test-demo"
  }
}