Skip to content

Commit

Permalink
release: v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BoyYangzai committed Nov 30, 2022
1 parent 8a02962 commit 313f18e
Show file tree
Hide file tree
Showing 43 changed files with 1,540 additions and 43 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
.DS_Store
.mini-umi
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ npx mini-umi build

✅ 完善插件API

✅ 实现 create-mumi 脚手架

✅ 实现 userConfig 以及 modify 全流程

✅ 实现 Preset-Vue3.2 + Vite + dev build preview

✅ 实现约定式路由 Vite 支持 Vue3.2 Hmr

🤔TODO:
- [ ] 实现生成运行时 with Preset dev and build
- [ ] 支持对于 dev 约定式路由 的热更新
...

🤔More:
- [ ] 实现一套 preset-react
- [ ] 实现一套 preset-vue
- [ ] 实现一套 preset-qiankun
- [ ] 实现 father
- [ ] 实现 dumi

Binary file added examples/vue3/assets/mini-umi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions examples/vue3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "vue3",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "mumi dev",
"build": "mumi build",
"preview": "mumi preview"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"es-module-lexer": "^1.1.0",
"esbuild": "^0.15.16",
"vue": "^3.2.45",
"vue-router": "^4.1.6"
}
}
67 changes: 67 additions & 0 deletions examples/vue3/pages/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<template>
<div class="content">
<div class="titles">
<div class="title" :style="{flexWrap:'nowrap',marginTop:'-20px'}">
<a href="/page-a">点我跳转 page-a 路由</a>
<br/>
<a href="/test/testpage">点我跳转 test/test-page 路由</a>
</div>
<div class="title">
<img src="../assets/mini-umi.jpg" alt="" @click="go">
</div>
<div class="title">
<a href="https://github.com/BoyYangzai/mini-umi" target="_blank" id="a">mini-umi</a>
</div>
<div class="title">基于Umi微内核架构搭建的 可插拔 渐进式框架 </div>
<div>本框架采用 mini-umi + preset-Vue3.2 + Vite</div>
</div>
<div class="titles">
<div class="title">To be continued...</div>
<div class="title">mini-umi + preset-React + preset-MFSU</div>
<div class="title">mini-umi + preset-qinkun</div>
<div class="title">father dumi</div>
</div>

</div>
</template>
<script setup lang="ts">
const go = () => {
window.open('https://github.com/BoyYangzai/mini-umi')
}
</script>

<style>
*{
padding: 0;
margin: 0;
}
.titles{
display: inline;
}
.title{
width: 100%;
text-align: center;
}
.content {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
flex-wrap: wrap;
}
img{
width: 100px;
}
#a{
font-size: 20px;
color: orange;
text-decoration: none;
}
a{
display: inline;
text-decoration: none;
}
</style>
68 changes: 68 additions & 0 deletions examples/vue3/pages/page-a.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<template>
<div class="content">

<div class="titles">
<div class="title">
我是 /page-a 路由 😊
</div>
<div class="title">
<img src="../assets/mini-umi.jpg" alt="" @click="go">
</div>
<div class="title">
<a href="https://github.com/BoyYangzai/mini-umi" target="_blank">mini-umi</a>
</div>
<div class="title">基于Umi微内核架构搭建的 可插拔 渐进式框架 </div>
<div>本框架采用 mini-umi + preset-Vue3.2 + Vite</div>
</div>
<div class="titles">
<div class="title">To be continued...</div>
<div class="title">mini-umi + preset-React + preset-MFSU</div>
<div class="title">mini-umi + preset-qinkun</div>
<div class="title">father dumi</div>
</div>

</div>
</template>
<script setup lang="ts">
import {RouterView} from 'vue-router'
const go = () => {
window.open('https://github.com/BoyYangzai/mini-umi')
}
</script>

<style>
* {
padding: 0;
margin: 0;
}
.titles {
display: inline;
}
.title {
width: 100%;
text-align: center;
}
.content {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
flex-wrap: wrap;
}
img {
width: 100px;
}
a {
font-size: 20px;
color: orange;
text-decoration: none;
}
</style>
3 changes: 3 additions & 0 deletions examples/vue3/pages/page-a/son.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
I am page-a son route
</template>
68 changes: 68 additions & 0 deletions examples/vue3/pages/test/testpage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<template>
<div class="content">
<div class="titles">
<div class="title">
我是 /test/testpage 路由 qwq
</div>
<br/>
<div class="title">
<img src="../../assets/mini-umi.jpg" alt="" @click="go">

