-
-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
bd3f889
commit 32ad394
Showing
87 changed files
with
4,632 additions
and
1,417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,6 @@ | |
**/build | ||
**/typings | ||
**/*.d.ts | ||
**/minimist.js | ||
**/minimist.js | ||
**/node_modules | ||
**/prism.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
typings | ||
build | ||
**/prism.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"volar.tsPlugin": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 # 生产环境停止服务 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ## 部署的应用类型 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { EggPlugin } from 'egg' | ||
export default { | ||
static: true | ||
} as EggPlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": [ | ||
"./" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Oops, something went wrong.