Skip to content

Commit

Permalink
copy umijs example from vercel/vercel (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikareads authored Jan 13, 2025
1 parent cd1f11d commit 1a1b2f0
Show file tree
Hide file tree
Showing 21 changed files with 17,325 additions and 0 deletions.
16 changes: 16 additions & 0 deletions framework-boilerplates/umijs/.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
23 changes: 23 additions & 0 deletions framework-boilerplates/umijs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

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

# production
/dist

# misc
.DS_Store

# umi
.umi
.umi-production

# environment variables
.env
.env.build

.vercel
7 changes: 7 additions & 0 deletions framework-boilerplates/umijs/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/*.md
**/*.svg
**/*.ejs
**/*.html
package.json
.umi
.umi-production
11 changes: 11 additions & 0 deletions framework-boilerplates/umijs/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
}
25 changes: 25 additions & 0 deletions framework-boilerplates/umijs/.umirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { IConfig } from 'umi-types';

// ref: https://umijs.org/config/
const config: IConfig = {
treeShaking: true,
plugins: [
// ref: https://umijs.org/plugin/umi-plugin-react.html
[
'umi-plugin-react',
{
antd: false,
dva: false,
dynamicImport: false,
title: 'umijs',
dll: false,

routes: {
exclude: [/components\//],
},
},
],
],
};

export default config;
1 change: 1 addition & 0 deletions framework-boilerplates/umijs/.vercelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md
21 changes: 21 additions & 0 deletions framework-boilerplates/umijs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
![UmiJS Logo](https://github.com/vercel/vercel/blob/main/packages/frameworks/logos/umi.svg)

# UmiJS Example

This directory is a brief example of a [UmiJS](https://umijs.org/) app that can be deployed to Vercel with zero configuration.

## Deploy Your Own

Deploy your own UmiJS project with Vercel.

[![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)

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

### How We Created This Example

To get started with UmiJS deployed with Vercel, you can use the [Umi CLI](https://github.com/umijs/create-umi) to initialize the project:

```shell
$ yarn create umi app-name
```
Empty file.
51 changes: 51 additions & 0 deletions framework-boilerplates/umijs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"private": true,
"scripts": {
"start": "umi dev",
"dev": "umi dev --port $PORT",
"build": "umi build",
"test": "umi test",
"lint:es": "eslint --ext .js src mock tests",
"lint:ts": "tslint \"src/**/*.ts\" \"src/**/*.tsx\"",
"precommit": "lint-staged"
},
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
"devDependencies": {
"@types/jest": "^23.3.12",
"@types/react": "^16.7.18",
"@types/react-dom": "^16.0.11",
"@types/react-test-renderer": "^16.0.3",
"babel-eslint": "^9.0.0",
"eslint": "^5.4.0",
"eslint-config-umi": "^1.4.0",
"eslint-plugin-flowtype": "^2.50.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.11.1",
"husky": "^0.14.3",
"lint-staged": "^7.2.2",
"react-test-renderer": "^16.7.0",
"tslint": "^5.12.0",
"tslint-eslint-rules": "^5.4.0",
"tslint-react": "^3.6.0",
"umi": "^2.7.0",
"umi-plugin-react": "^1.8.0",
"umi-types": "^0.2.0"
},
"lint-staged": {
"*.{ts,tsx}": [
"tslint --fix",
"git add"
],
"*.{js,jsx}": [
"eslint --fix",
"git add"
]
},
"engines": {
"node": "16.x"
}
}
Binary file added framework-boilerplates/umijs/src/assets/yay.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions framework-boilerplates/umijs/src/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

html, body, #root {
height: 100%;
}

body {
margin: 0;
}
16 changes: 16 additions & 0 deletions framework-boilerplates/umijs/src/layouts/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'jest';
import BasicLayout from '..';
import React from 'react';
import renderer, { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';

describe('Layout: BasicLayout', () => {
it('Render correctly', () => {
const wrapper: ReactTestRenderer = renderer.create(<BasicLayout />);
expect(wrapper.root.children.length).toBe(1);
const outerLayer = wrapper.root.children[0] as ReactTestInstance;
expect(outerLayer.type).toBe('div');
const title = outerLayer.children[0] as ReactTestInstance;
expect(title.type).toBe('h1');
expect(title.children[0]).toBe('Yay! Welcome to umi!');
});
});
15 changes: 15 additions & 0 deletions framework-boilerplates/umijs/src/layouts/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

.normal {
font-family: Georgia, sans-serif;
text-align: center;
}

.title {
font-size: 2.5rem;
font-weight: normal;
letter-spacing: -1px;
background: darkslateblue;
padding: .6em 0;
color: white;
margin: 0;
}
13 changes: 13 additions & 0 deletions framework-boilerplates/umijs/src/layouts/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import styles from './index.css';

const BasicLayout: React.FC = props => {
return (
<div className={styles.normal}>
<h1 className={styles.title}>Yay! Welcome to umi!</h1>
{props.children}
</div>
);
};

export default BasicLayout;
16 changes: 16 additions & 0 deletions framework-boilerplates/umijs/src/pages/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'jest';
import Index from '..';
import React from 'react';
import renderer, { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';


describe('Page: index', () => {
it('Render correctly', () => {
const wrapper: ReactTestRenderer = renderer.create(<Index />);
expect(wrapper.root.children.length).toBe(1);
const outerLayer = wrapper.root.children[0] as ReactTestInstance;
expect(outerLayer.type).toBe('div');
expect(outerLayer.children.length).toBe(2);

});
});
23 changes: 23 additions & 0 deletions framework-boilerplates/umijs/src/pages/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

.normal {
font-family: Georgia, sans-serif;
margin-top: 4em;
text-align: center;
}

.welcome {
height: 328px;
background: url(../assets/yay.jpg) no-repeat center 0;
background-size: 388px 328px;
}

.list {
font-size: 1.2em;
margin-top: 1.8em;
list-style: none;
line-height: 1.5em;
}

.list code {
background: #f7f7f7;
}
19 changes: 19 additions & 0 deletions framework-boilerplates/umijs/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import styles from './index.css';


export default function() {
return (
<div className={styles.normal}>
<div className={styles.welcome} />
<ul className={styles.list}>
<li>To get started, edit <code>src/pages/index.js</code> and save to reload.</li>
<li>
<a href="https://umijs.org/guide/getting-started.html">
Getting Started
</a>
</li>
</ul>
</div>
);
}
17 changes: 17 additions & 0 deletions framework-boilerplates/umijs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"jsx": "react",
"esModuleInterop": true,
"sourceMap": true,
"baseUrl": ".",
"strict": true,
"paths": {
"@/*": ["src/*"]
},
"allowSyntheticDefaultImports": true
}
}
11 changes: 11 additions & 0 deletions framework-boilerplates/umijs/tslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
defaultSeverity: error
extends:
- tslint-react
- tslint-eslint-rules
jsRules:
rules:
eofline: true
no-console: true
no-construct: true
no-debugger: true
no-reference: true
2 changes: 2 additions & 0 deletions framework-boilerplates/umijs/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module '*.css';
declare module '*.png';
Loading

0 comments on commit 1a1b2f0

Please sign in to comment.