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

liangxinwei_roadhog

v1.0.31

Published

Cli tool for serve and build react app, based on roadhog, support JSON pattern config.

Downloads

47

Readme

liangxinwei_roadhog

基于作者 sorryccroadhog 的 1.3.* 的扩展,仅适用于我们自己的项目

安装

$ npm i liangxinwei_roadhog --save-dev

使用

roadhog

配置文件如下:

{
  "entry": "src/index.js",
  "extraBabelPlugins": [
    "transform-runtime",
    "transform-decorators-legacy",
    "transform-class-properties",
    ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": true }]
  ],
  "env": {
    "development": {
      "extraBabelPlugins": [
        "dva-hmr"
      ]
    }
  },
  "useDll": false,
  "dllPlugin": {
    "exclude": [
      "antd",
      "babel-runtime"
    ]
  },
  "compress": {
    "drop_console": true
  },
  "externals": {
    "@antv/data-set": "DataSet",
    "moment": "moment"
  },
  "ignoreMomentLocale": true,
  "theme": "./src/theme.js",
  "hash": true
}

我们项目中用到了 @antv/data-set、moment 等一些大的 js 库,所以把它们都配置到 externals,将 @antv/data-set、moment 配置到 root/public/js 下,如果有引入顺序的需求,请给文件名设置数字前缀。

在项目的 index.ejs 下引入 css 和 js 文件:

<head>
  <% var stylesheets = htmlWebpackPlugin.options.stylesheets || [] %>
  <% for(var i = 0; i < stylesheets.length; i++) { %>
  <link rel="stylesheet" href="<%= stylesheets[i] %>">
  <% } %>
</head>
<body>
  <% var scripts = htmlWebpackPlugin.options.scripts || [] %>
  <% for(var i = 0; i < scripts.length; i++) { %>
  <script type="text/javascript" src="<%= scripts[i] %>"></script>
  <% } %>
</body>

roadhog 作者约定 public 目录下的文件会在 server 和 build 时被自动 copy 到输出目录(默认是 ./dist)下,所以可以在这里存放 favicon, iconfont, html, html 里引用的图片等。htmlWebpackPlugin.options.stylesheets 和 htmlWebpackPlugin.options.scripts 是 roadhog 约定的 root/public/ 下存放 js 和 css 的文件夹下所有后缀名为 js 和 css 的文件列表,会自动挂载到 htmlWebpackPlugin 下,直接在 index.ejs 引入就行。

例如:

├── public                        静态资源目录,会直接复制到 dist 目录下,使用时需要绝对路径引入
|   ├── js                        js 文件
|   |   |── 0_moment.min.js
|   |   └── 1_data-set.min.js
|   ├── stylesheets               css 文件
|   |   └── test.css

LICENSE

MIT