Skip to content

Commit 1a1b2f0

Browse files
authored
copy umijs example from vercel/vercel (#1038)
1 parent cd1f11d commit 1a1b2f0

21 files changed

+17325
-0
lines changed

Diff for: framework-boilerplates/umijs/.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
indent_style = tab

Diff for: framework-boilerplates/umijs/.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/npm-debug.log*
6+
/yarn-error.log
7+
/package-lock.json
8+
9+
# production
10+
/dist
11+
12+
# misc
13+
.DS_Store
14+
15+
# umi
16+
.umi
17+
.umi-production
18+
19+
# environment variables
20+
.env
21+
.env.build
22+
23+
.vercel

Diff for: framework-boilerplates/umijs/.prettierignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/*.md
2+
**/*.svg
3+
**/*.ejs
4+
**/*.html
5+
package.json
6+
.umi
7+
.umi-production

Diff for: framework-boilerplates/umijs/.prettierrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 100,
5+
"overrides": [
6+
{
7+
"files": ".prettierrc",
8+
"options": { "parser": "json" }
9+
}
10+
]
11+
}

Diff for: framework-boilerplates/umijs/.umirc.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { IConfig } from 'umi-types';
2+
3+
// ref: https://umijs.org/config/
4+
const config: IConfig = {
5+
treeShaking: true,
6+
plugins: [
7+
// ref: https://umijs.org/plugin/umi-plugin-react.html
8+
[
9+
'umi-plugin-react',
10+
{
11+
antd: false,
12+
dva: false,
13+
dynamicImport: false,
14+
title: 'umijs',
15+
dll: false,
16+
17+
routes: {
18+
exclude: [/components\//],
19+
},
20+
},
21+
],
22+
],
23+
};
24+
25+
export default config;

Diff for: framework-boilerplates/umijs/.vercelignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
README.md

Diff for: framework-boilerplates/umijs/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
![UmiJS Logo](https://github.com/vercel/vercel/blob/main/packages/frameworks/logos/umi.svg)
2+
3+
# UmiJS Example
4+
5+
This directory is a brief example of a [UmiJS](https://umijs.org/) app that can be deployed to Vercel with zero configuration.
6+
7+
## Deploy Your Own
8+
9+
Deploy your own UmiJS project with Vercel.
10+
11+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/framework-boilerplates/umijs&template=umijs)
12+
13+
_Live Example: https://umijs-template.vercel.app_
14+
15+
### How We Created This Example
16+
17+
To get started with UmiJS deployed with Vercel, you can use the [Umi CLI](https://github.com/umijs/create-umi) to initialize the project:
18+
19+
```shell
20+
$ yarn create umi app-name
21+
```

Diff for: framework-boilerplates/umijs/mock/.gitkeep

Whitespace-only changes.

Diff for: framework-boilerplates/umijs/package.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"start": "umi dev",
5+
"dev": "umi dev --port $PORT",
6+
"build": "umi build",
7+
"test": "umi test",
8+
"lint:es": "eslint --ext .js src mock tests",
9+
"lint:ts": "tslint \"src/**/*.ts\" \"src/**/*.tsx\"",
10+
"precommit": "lint-staged"
11+
},
12+
"dependencies": {
13+
"react": "^16.8.6",
14+
"react-dom": "^16.8.6"
15+
},
16+
"devDependencies": {
17+
"@types/jest": "^23.3.12",
18+
"@types/react": "^16.7.18",
19+
"@types/react-dom": "^16.0.11",
20+
"@types/react-test-renderer": "^16.0.3",
21+
"babel-eslint": "^9.0.0",
22+
"eslint": "^5.4.0",
23+
"eslint-config-umi": "^1.4.0",
24+
"eslint-plugin-flowtype": "^2.50.0",
25+
"eslint-plugin-import": "^2.14.0",
26+
"eslint-plugin-jsx-a11y": "^5.1.1",
27+
"eslint-plugin-react": "^7.11.1",
28+
"husky": "^0.14.3",
29+
"lint-staged": "^7.2.2",
30+
"react-test-renderer": "^16.7.0",
31+
"tslint": "^5.12.0",
32+
"tslint-eslint-rules": "^5.4.0",
33+
"tslint-react": "^3.6.0",
34+
"umi": "^2.7.0",
35+
"umi-plugin-react": "^1.8.0",
36+
"umi-types": "^0.2.0"
37+
},
38+
"lint-staged": {
39+
"*.{ts,tsx}": [
40+
"tslint --fix",
41+
"git add"
42+
],
43+
"*.{js,jsx}": [
44+
"eslint --fix",
45+
"git add"
46+
]
47+
},
48+
"engines": {
49+
"node": "16.x"
50+
}
51+
}

Diff for: framework-boilerplates/umijs/src/assets/yay.jpg

177 KB
Loading

Diff for: framework-boilerplates/umijs/src/global.css

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
html, body, #root {
3+
height: 100%;
4+
}
5+
6+
body {
7+
margin: 0;
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import 'jest';
2+
import BasicLayout from '..';
3+
import React from 'react';
4+
import renderer, { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';
5+
6+
describe('Layout: BasicLayout', () => {
7+
it('Render correctly', () => {
8+
const wrapper: ReactTestRenderer = renderer.create(<BasicLayout />);
9+
expect(wrapper.root.children.length).toBe(1);
10+
const outerLayer = wrapper.root.children[0] as ReactTestInstance;
11+
expect(outerLayer.type).toBe('div');
12+
const title = outerLayer.children[0] as ReactTestInstance;
13+
expect(title.type).toBe('h1');
14+
expect(title.children[0]).toBe('Yay! Welcome to umi!');
15+
});
16+
});

Diff for: framework-boilerplates/umijs/src/layouts/index.css

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
.normal {
3+
font-family: Georgia, sans-serif;
4+
text-align: center;
5+
}
6+
7+
.title {
8+
font-size: 2.5rem;
9+
font-weight: normal;
10+
letter-spacing: -1px;
11+
background: darkslateblue;
12+
padding: .6em 0;
13+
color: white;
14+
margin: 0;
15+
}

Diff for: framework-boilerplates/umijs/src/layouts/index.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import styles from './index.css';
3+
4+
const BasicLayout: React.FC = props => {
5+
return (
6+
<div className={styles.normal}>
7+
<h1 className={styles.title}>Yay! Welcome to umi!</h1>
8+
{props.children}
9+
</div>
10+
);
11+
};
12+
13+
export default BasicLayout;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import 'jest';
2+
import Index from '..';
3+
import React from 'react';
4+
import renderer, { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';
5+
6+
7+
describe('Page: index', () => {
8+
it('Render correctly', () => {
9+
const wrapper: ReactTestRenderer = renderer.create(<Index />);
10+
expect(wrapper.root.children.length).toBe(1);
11+
const outerLayer = wrapper.root.children[0] as ReactTestInstance;
12+
expect(outerLayer.type).toBe('div');
13+
expect(outerLayer.children.length).toBe(2);
14+
15+
});
16+
});

Diff for: framework-boilerplates/umijs/src/pages/index.css

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
.normal {
3+
font-family: Georgia, sans-serif;
4+
margin-top: 4em;
5+
text-align: center;
6+
}
7+
8+
.welcome {
9+
height: 328px;
10+
background: url(../assets/yay.jpg) no-repeat center 0;
11+
background-size: 388px 328px;
12+
}
13+
14+
.list {
15+
font-size: 1.2em;
16+
margin-top: 1.8em;
17+
list-style: none;
18+
line-height: 1.5em;
19+
}
20+
21+
.list code {
22+
background: #f7f7f7;
23+
}

Diff for: framework-boilerplates/umijs/src/pages/index.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import styles from './index.css';
3+
4+
5+
export default function() {
6+
return (
7+
<div className={styles.normal}>
8+
<div className={styles.welcome} />
9+
<ul className={styles.list}>
10+
<li>To get started, edit <code>src/pages/index.js</code> and save to reload.</li>
11+
<li>
12+
<a href="https://umijs.org/guide/getting-started.html">
13+
Getting Started
14+
</a>
15+
</li>
16+
</ul>
17+
</div>
18+
);
19+
}

Diff for: framework-boilerplates/umijs/tsconfig.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"target": "esnext",
4+
"module": "esnext",
5+
"moduleResolution": "node",
6+
"importHelpers": true,
7+
"jsx": "react",
8+
"esModuleInterop": true,
9+
"sourceMap": true,
10+
"baseUrl": ".",
11+
"strict": true,
12+
"paths": {
13+
"@/*": ["src/*"]
14+
},
15+
"allowSyntheticDefaultImports": true
16+
}
17+
}

Diff for: framework-boilerplates/umijs/tslint.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
defaultSeverity: error
2+
extends:
3+
- tslint-react
4+
- tslint-eslint-rules
5+
jsRules:
6+
rules:
7+
eofline: true
8+
no-console: true
9+
no-construct: true
10+
no-debugger: true
11+
no-reference: true

Diff for: framework-boilerplates/umijs/typings.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare module '*.css';
2+
declare module '*.png';

0 commit comments

Comments
 (0)