Skip to content

Commit

Permalink
feat: add umi template
Browse files Browse the repository at this point in the history
  • Loading branch information
kiner-tang committed Jul 13, 2024
1 parent f89abe8 commit 6f4bd5a
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/create-mako/templates/umi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/node_modules
/.env.local
/.umirc.local.ts
/config/config.local.ts
/src/.umi
/src/.umi-production
/src/.umi-test
/dist
.swc
2 changes: 2 additions & 0 deletions packages/create-mako/templates/umi/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry=https://registry.npmjs.com/

10 changes: 10 additions & 0 deletions packages/create-mako/templates/umi/.umirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'umi';

export default defineConfig({
routes: [
{ path: '/', component: 'index' },
{ path: '/docs', component: 'docs' },
],
npmClient: 'pnpm',
mako: {},
});
18 changes: 18 additions & 0 deletions packages/create-mako/templates/umi/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"private": true,
"scripts": {
"dev": "umi dev",
"build": "umi build",
"postinstall": "umi setup",
"setup": "umi setup",
"start": "npm run dev"
},
"dependencies": {
"umi": "^4.3.6"
},
"devDependencies": {
"@types/react": "^18.0.33",
"@types/react-dom": "^18.0.11",
"typescript": "^5.0.3"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions packages/create-mako/templates/umi/src/layouts/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.navs {
ul {
padding: 0;
list-style: none;
display: flex;
}
li {
margin-right: 1em;
}
}
21 changes: 21 additions & 0 deletions packages/create-mako/templates/umi/src/layouts/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Link, Outlet } from 'umi';
import styles from './index.less';

export default function Layout() {
return (
<div className={styles.navs}>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/docs">Docs</Link>
</li>
<li>
<a href="https://github.com/umijs/umi">Github</a>
</li>
</ul>
<Outlet />
</div>
);
}
9 changes: 9 additions & 0 deletions packages/create-mako/templates/umi/src/pages/docs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const DocsPage = () => {
return (
<div>
<p>This is umi docs.</p>
</div>
);
};

export default DocsPage;
15 changes: 15 additions & 0 deletions packages/create-mako/templates/umi/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import yayJpg from '../assets/yay.jpg';

export default function HomePage() {
return (
<div>
<h2>Yay! Welcome to umi!</h2>
<p>
<img src={yayJpg} width="388" />
</p>
<p>
To get started, edit <code>pages/index.tsx</code> and save to reload.
</p>
</div>
);
}
3 changes: 3 additions & 0 deletions packages/create-mako/templates/umi/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./src/.umi/tsconfig.json"
}
1 change: 1 addition & 0 deletions packages/create-mako/templates/umi/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'umi/typings';

0 comments on commit 6f4bd5a

Please sign in to comment.