Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
brickspert committed Aug 28, 2020
1 parent 7cb67a3 commit 9d440fa
Show file tree
Hide file tree
Showing 14 changed files with 215 additions and 0 deletions.
16 changes: 16 additions & 0 deletions layout/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
20 changes: 20 additions & 0 deletions layout/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/npm-debug.log*
/yarn-error.log
/yarn.lock
/package-lock.json

# production
/dist

# misc
.DS_Store

# umi
/src/.umi
/src/.umi-production
/src/.umi-test
/.env.local
8 changes: 8 additions & 0 deletions layout/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**/*.md
**/*.svg
**/*.ejs
**/*.html
package.json
.umi
.umi-production
.umi-test
11 changes: 11 additions & 0 deletions layout/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80,
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
}
38 changes: 38 additions & 0 deletions layout/.umirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { defineConfig } from 'umi';

export default defineConfig({
nodeModulesTransform: {
type: 'none',
},
layout: {},
qiankun: {
master: {
apps: [{
name: 'shop',
entry: 'http://localhost:8001'
}, {
name: 'user',
entry: 'http://localhost:8002'
}]
},
},
routes: [
{
path: '/',
component: '@/layouts/index',
routes: [
{ path: '/', component: '@/pages/index' },
{ path: '/shop', microApp: 'shop' },
{ path: '/user', microApp: 'user' },
]
}
],
proxy: {
'/api/shop': {
target: 'http://localhost:8001',
},
'/api/user': {
target: 'http://localhost:8002',
},
},
});
15 changes: 15 additions & 0 deletions layout/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# umi project

## Getting Started

Install dependencies,

```bash
$ yarn
```

Start the dev server,

```bash
$ yarn start
```
Empty file added layout/mock/.gitkeep
Empty file.
34 changes: 34 additions & 0 deletions layout/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"private": true,
"scripts": {
"start": "PORT=8000 umi dev",
"build": "umi build",
"postinstall": "umi generate tmp",
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
"test": "umi-test",
"test:coverage": "umi-test --coverage"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
"prettier --write"
],
"*.ts?(x)": [
"prettier --parser=typescript --write"
]
},
"dependencies": {
"@ant-design/pro-layout": "^5.0.12",
"@umijs/plugin-qiankun": "^2.10.0",
"@umijs/preset-react": "1.x",
"@umijs/test": "^3.2.17",
"lint-staged": "^10.0.7",
"prettier": "^1.19.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"umi": "^3.2.17",
"yorkie": "^2.0.0"
}
}
12 changes: 12 additions & 0 deletions layout/src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

export const layout = {
title: '商城管理',
menuDataRender: () => ([{
name: '商铺管理',
path: '/shop'
}, {
name: '用户管理',
path: '/user'
}])
}
6 changes: 6 additions & 0 deletions layout/src/layouts/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.contaier {
background: white;
margin: 24px;
padding: 24px;
min-height: calc(100vh - 112px);
}
10 changes: 10 additions & 0 deletions layout/src/layouts/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import styles from './index.less';

export default (props: any) => {
return (
<div className={styles.contaier}>
{props.children}
</div>
);
}
12 changes: 12 additions & 0 deletions layout/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

export default () => {
return (
<div>
<h1>介绍</h1>
<p>
这是一个基于 umi 的微前端实践方案示例,具体教程可见:<a>hello</a>
</p>
</div>
);
}
25 changes: 25 additions & 0 deletions layout/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"jsx": "react",
"esModuleInterop": true,
"sourceMap": true,
"baseUrl": "./",
"strict": true,
"paths": {
"@/*": ["src/*"],
"@@/*": ["src/.umi/*"]
},
"allowSyntheticDefaultImports": true
},
"include": [
"mock/**/*",
"src/**/*",
"config/**/*",
".umirc.ts",
"typings.d.ts"
]
}
8 changes: 8 additions & 0 deletions layout/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare module '*.css';
declare module '*.less';
declare module "*.png";
declare module '*.svg' {
export function ReactComponent(props: React.SVGProps<SVGSVGElement>): React.ReactElement
const url: string
export default url
}

0 comments on commit 9d440fa

Please sign in to comment.