Skip to content

Commit

Permalink
docs: homepage (#55)
Browse files Browse the repository at this point in the history
docs: add homepage

Co-authored-by: dellyoung <33285905+dellyoung@users.noreply.github.com>
Co-authored-by: yimingyang <yimingyang@tencent.com>
Co-authored-by: whongliang <whongliang@tencent.com>
Co-authored-by: bUBBLE <www.1567891@qq.com>
Co-authored-by: xiangjie.yxj <xiangjie.yxj@alibaba-inc.com>
  • Loading branch information
6 people authored Apr 25, 2021
1 parent bd3f889 commit 32ad394
Show file tree
Hide file tree
Showing 87 changed files with 4,632 additions and 1,417 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
**/build
**/typings
**/*.d.ts
**/minimist.js
**/minimist.js
**/node_modules
**/prism.js
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,16 @@ cypress/videos

packages/**/README.md

example/**/typings
**/typings

**/run

example/**/vite.config.js

example/**/f.yml
example/**/f.yml

**/.serverless

docs/dist

example/yarn.lock
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
// "source.fixAll.eslint": true
},
"eslint.validate": [
"javascript",
Expand Down
1,164 changes: 5 additions & 1,159 deletions README.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
typings
build
**/prism.js
9 changes: 9 additions & 0 deletions docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: [
'standard-vue-ts'
],
parserOptions: {
project: './tsconfig.lint.json'
}
}
3 changes: 3 additions & 0 deletions docs/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"volar.tsPlugin": true
}
11 changes: 11 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 官方文档

官方文档请查看 [https://github.com/ykfe/ssr](https://github.com/ykfe/ssr)

## getting start

```bash
$ npm start # 本地开发模式运行,单进程 支持 前端 HMR 前端静态资源走本地 webpack 服务
$ npm run prod # 模拟生产环境运行,多进程,前端资源走静态目录
$ npm run stop # 生产环境停止服务
```
7 changes: 7 additions & 0 deletions docs/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const WebFramework = require('@midwayjs/web').Framework
const web = new WebFramework().configure({
port: 3000
})

const { Bootstrap } = require('@midwayjs/bootstrap')
Bootstrap.load(web).run()
11 changes: 11 additions & 0 deletions docs/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
chainBaseConfig: (chain) => {
chain.module
.rule('markdown')
.test(/\.md$/)
.use('raw-loader')
.loader(require.resolve('raw-loader'))
.end()
}

}
27 changes: 27 additions & 0 deletions docs/f.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
service:
name: ssr-doc
provider:
name: aliyun

aggregation: # 聚合成一个函数发布
ssr: # 聚合函数的名称
deployOrigin: false
functionsPattern:
- '*'
custom:
customDomain:
domainName: auto

package:
include:
- build
- public
exclude:
- package-lock.json
- src
- vite.config.js
- vetur.config.js

artifact: code.zip

deployType: egg ## 部署的应用类型
55 changes: 55 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "midway-react-ssr",
"version": "1.0.0",
"private": true,
"dependencies": {
"@midwayjs/decorator": "^2.3.0",
"@midwayjs/web": "^2.3.0",
"egg": "^2.0.0",
"egg-scripts": "^2.10.0",
"highlight.js": "^10.7.2",
"markdown-it": "^12.0.4",
"markdown-it-anchor": "^7.1.0",
"markdown-it-toc-done-right": "^4.2.0",
"ssr-core-vue3": "^5.0.0",
"ssr-types": "^5.0.0",
"vue": "^3.0.0",
"vue-router": "^4.0.0",
"vuex": "^4.0.0"
},
"devDependencies": {
"@midwayjs/egg-ts-helper": "^1.0.5",
"@types/markdown-it": "^12.0.1",
"@vitejs/plugin-vue": "^1.2.1",
"cross-env": "^7.0.3",
"darkmode-js": "^1.5.7",
"eslint-config-standard-vue-ts": "^1.0.12",
"raw-loader": "^4.0.2",
"ssr": "^5.0.0",
"ssr-plugin-midway": "^5.0.0",
"ssr-plugin-vue3": "^5.0.0",
"typescript": "^3.9.7",
"vite": "^2.1.5",
"vite-raw-plugin": "^1.0.0"
},
"scripts": {
"prod": "ssr build && egg-scripts start --daemon --port=3000 --title=midway-server-my_midway_project --framework=@midwayjs/web",
"stop": "egg-scripts stop --title=midway-server-my_midway_project",
"start": "ssr start",
"start:vite": "ssr start --vite",
"build": "ssr build",
"deploy": "ssr build && ssr deploy",
"deploy:tencent": "ssr build && ssr deploy --tencent"
},
"midway-integration": {
"tsCodeRoot": "src"
},
"midway-luckyeye": {
"packages": [
"midway_v2"
]
},
"egg": {
"framework": "@midwayjs/web"
}
}
7 changes: 7 additions & 0 deletions docs/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { midwayPlugin } = require('ssr-plugin-midway')
const { vuePlugin } = require('ssr-plugin-vue3')

