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

@wont/cli

v0.0.1-rc.1

Published

cli for react and vue

Downloads

11

Readme

特别说明

由于mock使用了Macaca DataHub,必须使用node12.x下载

nvm use 12

Feature

  • 支持mock功能(集成Macaca DataHub
  • 支持splitChunk,分基础包和业务包
  • 支持使用node环境变量,根目录下.env.(production | development)文件配置环境即可,在项目中使用process.env.xxx
  • 支持react 单页面(spa)、多页面(mpa)开发
  • 支持externals免打包,通过script [BootCDN链入] (https://www.bootcdn.cn/)
  • 支持css module,支持less。(推荐)
  • 支持手机适配,初始化项目选择Mobile即可
import style from './index.module.(less|css)'
import React from 'react'

const About = () => (
    // 会自动将连字符转换为驼峰 main-container => mainContainer
    <div className={style.mainContainer}>
        this is About page
    </div>
)
.main-container {
    border: 1px solid red;
}
  • 支持typescript
  • 支持热更新
  • 使用thread-loader、cache-loader、hard-source-webpack-plugin,打包速度up!
  • 本地8080端口被占用,则自动开启8080+
  • dev环境使用完整source-map,便于debugger,prod则不使用source-map

Usage

Install

全局安装

npm i @wont/cli@latest -g

初始化项目

  • 执行init后,根据cli提示输入项目名称,cli会自动生成对应项目,并装好相关依赖
wont-cli init
  • React、spa单页面、使用externals生成目录结构如下
├── .browserslistrc # postcss autofixer
├── .env.development # 环境变量,可在项目中 process.env.XXX
├── .env.production
├── .gitignore
├── dist # 构建产物
│   ├── chunk-vendors.js # 分包处理-基础包,react、react-dom、react-router-dom
│   ├── index.html
│   ├── index.js # 业务包
│   └── index_6a7ccc98.css
├── package-lock.json
├── package.json
├── postcss.config.js
├── public
│   └── index.html
├── mock # mock本地数据
├── src
│   ├── components
│   │   └── button
│   │       └── index.tsx
│   ├── declare.d.ts
│   ├── main.less
│   ├── main.tsx
│   ├── pages
│   │   ├── about
│   │   │   └── index.tsx
│   │   └── home
│   │       └── index.tsx
│   ├── router # 路由配置,支持后台管理layout类型
│   │   └── index.tsx
│   └── styles # 全局样式
│       └── normalize.less
└── wont.config.js
  • React、mpa单页面、使用externals生成目录结构如下
├── dist # build产物
│   ├── index.html
│   ├── index.js
│   └── index_0905e159.css
├── package-lock.json
├── package.json # 已在script上添加dev和build
├── postcss.config.js # 可在基础上添加postcss功能
├── public
│   └── index.html
├── mock # mock本地数据
├── src
│   └── pages
│       └── index
│           ├── index.less
│           └── index.tsx
└── wont.config.js # 配置文件
  • wont.config.js,相关配置均在此处,可更改选项,重新devbuild即可 目前支持配置如下
module.exports = {
    "framework": "React", // 必选 React-默认 Vue-暂未支持
    "externals": true, // 是否启用script cdn接入 默认-true,react、react-dom将自动cdn引入
    "mode": "spa", // 必选,spa-单页面(默认) mpa-多页面
    mock: {
        port: 3000, // 可指定mock端口,默认5678
    }
}

本地开发

wont-cli dev

打包

wont-cli build

LICENSE

MIT