-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: 添加 react-ssr-enhanced 包 & 完善 ci (#11)
- Loading branch information
Showing
94 changed files
with
1,955 additions
and
362 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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ dist | |
.cache | ||
.vscode | ||
yarn.lock | ||
|
||
package-lock.json | ||
*.bak | ||
*.tem | ||
*.temp | ||
|
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,24 @@ | ||
import path from "path"; | ||
import fs from "fs"; | ||
import getPublicUrlOrPath from "react-dev-utils/getPublicUrlOrPath"; | ||
|
||
// Make sure any symlinks in the project folder are resolved: | ||
// https://github.com/facebook/create-react-app/issues/637 | ||
const appDirectory = fs.realpathSync(process.cwd()); | ||
const resolveApp = (relativePath: string) => path.resolve(appDirectory, relativePath); | ||
|
||
// We use `PUBLIC_URL` environment variable or "homepage" field to infer | ||
// "public path" at which the app is served. | ||
// webpack needs to know it to put the right <script> hrefs into HTML even in | ||
// single-page apps that may serve index.html for nested URLs like /todos/42. | ||
// We can't use a relative path in HTML because we don't want to load something | ||
// like /todos/42/static/js/bundle.7289d.js. We have to know the root. | ||
const publicUrlOrPath = getPublicUrlOrPath( | ||
process.env.NODE_ENV === 'development', | ||
require(resolveApp('package.json')).homepage, | ||
process.env.PUBLIC_URL | ||
); | ||
|
||
export default { | ||
publicUrlOrPath | ||
} |
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
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 @@ | ||
node_modules | ||
npm-debug.log* | ||
package-lock.json | ||
coverage | ||
dist | ||
.DS_Store | ||
.cache | ||
.vscode | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
*.bak | ||
*.tem | ||
*.temp | ||
#.swp | ||
*.*~ | ||
~*.* |
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,29 @@ | ||
Basic Example | ||
--- | ||
|
||
The [react](https://github.com/facebook/react) base application. | ||
|
||
## Development | ||
|
||
Runs the project in development mode. | ||
|
||
```bash | ||
npm run start | ||
``` | ||
|
||
Runs Node Server | ||
|
||
```bash | ||
npm run server | ||
``` | ||
|
||
## production | ||
|
||
Builds the app for production to the build folder. | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
The build is minified and the filenames include the hashes. | ||
Your app is ready to be deployed! |
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,44 @@ | ||
{ | ||
"name": "@examples/basic-routes-rematch-new", | ||
"version": "3.0.1", | ||
"description": "", | ||
"private": true, | ||
"scripts": { | ||
"server": "node dist/server.js", | ||
"nodemon": "nodemon dist/server.js", | ||
"build": "npm run build:server && npm run build:web", | ||
"build:server": "kkt-ssr build", | ||
"build:web": "kkt-ssr build --target web", | ||
"start": "npm run start:server & npm run start:web", | ||
"start:server": "kkt-ssr watch", | ||
"start:web": "kkt-ssr watch --target web" | ||
}, | ||
"keywords": [], | ||
"dependencies": { | ||
"@rematch/core": "2.2.0", | ||
"@rematch/loading": "2.1.2", | ||
"express": "4.16.4", | ||
"react": "17.0.2", | ||
"react-dom": "17.0.2", | ||
"react-redux": "7.2.6", | ||
"react-router": "^6.2.1", | ||
"react-router-dom": "^6.2.1", | ||
"serialize-javascript": "6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@kkt/ssr": "3.0.1", | ||
"kkt": "7.1.5" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
} | ||
} |
Binary file not shown.
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 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>KKT</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
</body> | ||
|
||
</html> |
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 @@ | ||
User-agent: * |
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 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import App from './routes'; | ||
|
||
ReactDOM.hydrate(<BrowserRouter><App /></BrowserRouter>, document.getElementById('root')); | ||
|
||
if (module.hot) { | ||
module.hot.accept(); | ||
} |
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 @@ | ||
|
||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import App from './routes'; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import store from "./models" | ||
import { Provider } from 'react-redux'; | ||
|
||
ReactDOM.hydrate( | ||
<Provider store={store} > | ||
<BrowserRouter> | ||
<App /> | ||
</BrowserRouter> | ||
</Provider> | ||
, document.getElementById('root')); | ||
|
||
if (module.hot) { | ||
module.hot.accept(); | ||
} |
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,13 @@ | ||
import { createModel } from "@rematch/core" | ||
|
||
export default createModel()({ | ||
name: "demo", | ||
state: { | ||
title: "demo 标题" | ||
}, | ||
effects: () => ({ | ||
async very(_, { demo }) { | ||
console.log("打印 demo", demo.title) | ||
} | ||
}) | ||
}) |
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,13 @@ | ||
import { init } from "@rematch/core" | ||
import loading from "@rematch/loading" | ||
import login from "./login" | ||
import demo from "./demo" | ||
const models = { demo, login } | ||
|
||
const store = init({ | ||
models, | ||
plugins: [loading()] | ||
}) | ||
|
||
|
||
export default store; |
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,21 @@ | ||
import { createModel } from "@rematch/core" | ||
|
||
export default createModel()({ | ||
name: "login", | ||
state: { | ||
title: "login 标题" | ||
}, | ||
effects: () => ({ | ||
async very(_, { login }) { | ||
console.log("打印 login", login.title) | ||
} | ||
}), | ||
reducers: { | ||
update(state, { payload }) { | ||
return { | ||
...state, | ||
...payload | ||
} | ||
} | ||
} | ||
}) |
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 @@ | ||
import React from "react"; | ||
import { useSelector } from 'react-redux' | ||
|
||
const About = () => { | ||
const title = useSelector(({ demo }) => demo.title) | ||
|
||
return <div>About {title}</div> | ||
} | ||
export default About; |
Oops, something went wrong.