module.exports = {
serverPlugin: midwayPlugin(),
clientPlugin: vuePlugin()
}
Binary file added docs/public/fonts/Inter-Bold.ttf
Binary file not shown.
Binary file added docs/public/fonts/Inter-Regular.ttf
Binary file not shown.
3 changes: 3 additions & 0 deletions docs/public/images/arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/public/images/arrow_left_row.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/public/images/arrow_right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/public/images/arrow_right_row.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/images/csr-fetch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/images/header-bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/images/homecode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/images/homepage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/images/logo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/images/ssr&csr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/images/ssr-fetch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions docs/src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { initialSSRDevProxy } from 'ssr-server-utils'
import { Application } from 'egg'

class AppBootHook {
app: Application
constructor (app) {
this.app = app
}

async didReady () {
await initialSSRDevProxy(this.app)
}
}

export default AppBootHook
18 changes: 18 additions & 0 deletions docs/src/config/config.default.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { join } from 'path'
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg'

export type DefaultConfig = PowerPartial<EggAppConfig>

export default (appInfo: EggAppInfo) => {
const config = {} as DefaultConfig

// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1611038425326_4049'
// add your config here
config.middleware = []
config.static = {
prefix: '/',
dir: [join(appInfo.appDir, './build'), join(appInfo.appDir, './public')]
}
return config
}
15 changes: 15 additions & 0 deletions docs/src/config/config.local.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg'

export type DefaultConfig = PowerPartial<EggAppConfig>

export default (appInfo: EggAppInfo) => {
const config: DefaultConfig = {}

// ...

config.middleware = [

]

return config
}
4 changes: 4 additions & 0 deletions docs/src/config/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { EggPlugin } from 'egg'
export default {
static: true
} as EggPlugin
27 changes: 27 additions & 0 deletions docs/src/controller/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Readable } from 'stream'
import { Controller, Get, Provide, Inject } from '@midwayjs/decorator'
import { Context } from 'egg'
import { render } from 'ssr-core-vue3'

@Provide()
@Controller('/')
export class Index {
@Inject()
ctx: Context

@Get('/')
@Get('/docs/:page')
@Get('/blog')
@Get('/blog:router')
async handler (): Promise<void> {
try {
const stream = await render<Readable>(this.ctx, {
stream: true
})
this.ctx.body = stream
} catch (error) {
console.log(error)
this.ctx.body = error
}
}
}
27 changes: 27 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compileOnSave": true,
"compilerOptions": {
"baseUrl": ".",
"target": "ES2018",
"module": "commonjs",
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"inlineSourceMap":true,
"noImplicitThis": true,
"noUnusedLocals": true,
"stripInternal": true,
"pretty": true,
"declaration": true,
"outDir": "dist",
"typeRoots": [ "./typings", "./node_modules/@types"]
},
"exclude": [
"dist",
"node_modules",
"test",
"web",
"build"
]
}

19 changes: 19 additions & 0 deletions docs/tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compileOnSave": true,
"compilerOptions": {
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"inlineSourceMap":true,
"noImplicitThis": true,
"noUnusedLocals": true,
"stripInternal": true,
"pretty": true,
"declaration": true,
"strict": true

},
"include": [
"./"
]
}
11 changes: 11 additions & 0 deletions docs/vetur.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// vetur.config.js
/** @type {import('vls').VeturConfig} */

module.exports = {
projects: [
{
root: './web',
tsconfig: './tsconfig.json'
}
]
}
26 changes: 26 additions & 0 deletions docs/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 以下为默认生成的 Vite Config 配置,为了确保应用正确运行请不要删除默认配置中的任何代码

const { join } = require('path')
const vuePlugin = require('@vitejs/plugin-vue')
const rawPlugin = require('vite-raw-plugin')

/**
* @type {import('vite').UserConfig}
*/
module.exports = {
plugins: [
vuePlugin(),
rawPlugin({
fileRegex: /\.md$/
})
],
define: {
__isBrowser__: true
},
resolve: {
alias: {
'@': join(process.cwd(), './web')
},
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
}
}
12 changes: 12 additions & 0 deletions docs/web/@types/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { IWindow } from 'ssr-types'

declare module '*.less'

declare global {
interface Window {
__USE_SSR__?: IWindow['__USE_SSR__']
__INITIAL_DATA__?: IWindow['__INITIAL_DATA__']
STORE_CONTEXT?: IWindow['STORE_CONTEXT']
}
const __isBrowser__: Boolean
}
Loading

0 comments on commit 32ad394

Please sign in to comment.