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

james-ui

v0.0.11

Published

组件库

Downloads

13

Readme

/* 打包命令: "lib": "vue-cli-service build --target lib --name james --dest lib packages/index.js" target: 默认为构建应用,改为 lib 即可启用构建库模式 name: 输出文件名 exports["james"] dest: 输出目录,默认为 dist,这里我们改为 lib entry: 入口文件路径,默认为 src/App.vue,这里改为 packages/index.js

vue-cli-service build [options] [entry|pattern]
    选项:
        --mode        指定环境模式 (默认值:production)
        --dest        指定输出目录 (默认值:dist)
        --modern      面向现代浏览器带自动回退地构建应用
        --target      app | lib | wc | wc-async (默认值:app)
        --name        库或 Web Components 模式下的名字 (默认值:package.json 中的 "name" 字段或入口文件名)
        --no-clean    在构建项目之前不清除目标目录
        --report      生成 report.html 以帮助分析包内容
        --report-json 生成 report.json 以帮助分析包内容
        --watch       监听文件变化

*/

examples文件里面是测试文件,不用发布到npm组件里面

本地测试: npm run serve

打包: 把packages里面的内容全部打包 npm run lib

发布: .npmignore文件是npm上传忽略文件列表 npm run login npm run pub

最终上传到npm组件库的内容是: lib: 放置的是所有组件打包之后的内容 packages: 放置的是单个包

使用方式: 1. 安装包
cnpm i -D james-ui

2. 配置
    main.js中
        全局引入组件
            import JamesUi from 'james-ui';
            Vue.use(JamesUi);
        引入单个组件
            import { JamesLink, JamesColor } from 'james-ui';
            Vue.use(JamesLink);
            Vue.use(JamesColor);

使用的时候注意使用 my-plugin-import: 1. 默认导入( 全部导入 ) 加载lib里面的文件 2. 导入列表 加载packages里面的文件

实现全部加载: 
    import JamesUi from 'james-ui';

    转化成: 

    import JamesUi from '../node_module/james-ui/lib/james.umd.min.js';

实现按需加载: 
    import { JamesColor, JamesLink } from 'james-ui';

    转化成: 

    import JamesColor from '../node_module/james-ui/packages/components/JamesColor/index.js';
    import JamesLink from '../node_module/james-ui/packages/components/JamesLink/index.js';

最终实现的效果:按需加载,没有引入的组件,不会打包进去; 全部加载,所有组件全部打包进去