Skip to content

Commit 1842772

Browse files
committed
chore: update
1 parent 8cfb112 commit 1842772

File tree

7 files changed

+104
-96
lines changed

7 files changed

+104
-96
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"cSpell.words": ["collapsable", "qrcode"],
2+
"cSpell.words": ["BNNYKN", "collapsable", "qrcode", "stylelint"],
33
"css.validate": false,
44
"less.validate": false,
55
"scss.validate": false,

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
This site is built with VuePress. Site content is written in Markdown format located in docs.
44

5-
## Warning
6-
7-
Current branch is based on VuePress@v2, and still in W.I.P. For stable releasae in v1, please see [v1 repo](https://github.com/Umajs/umajs.github.io).
8-
95
## Developing
106

117
- Clone repository
@@ -20,8 +16,12 @@ git clone git@github.com:Umajs/docs.git
2016
pnpm # or pnpm install
2117
```
2218

23-
- Start local development environment
19+
- Start local development environment and visit `http://localhost:8080`
2420

2521
```base
2622
pnpm dev
2723
```
24+
25+
## Deploying
26+
27+
Release deployment powered by [Github Pages](https://pages.github.com/). The site is automatically deployed when commits land in `main`. The domain name is <https://umajs.github.io/>.

docs/.vuepress/clientAppEnhance.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ import 'default-passive-events'
33
import './utils/date'
44

55
export default defineClientAppEnhance(({ app, router, siteData }) => {
6-
if (!__SSR__) return
76
console.log(app, router, siteData)
87
})

docs/.vuepress/config.ts

Lines changed: 71 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ console.log('Mode:', isProd ? 'Production' : 'development')
1414

1515
/**
1616
* @description Vuepress2 config
17-
* @link https://v2.vuepress.vuejs.org/reference/config.html
17+
* @see https://v2.vuepress.vuejs.org/reference/config.html
1818
*/
1919
module.exports = defineUserConfig<DefaultThemeOptions, WebpackBundlerOptions>({
2020
base: '/',
@@ -119,7 +119,7 @@ module.exports = defineUserConfig<DefaultThemeOptions, WebpackBundlerOptions>({
119119

120120
/**
121121
* @description Vuepress2 theme config
122-
* @link https://v2.vuepress.vuejs.org/reference/theme-api.html
122+
* @see https://v2.vuepress.vuejs.org/reference/theme-api.html
123123
*/
124124
themeConfig: {
125125
repo: 'https://github.com/Umajs/Umajs',
@@ -155,19 +155,19 @@ module.exports = defineUserConfig<DefaultThemeOptions, WebpackBundlerOptions>({
155155
plugins: [
156156
/**
157157
* @description This plugin will import gtag.js for Google Analytics 4.
158-
* @link https://v2.vuepress.vuejs.org/reference/plugin/google-analytics.html
158+
* @see https://v2.vuepress.vuejs.org/reference/plugin/google-analytics.html
159159
*/
160-
// [
161-
// '@vuepress/google-analytics',
162-
// {
163-
// // we have multiple deployments, which would use different id
164-
// id: process.env.ANALYTICS_ID,
165-
// },
166-
// ],
160+
[
161+
'@vuepress/google-analytics',
162+
{
163+
// we have multiple deployments, which would use different id
164+
id: 'G-8YY0BNNYKN',
165+
},
166+
],
167167

168168
/**
169169
* @description Provide local search to your documentation site
170-
* @link https://v2.vuepress.vuejs.org/reference/plugin/search.html
170+
* @see https://v2.vuepress.vuejs.org/reference/plugin/search.html
171171
*/
172172
[
173173
'@vuepress/plugin-search',
@@ -190,9 +190,10 @@ module.exports = defineUserConfig<DefaultThemeOptions, WebpackBundlerOptions>({
190190
page.frontmatter.tags ?? [],
191191
},
192192
],
193+
193194
/**
194195
* @description Algolia DocSearch
195-
* @link https://v2.vuepress.vuejs.org/reference/plugin/docsearch.html
196+
* @see https://v2.vuepress.vuejs.org/reference/plugin/docsearch.html
196197
*/
197198
[
198199
'@vuepress/docsearch',
@@ -214,9 +215,10 @@ module.exports = defineUserConfig<DefaultThemeOptions, WebpackBundlerOptions>({
214215
// },
215216
// },
216217
],
218+
217219
/**
218220
* @description Register Vue components from component files or directory automatically.
219-
* @link https://v2.vuepress.vuejs.org/reference/plugin/register-components.html
221+
* @see https://v2.vuepress.vuejs.org/reference/plugin/register-components.html
220222
*/
221223
[
222224
'@vuepress/register-components',
@@ -226,7 +228,8 @@ module.exports = defineUserConfig<DefaultThemeOptions, WebpackBundlerOptions>({
226228
],
227229

228230
/**
229-
* @todo
231+
* @description Automatically generate a Sitemap for site
232+
* @see https://vuepress-theme-hope.github.io/sitemap
230233
*/
231234
[
232235
'sitemap2',
@@ -237,11 +240,14 @@ module.exports = defineUserConfig<DefaultThemeOptions, WebpackBundlerOptions>({
237240
],
238241

239242
/**
240-
* @Todo
243+
* @description PWA support
244+
* @see https://vuepress-theme-hope.github.io/pwa
241245
*/
242246
['vuepress-plugin-pwa2'],
247+
243248
/**
244-
* @todo
249+
* @description Automatic generation of detailed feed files
250+
* @see https://vuepress-theme-hope.github.io/feed
245251
*/
246252
[
247253
'feed2',
@@ -251,61 +257,62 @@ module.exports = defineUserConfig<DefaultThemeOptions, WebpackBundlerOptions>({
251257
],
252258

253259
/**
254-
* @todo
255-
*/
256-
// [
257-
// 'seo2',
258-
// {
259-
// author: 'JiaZeng',
260-
// twitterID: 'UMajs',
261-
// restrictions: '3+',
262-
// // seo: () => {
263-
// // return {
264-
// // 'twitter:card': 'summary',
265-
// // }
266-
// // },
267-
// // customMeta: (
268-
// // meta: [Record<'content' | 'name' | 'charset' | 'http-equiv', string>]
269-
// // ) => {
270-
// // },
271-
// },
272-
// ],
273-
274-
/**
275-
* @description use more syntax in your Markdown files.
276-
* @link https://vuepress-theme-hope.github.io/md-enhance/guide/
260+
* @description Inject the `<meta>` tag to enhance the search engine optimization of the site
261+
* @see https://vuepress-theme-hope.github.io/seo
277262
*/
278263
[
279-
'md-enhance',
264+
'seo2',
280265
{
281-
enableAll: true,
282-
tex: {
283-
strict: 'ignore',
284-
},
285-
presentation: {
286-
plugins: [
287-
'highlight',
288-
'math',
289-
'search',
290-
'notes',
291-
'zoom',
292-
'anything',
293-
'audio',
294-
'chalkboard',
295-
],
296-
},
266+
author: 'JiaZeng',
267+
twitterID: 'UMajs',
268+
restrictions: '3+',
269+
// seo: () => {
270+
// return {
271+
// 'twitter:card': 'summary',
272+
// }
273+
// },
274+
// customMeta: (
275+
// meta: [Record<'content' | 'name' | 'charset' | 'http-equiv', string>]
276+
// ) => {
277+
// },
297278
},
298279
],
299280

281+
/**
282+
* @description use more syntax in your Markdown files.
283+
* @see https://vuepress-theme-hope.github.io/md-enhance/guide/
284+
*/
285+
// [
286+
// 'md-enhance',
287+
// {
288+
// enableAll: true,
289+
// tex: {
290+
// strict: 'ignore',
291+
// },
292+
// presentation: {
293+
// plugins: [
294+
// 'highlight',
295+
// 'math',
296+
// 'search',
297+
// 'notes',
298+
// 'zoom',
299+
// 'anything',
300+
// 'audio',
301+
// 'chalkboard',
302+
// ],
303+
// },
304+
// },
305+
// ],
306+
300307
/**
301308
* @description This plugin will provide a table-of-contents (TOC) component
302-
* @link https://v2.vuepress.vuejs.org/reference/plugin/toc.html
309+
* @see https://v2.vuepress.vuejs.org/reference/plugin/toc.html
303310
*/
304311
['@vuepress/plugin-toc'],
305312

306313
/**
307314
* @description This plugin will enable syntax highlighting for markdown code fence with Shiki
308-
* @link https://v2.vuepress.vuejs.org/reference/plugin/shiki.html
315+
* @see https://v2.vuepress.vuejs.org/reference/plugin/shiki.html
309316
*/
310317
[
311318
'@vuepress/plugin-shiki',
@@ -314,12 +321,17 @@ module.exports = defineUserConfig<DefaultThemeOptions, WebpackBundlerOptions>({
314321
? {
315322
/**
316323
* @description shiki theme preview
317-
* @link https://vscodethemes.com/
324+
* @see https://vscodethemes.com/
318325
*/
319326
theme: 'github-dark',
320327
}
321328
: false,
322329
],
330+
331+
/**
332+
* @description Add a debug component to your site. The component will only take effect in development mode
333+
* @see https://v2.vuepress.vuejs.org/reference/plugin/debug.html
334+
*/
323335
['@vuepress/plugin-debug'],
324336
],
325337
onWatched: (_, watchers, restart) => {

docs/基础功能/IOC.md

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -120,52 +120,49 @@ export default class Demp extends BaseService {
120120

121121
> @Service@Resource 最大的不同是,在@Service 修饰的方法中可以访问到`ctx`上下文对象,而@Resource 没有
122122
123-
124-
### 非 Controller 中使用 @Service 时,必须传入 ctx 进行实例化才能使用或者service类不继承BaseService,使用@Resource容器修饰此class。
123+
### 非 Controller 中使用 @Service 时,必须传入 ctx 进行实例化才能使用或者 service 类不继承 BaseService,使用@Resource 容器修饰此 class。
125124

126125
[Service 参考文档](./Service.md)
127126

128-
**`service`文件夹目录下使用`@Resource`需要启用非严格目录,初始化Uma实例时设置`strictDir:true`**
127+
**`service`文件夹目录下使用`@Resource`需要启用非严格目录,初始化 Uma 实例时设置`strictDir:true`**
129128

130129
```ts
131130
const options: TUmaOption = {
132-
Router,
133-
bodyParser: { multipart: true },
134-
strictDir:true, // 启用非严格模式
135-
ROOT: __dirname,
136-
env: process.argv.indexOf('production') > -1 ? 'production' : 'development',
137-
};
138-
const uma = Uma.instance(options);
139-
uma.start(8058);
131+
Router,
132+
bodyParser: { multipart: true },
133+
strictDir: true, // 启用非严格模式
134+
ROOT: __dirname,
135+
env: process.argv.indexOf('production') > -1 ? 'production' : 'development',
136+
}
137+
const uma = Uma.instance(options)
138+
uma.start(8058)
140139
```
141140

142141
```ts
143142
// service
144-
import { Inject ,Resource} from '@umajs/core';
145-
import User from '../model/User';
143+
import { Inject, Resource } from '@umajs/core'
144+
import User from '../model/User'
146145
@Resource()
147146
export default class {
147+
@Inject(User) // or @Inject('User')
148+
user: User
148149

149-
@Inject(User) // or @Inject('User')
150-
user: User;
151-
152-
getDefaultUserAge() {
153-
return this.user.getAge();
154-
}
150+
getDefaultUserAge() {
151+
return this.user.getAge()
152+
}
155153
}
156154
```
157155

158156
```ts
159157
// controller
160-
import { BaseController, Path, Result,Inject } from '@umajs/core';
161-
import UserService from '../service/user.service';
158+
import { BaseController, Path, Result, Inject } from '@umajs/core'
159+
import UserService from '../service/user.service'
162160

163161
export default class Index extends BaseController {
164-
@Path('/user')
165-
test() {
166-
console.log(this.userService.getDefaultUserAge());
167-
return Result.send('get defaultUserAge');
168-
}
162+
@Path('/user')
163+
test() {
164+
console.log(this.userService.getDefaultUserAge())
165+
return Result.send('get defaultUserAge')
166+
}
169167
}
170-
171168
```

docs/基础功能/Service.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default (uma: Uma, options: any = {}): Koa.Middleware => {
7676
};
7777
```
7878

79-
- 在Aspect切面中使用
79+
- 在 Aspect 切面中使用
8080

8181
```javascript
8282
// Aspect
@@ -95,6 +95,6 @@ export default class Method implements IAspect {
9595
}
9696
```
9797

98-
**此外,框架还提供了@Resource@Inject装饰器来实现`IOC容器``依赖注入`**
98+
**此外,框架还提供了@Resource@Inject 装饰器来实现`IOC容器``依赖注入`**
9999

100100
[IOC 参考文档](./IOC.md)

docs/服务端渲染/React-ssr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ browserRouter() {
163163
}
164164
```
165165

166-
**注:`baseName`默认为页面组件标识名称。和pages下的页面文件名称保持一致,当服务端根路由和文件名称不一致时,需要给插件传递`baseName`属性,以确保服务端和客户端根路由一致。**
166+
**注:`baseName`默认为页面组件标识名称。和 pages 下的页面文件名称保持一致,当服务端根路由和文件名称不一致时,需要给插件传递`baseName`属性,以确保服务端和客户端根路由一致。**
167167

168168
## 12、**SEO 和自定义 HTML**
169169

0 commit comments

Comments
 (0)