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

xm-cli

v0.1.3

Published

The xm command line utility base on xm-cli.

Downloads

3

Readme

xm-cli

xm rebuild CLI for dva .

Getting Started

Install, create and start.

# Install
$ npm install -g git://git.coding.net/canisminor1990/xm-cli.git

# Create app
$ xm new myapp

# Start app
$ cd myapp
$ yarn start

Commands

xm-cli have 3 commands: new, init and generate(alias g).

xm new [options]

Create app with new directory.

Usage Examples

$ xm new myapp
$ xm new myapp --demo
$ xm new myapp --no-install

options

  • --no-install -- Disable yarn install after files created

xm init [options]

Create app in current directory. It's options is the same as xm new.

xm generate (short-cut alias: "g")

Generate route, model and component.

Usage Examples

$ xm g route Example      # alias: xm g r
$ xm g model Example      # alias: xm g m
$ xm g component Example  # alias: xm g c
$ xm g layout Example     # alias: xm g l

Generated File Tree

├── src                    # Source directory
    ├── assets             # Store images, icons, ...
    ├── components         # UI components
        ├── Example        # Components Name
            ├── index.js   # 
            └── index.css  # 
        └── index.js       # Components pack
    ├── layouts            # Layout components
        ├── Example        # Layout Name
            ├── index.js   # 
            └── index.css  # 
        └── index.js       # Layout Pack
    ├── router             # Router components
        ├── router         # Router Name
            ├── index.js   # 
            └── index.css  # 
    ├── router.js          # Router configuration
    ├── index.js           # Enry file
    ├── index.css          # 
    ├── index.html         # 
    ├── models             # Dva models
    ├── services           # Used for communicate with server
    └── utils              # Utils
        └── request.js     # A util wrapped dva/fetch
├── .editorconfig          #
├── .eslintrc              # Eslint config
├── .stylelintrc           # Stylelint config
├── .gitignore             #
├── .roadhogrc.js          # Roadhog config
└── package.json           #

Configuration

xm-cli use roadhog for build and server, view roadhog#Configuration (中文版) for details.

Changelog

xm-cli 对比 dva-cli 增加了几个概念:

组件库概念

dva-cli 中实现了添加一个路由 routerComponents 可以自动注册到 router.js 由此延伸在 xm-cli 中:

$ xm g c Test # 生成一个Test组件
  • 这个组件会自动注册到 components/index.js
  • 然后调用只需要 import { Test,Button,Header,... } from '../components'

Layout概念

此概念源于swig等模板引擎

$ xm g l Test # 生成一个Test布局
# 这个布局也会自动注册到 `layouts/index.js` 中
  • Layout 为 Component 和 RouterComponent 的中间层
  • Layout 由多个页面常用 Component 组成, 相当于一个页面布局模板,

虽然此概念可以被 Component , RouterComponent 任一实现, 但单独抽离出来感觉逻辑比较清晰(待验证)

PostCSS

  • PostCSS 编译速度和扩展能力大大超越SCSS
  • 通过一个 precss 插件就能完全兼容和编译SCSS语法
$ gulp      # 可实现: 实时自动Lint, 修正和键值排序

样式隔离

  • 生成页面时候会自动生成该页面唯一的父级Class
  • 如组件 Test 中会生成 xm-component-test
  • 在父级Class中的改动不会影响全局样式

TODO

XMUI组件库对阿里Antd组件库的二次封装

  • 放弃修改源码的方案,因为发现阿里组件库更新速度非常快
  • 而且阿里的组件库基于less和xmui现有组件库不合
  • 因此选择保留源码, 二次封装