Skip to content

Commit 43dbdc9

Browse files
authored
Copy updated umijs example from vercel/vercel (#1045)
### Description Copying the update over from vercel/vercel#12868. ### Demo URL https://vercel.com/austin-merricks-projects/umijs/B7cFNqhyxAy5omTFHerXNw97bj1L ### Type of Change - [ ] New Example - [X] Example updates (Bug fixes, new features, etc.) - [ ] Other (changes to the codebase, but not to examples) ### New Example Checklist - [ ] 🛫 `npm run new-example` was used to create the example - [ ] 📚 The template wasn't used but I carefuly read the [Adding a new example](https://github.com/vercel/examples#adding-a-new-example) steps and implemented them in the example - [ ] 📱 Is it responsive? Are mobile and tablets considered?
1 parent cc41987 commit 43dbdc9

21 files changed

+68
-17260
lines changed

framework-boilerplates/umijs/.editorconfig

-16
This file was deleted.

framework-boilerplates/umijs/.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
registry=https://registry.npmjs.com/
2+

framework-boilerplates/umijs/.prettierignore

-7
This file was deleted.

framework-boilerplates/umijs/.prettierrc

-11
This file was deleted.
+7-23
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
1-
import { IConfig } from 'umi-types';
1+
import { defineConfig } from "umi";
22

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-
],
3+
export default defineConfig({
4+
routes: [
5+
{ path: "/", component: "index" },
6+
{ path: "/docs", component: "docs" },
227
],
23-
};
24-
25-
export default config;
8+
npmClient: 'npm',
9+
});

framework-boilerplates/umijs/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ This directory is a brief example of a [UmiJS](https://umijs.org/) app that can
88

99
Deploy your own UmiJS project with Vercel.
1010

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)
11+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/vercel/tree/main/examples/umijs&template=umijs)
1212

1313
_Live Example: https://umijs-template.vercel.app_
1414

1515
### How We Created This Example
1616

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:
17+
To get started with UmiJS deployed with Vercel, you can use the [Umi CLI](https://umijs.org/docs/guides/getting-started) to initialize the project:
1818

1919
```shell
20-
$ yarn create umi app-name
20+
$ npm create-umi@latest
2121
```

framework-boilerplates/umijs/mock/.gitkeep

Whitespace-only changes.
+8-41
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,18 @@
11
{
22
"private": true,
33
"scripts": {
4-
"start": "umi dev",
5-
"dev": "umi dev --port $PORT",
4+
"dev": "umi dev",
65
"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"
6+
"postinstall": "umi setup",
7+
"setup": "umi setup",
8+
"start": "npm run dev"
119
},
1210
"dependencies": {
13-
"react": "^16.8.6",
14-
"react-dom": "^16.8.6"
11+
"umi": "^4.4.4"
1512
},
1613
"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"
14+
"@types/react": "^18.0.33",
15+
"@types/react-dom": "^18.0.11",
16+
"typescript": "^5.0.3"
5017
}
5118
}

framework-boilerplates/umijs/src/global.css

-8
This file was deleted.

framework-boilerplates/umijs/src/layouts/__tests__/index.test.tsx

-16
This file was deleted.

framework-boilerplates/umijs/src/layouts/index.css

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.navs {
2+
ul {
3+
padding: 0;
4+
list-style: none;
5+
display: flex;
6+
}
7+
li {
8+
margin-right: 1em;
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
import React from 'react';
2-
import styles from './index.css';
1+
import { Link, Outlet } from 'umi';
2+
import styles from './index.less';
33

4-
const BasicLayout: React.FC = props => {
4+
export default function Layout() {
55
return (
6-
<div className={styles.normal}>
7-
<h1 className={styles.title}>Yay! Welcome to umi!</h1>
8-
{props.children}
6+
<div className={styles.navs}>
7+
<ul>
8+
<li>
9+
<Link to="/">Home</Link>
10+
</li>
11+
<li>
12+
<Link to="/docs">Docs</Link>
13+
</li>
14+
<li>
15+
<a href="https://github.com/umijs/umi">Github</a>
16+
</li>
17+
</ul>
18+
<Outlet />
919
</div>
1020
);
11-
};
12-
13-
export default BasicLayout;
21+
}

framework-boilerplates/umijs/src/pages/__tests__/index.test.tsx

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const DocsPage = () => {
2+
return (
3+
<div>
4+
<p>This is umi docs.</p>
5+
</div>
6+
);
7+
};
8+
9+
export default DocsPage;

framework-boilerplates/umijs/src/pages/index.css

-23
This file was deleted.

framework-boilerplates/umijs/src/pages/index.tsx

100755100644
+10-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
import React from 'react';
2-
import styles from './index.css';
1+
import yayJpg from '../assets/yay.jpg';
32

4-
5-
export default function() {
3+
export default function HomePage() {
64
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>
5+
<div>
6+
<h2>Yay! Welcome to umi!</h2>
7+
<p>
8+
<img src={yayJpg} width="388" />
9+
</p>
10+
<p>
11+
To get started, edit <code>pages/index.tsx</code> and save to reload.
12+
</p>
1713
</div>
1814
);
1915
}
+1-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
11
{
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-
}
2+
"extends": "./src/.umi/tsconfig.json"
173
}

framework-boilerplates/umijs/tslint.yml

-11
This file was deleted.
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
declare module '*.css';
2-
declare module '*.png';
1+
import 'umi/typings';

0 commit comments

Comments
 (0)