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

plutarch

v3.1.10

Published

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

Downloads

97

Readme

plutarch

基于 webpack4 实现的前端应用开发工具。

快速上手

## 全局或本地安装
$ cnpm i plutarch -g

## 获取版本
$ plutarch -v
3.1.17

## 创建项目
$ plutarch init # 创建项目

## 本地开发
$ plutarch server

## 打包
$ plutarch build
$ plutarch build -p 语法环境打包

## storybook
$ plutarch story

配置

webpack 配置项

| 选项 | 意义 | 默认值 | | --- | --- | --- | | mode | 模式,区分生产环境还是开发环境,可选值为 'production' 或 'development' | 'production' | | template | 模板所在文件夹,默认扫描源目录 | undefined | | entry | 入口文件,默认扫描源目录中的 js|tsx? 文件 | undefined | | output | 出口 | undefined | | publicPath | 设置 output.publicPath | undefined | | resolve | 解析规则 | undefined | | alias | 别名,默认扫描源目录下的文件夹 | undefined | | devtool | sourcemap 生成规则,'development' 默认下默认 'source-map' | undefined | | externals | 外部扩展 | undefined | | target | 构建目标 | undefined | | rules | 额外的加载器 | undefined | | module | 内置加载器选项配置 | undefined | | splitChunksOptions | 公共模块抽取,自动提取到 commons 文件内 | undefined | | compress | 是否压缩 | true | | enableCssModules | 是否开启 css modules | false |

数据模拟

通过 plutarch.mock.js 文件配置模拟数据,在dev server中直接挂载控制器实现。

  1. 函数形式
// plutarch.mock.js
module.exports = function(app){
  app.get("/api/test.json",(req,res)=>{
    res.send("test");
  });
};
  1. 对象形式
// plutarch.mock.js
module.exports = {
  "get /api/test.json": "test"
};
  1. 文件控制器形式
// plutarch.mock.js
module.exports = {
  app.get("/api/test.json","test");
};
// mocks/test.js
module.exports = function(req,res){
  res.send("test");
};