</div>
<div class="title">
<a href="https://github.com/BoyYangzai/mini-umi" target="_blank">mini-umi</a>
</div>
<div class="title">基于Umi微内核架构搭建的 可插拔 渐进式框架 </div>
<div>本框架采用 mini-umi + preset-Vue3.2 + Vite</div>
</div>
<div class="titles">
<div class="title">To be continued...</div>
<div class="title">mini-umi + preset-React + preset-MFSU</div>
<div class="title">mini-umi + preset-qinkun</div>
<div class="title">father dumi</div>
</div>

</div>
</template>
<script setup lang="ts">
const go = () => {
window.open('https://github.com/BoyYangzai/mini-umi')
}
</script>

<style>
* {
padding: 0;
margin: 0;
}
.titles {
display: inline;
}
.title {
width: 100%;
text-align: center;
}
.content {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
flex-wrap: wrap;
}
img {
width: 100px;
}
a {
font-size: 20px;
color: orange;
text-decoration: none;
}
</style>
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mini-umi/core",
"version": "1.0.5",
"version": "1.2.0",
"description": "",
"main": "dist/index.js",
"scripts": {
Expand Down
24 changes: 12 additions & 12 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ export class Core {
configManager: Config | null = null;
userConfig: object = {};
config: object = {};
constructor(opts: { cwd: string, env: Env, presets?: string[], plugins?: string[], defaultConfigFiles?: string[]}) {
constructor(opts: { cwd: string, env: Env, presets?: string[], plugins?: string[], defaultConfigFiles?: string[] }) {
this.opts = opts
this.cwd = opts.cwd
this.env = opts.env;
this.hooksByPluginId = {}
this.hooks = {}
}

async run(opts: { name: string; args?: any}) {
async run(opts: { name: string; args?: any }) {
const { name, args = {} } = opts;
// 获取用户配置
const configManager = new Config({
Expand Down Expand Up @@ -85,9 +85,9 @@ export class Core {
}
// init 所有插件
this.plugins.forEach(async plugin => {
await this.initPlugin({plugin:new Plugin({path: plugin})})
await this.initPlugin({ plugin: new Plugin({ path: plugin }) })
})

await this.applyPlugins({
key: 'onCheck',
});
Expand All @@ -99,7 +99,7 @@ export class Core {
this.config = await this.applyPlugins({
key: 'modifyConfig',
initialValue: { ...this.userConfig },
args: { },
args: {},
});
console.log(`最终的配置为${JSON.stringify(this.config)}`);

Expand All @@ -110,18 +110,18 @@ export class Core {
const command = this.commands[name]
await command.fn({ ...args })
}

async initPreset(opts: {
preset: Plugin;
presets: string[];
plugins: string[];
}) {
const { presets=[], plugins=[] } = await this.initPlugin({
const { presets = [], plugins = [] } = await this.initPlugin({
plugin: opts.preset,
presets: opts.presets,
plugins: opts.plugins,
});

opts.presets.unshift(...(presets || []));
opts.plugins.push(...(plugins || []));
}
Expand Down Expand Up @@ -159,22 +159,22 @@ export class Core {
) {
const hooks = this.hooks[opts.key]
if (!hooks) {
return {}
return opts.initialValue
}
// 读取修改用户配置
const waterFullHook = new AsyncSeriesWaterfallHook(['memo'])

for (const hook of hooks) {
waterFullHook.tapPromise({
name: 'tmp'
},
async (memo: any) => {
const items = await hook.fn(memo, opts.args);
return items && {...memo,...items};
return Array.isArray(memo) ? [...memo, ...items] : { ...memo, ...items };
},
)
}
return waterFullHook.promise(opts.initialValue)
}

}
5 changes: 5 additions & 0 deletions packages/create-m-umi/.fatherrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from 'father';

export default defineConfig({
extends: '../../.fatherrc.base.ts'
});
4 changes: 4 additions & 0 deletions packages/create-m-umi/bin/create-mumi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

process.env.FS_LOGGER = 'none';
require('../dist/cli');
32 changes: 32 additions & 0 deletions packages/create-m-umi/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "create-mumi",
"version": "1.2.0",
"description": "",
"module": "nodenext",
"main": "dist/index.js",
"bin": {
"create": "./bin/create-mumi.js"
},
"scripts": {
"dev": "father dev",
"build": "father build",
"publish:all": "pnpm publish --no-git-checks",
"build:deps": "father prebundle",
"prepublishOnly": "father doctor && npm run build"
},
"dependencies": {
"@umijs/utils": "^4.0.33"
},
"files": [
"dist",
"templates"
],
"repository": "https://github.com/BoyYangzai/mini-umi",
"keywords": [
"umi",
"umijs",
"mini-umi"
],
"author": "",
"license": "ISC"
}
Loading

0 comments on commit 313f18e

Please sign in to comment.