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

@haizhi.dev/atom-cli

v0.1.3

Published

打包发布react组件system模块

Readme


title: React 自定义组件开发

React 自定义组件开发

  • atom-cli 自定义脚手架

    • 开发目的

      将传统React应用(atom)开发方式通过ClI的方式二次封装,目的主要是为了方便开发和实施人员在做自定义组件开发的时候固定流程的便捷
    • 实现原理

      通过NodeJscommander工具,提取出组件应用webpack的 开发环境(development)和 生产环境(production) 的配置,发布到私有仓库后,组件应用就可以通过
      yarn add @haizhi.dev/atom-cli
      直接安装脚手架工具,配置组件应用scripts:
        "scripts": {
            "start": "haizhi start",
            "build": "haizhi build",
        },
      开发的时候就可以直接使用了,webpack拓展可以使用webpack-merge实现拓展
    • 使用方式

      • 全局安装 @delivery/atom-cli
      yarn add @haizhi.dev/atom-cli
      • 命令 create
        haizhi create 
        相当于拉取atom仓库,到项目 然后需要进到目录里面执行yarn 下载依赖,最后使用 yarn start 或者 haizhi start 都可以开启组件应用服务
      • 命令 start
        haizhi start
        脚手架自动集成了原本react应用的webpack配置,并且根据数派项目的自定义组件方案,调整了开发环境的打包模式,通过systemJs的方式打包,并且自动将公共依赖提取出来 webpackSystem
      • 命令 build
        haizhi build
        用于编译组件,将compnents中的组件全部打包出来,放进template目录下,默认一个组件对应一个js,组件名就是文件名。
        • 参数:
          • .option("-a, --analyze", "生成分析报告 默认为 false")
          • .option("-c, --config ", "指定config配置文件")
          • .option("-ps, --progress", "显示进度 默认为 true")
      • 命令 publish
        haizhi publish -c ./dist/template/Button.js
        用于发布组件,用于将已经编译的组件上传发布到服务器,这样在数派后台应用组件管理菜单可以直接看到组件,默认组件名和模块名是文件名如上就是 Button
        • 参数:
          • .option("-c, --componentPath ","需要上传文件的路径,必须填写,每次上传一个组件")
          • .option("-n, --componentName ", "组件名称,没有默认取文件名")
          • .option("-m, --moduleName ", "模块名称,没有默认取文件名")
  • atom 组件应用

    • 开发目的

      统一管理自定义React组件,结合cli的打包方案,可以快速生成应用,并且上传到数派应用组件管理功能内
    • 公共依赖

      antd react react-dom
    • 例子

      atome 使用react+typescrip的方式开发,正常使用引入antd组件,在组件打包之后,会把对应的依赖分离出来,如果安装了其他的依赖,会根据system模块化打包方案,将第三方依赖打包进去
    • 打包后的文件

      build
    • 上传至组件仓库

      之后根据脚手架工具上传组件即可,当然也可以直接通过数派后台客户端,手动上传js文件,这里只需要选择react组件就可以上传 spbuild