├── .vscode ├── settings.json └── launch.json ├── src ├── renderer │ ├── public │ │ └── renderer.js │ ├── models │ │ └── global.js │ ├── assets │ │ └── yay.jpg │ ├── .umi-production │ │ ├── core │ │ │ ├── polyfill.ts │ │ │ ├── plugin.ts │ │ │ ├── umiExports.ts │ │ │ ├── history.ts │ │ │ ├── routes.ts │ │ │ ├── pluginRegister.ts │ │ │ └── pluginConfig.d.ts │ │ ├── plugin-initial-state │ │ │ ├── models │ │ │ │ └── initialState.ts │ │ │ ├── exports.ts │ │ │ ├── runtime.tsx │ │ │ └── Provider.tsx │ │ ├── plugin-model │ │ │ ├── helpers │ │ │ │ ├── constant.tsx │ │ │ │ ├── dispatcher.tsx │ │ │ │ └── executor.tsx │ │ │ ├── runtime.tsx │ │ │ ├── Provider.tsx │ │ │ └── useModel.tsx │ │ ├── plugin-dva │ │ │ ├── exports.ts │ │ │ ├── runtime.tsx │ │ │ ├── connect.ts │ │ │ └── dva.ts │ │ ├── plugin-helmet │ │ │ └── exports.ts │ │ ├── umi.ts │ │ └── plugin-request │ │ │ └── request.ts │ ├── pages │ │ ├── document.ejs │ │ └── index.js │ └── config │ │ └── config.js └── main │ └── main.js ├── .prettierrc ├── .prettierignore ├── .gitignore ├── .buildrc.js ├── package.json └── README.md /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git.ignoreLimitWarning": true 3 | } -------------------------------------------------------------------------------- /src/renderer/public/renderer.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | window.electron = require('electron') 3 | -------------------------------------------------------------------------------- /src/renderer/models/global.js: -------------------------------------------------------------------------------- 1 | export default { 2 | state: { 3 | msg: 'Hello World', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "tabWidth": 2, 4 | "semi": true, 5 | "singleQuote": true 6 | } -------------------------------------------------------------------------------- /src/renderer/assets/yay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamnie/umi3.0-electron/HEAD/src/renderer/assets/yay.jpg -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | release/ 3 | .DS_Store 4 | .idea/ 5 | yarn-error.log 6 | npm-debug.log 7 | src/renderer/pages/.umi/ -------------------------------------------------------------------------------- /src/renderer/.umi-production/core/polyfill.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | import 'core-js'; 3 | import 'regenerator-runtime/runtime'; 4 | export {}; 5 | -------------------------------------------------------------------------------- /src/renderer/.umi-production/plugin-initial-state/models/initialState.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | export default () => ({ loading: false, refresh: () => {} }) -------------------------------------------------------------------------------- /src/renderer/.umi-production/plugin-model/helpers/constant.tsx: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | import React from 'react'; 3 | 4 | export const UmiContext = React.createContext({}); 5 | -------------------------------------------------------------------------------- /src/renderer/.umi-production/plugin-dva/exports.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | 3 | export { connect, useDispatch, useStore, useSelector } from 'dva'; 4 | export { getApp as getDvaApp } from './dva'; 5 | -------------------------------------------------------------------------------- /src/renderer/.umi-production/plugin-helmet/exports.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | // @ts-ignore 3 | export { Helmet } from '/Users/xiaobei/Documents/private/toolbox/umi3.0-electron/node_modules/react-helmet'; 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | src/renderer/pages/.umi 4 | src/renderer/pages/.umi-production 5 | release 6 | yarn-error.log 7 | yarn.lock 8 | .history 9 | .vscode 10 | .umi 11 | src/renderer/.umi/ -------------------------------------------------------------------------------- /src/renderer/.umi-production/plugin-dva/runtime.tsx: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | import React from 'react'; 3 | import { _DvaContainer, getApp, _onCreate } from './dva'; 4 | 5 | export function rootContainer(container, opts) { 6 | return React.createElement(_DvaContainer, opts, container); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/renderer/.umi-production/plugin-initial-state/exports.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | 3 | // @ts-ignore 4 | import { InitialState as InitialStateType } from '../plugin-initial-state/models/initialState'; 5 | 6 | export type InitialState = InitialStateType; 7 | export const __PLUGIN_INITIAL_STATE = 1; 8 | -------------------------------------------------------------------------------- /src/renderer/.umi-production/plugin-model/runtime.tsx: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | /* eslint-disable import/no-dynamic-require */ 3 | import React from 'react'; 4 | import Provider from './Provider'; 5 | 6 | export function rootContainer(container: React.ReactNode) { 7 | return React.createElement( 8 | Provider, 9 | null, 10 | container, 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/renderer/.umi-production/core/plugin.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | import { Plugin } from '/Users/xiaobei/Documents/private/toolbox/umi3.0-electron/node_modules/umi/node_modules/@umijs/runtime'; 3 | 4 | const plugin = new Plugin({ 5 | validKeys: ['modifyClientRenderOpts','patchRoutes','rootContainer','render','onRouteChange','__mfsu','dva','getInitialState','initialStateConfig','request',], 6 | }); 7 | 8 | export { plugin }; 9 | -------------------------------------------------------------------------------- /src/renderer/pages/document.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 |{this.props.global.msg}
13 |void> = (action: { 35 | type: string; 36 | payload?: P; 37 | callback?: C; 38 | [key: string]: any; 39 | }) => any; 40 | 41 | export type Subscription = (api: SubscriptionAPI, done: Function) => void | Function; 42 | 43 | export interface Loading { 44 | global: boolean; 45 | effects: { [key: string]: boolean | undefined }; 46 | models: { 47 | [key: string]: any; 48 | }; 49 | } 50 | 51 | /** 52 | * @type P: Params matched in dynamic routing 53 | */ 54 | export interface ConnectProps< 55 | P extends { [K in keyof P]?: string } = {}, 56 | S = LocationState, 57 | T = {} 58 | > { 59 | dispatch?: Dispatch; 60 | // https://github.com/umijs/umi/pull/2194 61 | match?: match
;
62 | location: Location & { query: T };
63 | history: History;
64 | route: IRoute;
65 | }
66 |
67 | export type RequiredConnectProps<
68 | P extends { [K in keyof P]?: string } = {},
69 | S = LocationState,
70 | T = {}
71 | > = Required