Giter Site home page Giter Site logo

plutarch's Introduction

plutarch

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

快速上手

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

## 获取版本
$ plutarch -v
3.1.3

## 创建项目
$ plutarch init # 创建 dva 项目
$ plutarch init -t redux # 创建 redux 项目
$ plutarch init -t mobx # 创建 mobx 项目

## 本地开发
$ plutarch server

## 打包
$ plutarch build

## storybook
$ plutarch story

配置

webpackrc-cfg

配置文件

  • .plutarch/dev.config.js 本地调试环境配置文件。
  • .plutarch/pre.config.js 预发环境配置文件。
  • .plutarch/prod.config.js 生产环境配置文件。

数据模拟

通过 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");
};

plutarch's People

Contributors

schifred avatar

Stargazers

zzyo avatar kinghoo avatar  avatar ZhiHang Li avatar Joe_Sky avatar  avatar

Watchers

 avatar  avatar  avatar

plutarch's Issues

webpackrc-cfg 模块解析错误

错误描述

执行

## 1.安装
npm i -g plutarch

## 2.运行
plutarch serve

在执行plutarch serve出现一下错误:

These dependencies were not found:
...
@@babel/runtime-corejs2
...

useBuiltIns 报错

WARNING: We noticed you're using the useBuiltIns option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the corejs option.

You should also be sure that the version you pass to the corejs option matches the version specified in your package.json's dependencies section. If it doesn't, you need to run one of the following commands:

npm install --save core-js@2 npm install --save core-js@3
yarn add core-js@2 yarn add core-js@3

完善 template

  • 支持页面的按需加载
  • jsconfig.json 添加 webpack alias的目录解析配置
{
    "compilerOptions": {
        "experimentalDecorators": true,
        "baseUrl": ".",
        "paths": {

            "components/*": [
                "./src/components/*"
            ]        }
    }
}
  • 如何开启 css-modules(同如何配置webpackrc-cfg 一类问题),考虑内置其他css-in-js方案
  • 添加 .editorconfig
  • 添加 stylelint
  • 添加 huskycommitlint
  • 更新 react/react-dom 版本

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.