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

@etmpro/etm-pc-component-lib

v2.4.43

Published

<h1 style="background-color: red; color: white; font-size: 24px; padding: 10px;text-align:center">ETM组件开发文档</h1>

Downloads

15

Readme

目录说明


|-- README.md
|-- babel.config.js           
|-- lib                                组件库打包编译后的文件                     
|        
|       
|-- packages                           组件库源文件
|   |-- EtmButton                      EtmButton组件文件夹
|   |   |-- index.js                   EtmButton入口文件导入导出
|   |    `-- src           
|   |        `-- EtmButton.vue         EtmButton组件源码
|   |       
|   `-- index.js                       组件库整体导入导出
|
|
|-- styles                             组件库样式表
|   |-- index.scss                     样式统一入口
|   |-- element.scss
|   |-- global.scss
|   |-- icon.scss
|   |-- layout.scss
|   |-- mixin.scss
|   |-- popover.scss
|   |-- rev-theme.scss
|   |-- rev-var.scss
|   |-- sidebar.scss
|   |-- theme.scss
|   |-- transition.scss
|   `-- variables.scss
|
|-- src                                组件库游乐场
|   |-- App.vue                        游乐场首页
|   |-- main.js                        游乐场入口
|-- package.json    
|-- vue.config.js
`-- yarn.lock

开发说明

内部组件统一以EtmXXX命名

下面以EtmButton组件作为示例

  1. packages里新建EtmButton文件夹, 用来开发EtmButton组件
  2. EtmButton文件夹里新建src文件夹,用于存放源码, 在src里建立EtmButton.vue源代码文件, 代码如下:

<template>
  <button v-bind="$attrs" v-on="$listeners">
    <slot>default-text</slot>
  </button>
</template>

<script>
export default {
  name: 'EtmButton', // 重要! 必填 && 唯一
}
</script>
  1. EtmButton文件夹里新建index.js, 用于导出EtmButton组件, 代码如下:
import EtmButton from './src/EtmButton'

EtmButton.install = function(Vue) {
  Vue.component(EtmButton.name, EtmButton)
}

export default EtmButton
  1. 在packages里新建index.js, 用于导出整个组件库, 代码如下:

如果文件已存在只需要在里面添加对应的组件即可!

import EtmButton from './EtmButton'

// 导入你的组件

const components = [
  EtmButton, 
 //...注册你的组件
]

const install = function(Vue) {
  components.forEach(component => {
    Vue.component(component.name, component)
  })
}

if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue)
}

export default {
  install, EtmButton,
  //...导出你的组件
}

预览

  • 配置packages组件库进行编译(已配置)
  • main.js中引入组件库并use(已配置)
  • npm run serve启动游乐场(已配置)
  • 在App.vue中使用你的组件(已配置示例)

打包

  • 使用npm run lib进行组件库编译打包
  • 代码提交到仓库 git add . && git commit
  • 发布组件
    • 切换npm源为内网服务器 npx cgr use etm
    • 登录到服务器 npm login, 输入用户名/密码/邮箱后进行下一步操作
    • 小版本更新 0.0.x 直接执行npm run pub进行发布
    • 大版本更新 x.x.0 手动更改package.json中的版本号(大版本更新前务必通知组内成员)