Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refact/migrate to umi #770

Merged
merged 9 commits into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"presets": [
"umi/babel"
],
"plugins": [
[
"babel-plugin-module-resolver",
{
"alias": {
"components": "./src/components",
"utils": "./src/utils",
"config": "./src/utils/config",
"enums": "./src/utils/enums",
"services": "./src/services",
"models": "./src/models",
"routes": "./src/routes"
}
}
]
]
}
16 changes: 2 additions & 14 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "airbnb",
"extends": "umi",
"rules": {
"arrow-body-style": [0, "never"],
"comma-dangle": [2, "always-multiline"],
Expand Down Expand Up @@ -44,17 +44,5 @@
"react/no-danger": 0,
"react/jsx-first-prop-new-line": 0,
"react/jsx-filename-extension": 0
},
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8,
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
}
},
"settings": {
"import/resolver": "node"
}
}
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ dist
node_modules
yarn.lock
npm-debug.log

# ide
.idea

# Mac General
.DS_Store
.AppleDouble
.LSOverride

# umi
.umi
.umi-production
57 changes: 0 additions & 57 deletions .roadhogrc.js

This file was deleted.

5 changes: 0 additions & 5 deletions .roadhogrc.mock.js

This file was deleted.

26 changes: 26 additions & 0 deletions .umirc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

export default {
plugins: [
'umi-plugin-dva',
[
'umi-plugin-routes',
{
exclude: [
/model\.(j|t)sx?$/,
/service\.(j|t)sx?$/,
/models\//,
/components\//,
/services\//,
/chart\/Container\.js$/,
],
},
],
[
'umi-plugin-dll',
{
exclude: [],
include: ["dva", "dva/router", "dva/saga", "dva/fetch", "antd/es"],
},
],
],
}
8 changes: 8 additions & 0 deletions .umirc.mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

export default {
...require('./mock/common'),
...require('./mock/dashboard'),
...require('./mock/menu'),
...require('./mock/post'),
...require('./mock/user'),
}
24 changes: 24 additions & 0 deletions .webpackrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { resolve } from 'path';

export default {
theme: "./theme.config.js",
// 接口代理示例
proxy: {
"/api/v1/weather": {
"target": "https://api.seniverse.com/",
"changeOrigin": true,
"pathRewrite": { "^/api/v1/weather": "/v3/weather" }
},
// "/api/v2": {
// "target": "http://192.168.0.110",
// "changeOrigin": true,
// "pathRewrite": { "^/api/v2" : "/api/v2" }
// }
},
alias: {
themes: resolve(__dirname, './src/themes'),
},
urlLoaderExcludes: [
/\.svg$/,
],
}
2 changes: 1 addition & 1 deletion src/mock/common.js → mock/common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Mock = require('mockjs')
const config = require('../utils/config')
const config = require('../src/utils/config')

const queryArray = (array, key, keyAlias = 'key') => {
if (!(array instanceof Array)) {
Expand Down
4 changes: 2 additions & 2 deletions src/mock/dashboard.js → mock/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { color } from '../utils/theme'
import { color } from '../src/utils/theme'

const Mock = require('mockjs')
const config = require('../utils/config')
const config = require('../src/utils/config')

const { apiPrefix } = config

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/mock/user.js → mock/user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const qs = require('qs')
const Mock = require('mockjs')
const config = require('../utils/config')
const config = require('../src/utils/config')

const { apiPrefix } = config

Expand Down
54 changes: 21 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,60 @@
"name": "antd-admin",
"version": "4.3.9",
"dependencies": {
"antd": "3.2.2",
"@babel/polyfill": "^7.0.0-beta.42",
"axios": "^0.17.1",
"babel-polyfill": "^6.23.0",
"classnames": "^2.2.5",
"d3-shape": "^1.2.0",
"draftjs-to-markdown": "^0.5.0",
"dva": "2.1.0",
"dva-loading": "^1.0.4",
"dva-model-extend": "^0.1.1",
"echarts": "^4.0.0",
"echarts-for-react": "^2.0.0",
"echarts-gl": "^1.0.0-beta.5",
"echarts-liquidfill": "^1.1.0",
"ejs-loader": "^0.3.0",
"highcharts-exporting": "^0.1.2",
"highcharts-more": "^0.1.2",
"history": "^4.7.2",
"js-beautify": "^1.6.14",
"jsonp": "^0.2.1",
"less-vars-to-js": "^1.1.2",
"lodash": "^4.17.4",
"mockjs": "^1.0.1-beta3",
"nprogress": "^0.2.0",
"path-to-regexp": "^2.1.0",
"prop-types": "^15.5.10",
"qs": "^6.5.0",
"query-string": "^5.0.0",
"query-string": "^5.1.1",
"rc-tween-one": "^1.3.1",
"react": "^16.2.0",
"react-adsense": "^0.0.5",
"react-countup": "^3.0.2",
"react-dom": "^16.2.0",
"react-draft-wysiwyg": "^1.10.0",
"react-helmet": "^5.1.3",
"react-highcharts": "^15.0.0",
"recharts": "^1.0.0-beta.0"
},
"devDependencies": {
"babel-eslint": "^8.1.0",
"babel-plugin-dev-expression": "^0.2.1",
"babel-plugin-dva-hmr": "^0.4.0",
"babel-plugin-import": "^1.1.1",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-runtime": "^6.9.2",
"copy-webpack-plugin": "^4.0.1",
"babel-plugin-module-resolver": "^3.1.0",
"cross-env": "^5.0.5",
"draftjs-to-html": "^0.8.1",
"dva-model-extend": "^0.1.1",
"eslint": "^4.1.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-import-resolver-node": "^0.3.1",
"eslint-loader": "^1.9.0",
"eslint-plugin-import": "^2.6.1",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.1.0",
"html-webpack-plugin": "^2.29.0",
"redbox-react": "^1.2.10",
"roadhog": "1.3.1"
"eslint": "^4.19.1",
"eslint-config-umi": "^0.1.4",
"eslint-plugin-flowtype": "^2.46.1",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.7.0",
"less-vars-to-js": "^1.1.2",
"mockjs": "^1.0.1-beta3",
"svg-sprite-loader": "^3.7.3",
"umi": "^1.1.2",
"umi-plugin-dll": "^0.1.0",
"umi-plugin-dva": "^0.4.0",
"umi-plugin-routes": "^0.1.2"
},
"pre-commit": [
"lint"
],
"scripts": {
"dev": "cross-env BROWSER=none HOST=0.0.0.0 roadhog server",
"start": "roadhog buildDll && cross-env BROWSER=none HOST=0.0.0.0 roadhog server",
"start": "cross-env BABELRC=1 BROWSER=none HOST=0.0.0.0 umi dev",
"lint": "eslint --fix --ext .js src",
"build": "roadhog build",
"build:dll": "roadhog buildDll",
"build:new": "node version && roadhog build"
"build": "cross-env BABELRC=1 umi build",
"test": "umi test"
}
}
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
Loading