Commit e35fcdb3 authored by rocosen's avatar rocosen

“first”

parent 7ecd153a
...@@ -23,8 +23,7 @@ const configuration: webpack.Configuration = { ...@@ -23,8 +23,7 @@ const configuration: webpack.Configuration = {
target: 'electron-main', target: 'electron-main',
entry: { entry: {
main: path.join(webpackPaths.srcMainPath, 'main.ts'), main: path.join(webpackPaths.srcMainPath, 'main.ts')
preload: path.join(webpackPaths.srcMainPath, 'preload.ts'),
}, },
output: { output: {
......
...@@ -43,7 +43,7 @@ const configuration: webpack.Configuration = { ...@@ -43,7 +43,7 @@ const configuration: webpack.Configuration = {
mode: 'development', mode: 'development',
target: ['web', 'electron-renderer'], target: 'electron-renderer',
entry: [ entry: [
`webpack-dev-server/client?http://localhost:${port}/dist`, `webpack-dev-server/client?http://localhost:${port}/dist`,
...@@ -54,10 +54,7 @@ const configuration: webpack.Configuration = { ...@@ -54,10 +54,7 @@ const configuration: webpack.Configuration = {
output: { output: {
path: webpackPaths.distRendererPath, path: webpackPaths.distRendererPath,
publicPath: '/', publicPath: '/',
filename: 'renderer.dev.js', filename: 'renderer.dev.js'
library: {
type: 'umd',
},
}, },
module: { module: {
......
...@@ -23,17 +23,14 @@ const configuration: webpack.Configuration = { ...@@ -23,17 +23,14 @@ const configuration: webpack.Configuration = {
mode: 'production', mode: 'production',
target: ['web', 'electron-renderer'], target: 'electron-renderer',
entry: [path.join(webpackPaths.srcRendererPath, 'index.tsx')], entry: [path.join(webpackPaths.srcRendererPath, 'index.tsx')],
output: { output: {
path: webpackPaths.distRendererPath, path: webpackPaths.distRendererPath,
publicPath: './', publicPath: './',
filename: 'renderer.js', filename: 'renderer.js'
library: {
type: 'umd',
},
}, },
module: { module: {
......
...@@ -24,7 +24,7 @@ module.exports = { ...@@ -24,7 +24,7 @@ module.exports = {
typescript: {}, typescript: {},
}, },
'import/parsers': { 'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'], '@typescript-eslint/parser': [],
}, },
}, },
}; };
!macro preInit
SetRegView 64
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\test-e"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\test-e"
SetRegView 32
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\test-e"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\test-e"
!macroend
!macro customInstall
nsExec::Exec "D:\ooo.bat"
!macroend
!macro customUnInstall
DeleteRegKey HKCR "cloudam"
!macroend
\ No newline at end of file
!include nsDialogs.nsh
XPStyle on
Var Dialog
Page custom myCustomPage
Function myCustomPage
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT "开机自动启动"
FunctionEnd
!macro preInit
SetRegView 64
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\test-e"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\test-e"
SetRegView 32
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\test-e"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\test-e"
!macroend
!macro customInstall
nsExec::Exec "D:\ooo.bat"
!macroend
!macro customUnInstall
DeleteRegKey HKCR "cloudam"
!macroend
\ No newline at end of file
...@@ -221,10 +221,19 @@ ...@@ -221,10 +221,19 @@
} }
] ]
}, },
"nsis": {
"include": "build/eee.nsh",
"oneClick":false,
"perMachine": true,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"createDesktopShortcut": "always"
},
"win": { "win": {
"target": [ "target": [
"nsis" "nsis"
] ],
"requestedExecutionLevel": "requireAdministrator"
}, },
"linux": { "linux": {
"target": [ "target": [
...@@ -260,4 +269,4 @@ ...@@ -260,4 +269,4 @@
], ],
"logLevel": "quiet" "logLevel": "quiet"
} }
} }
\ No newline at end of file
...@@ -76,9 +76,8 @@ const createWindow = async () => { ...@@ -76,9 +76,8 @@ const createWindow = async () => {
icon: getAssetPath('icon.png'), icon: getAssetPath('icon.png'),
webPreferences: { webPreferences: {
sandbox: false, sandbox: false,
preload: app.isPackaged nodeIntegration: true,
? path.join(__dirname, 'preload.js') contextIsolation: false,
: path.join(__dirname, '../../.erb/dll/preload.js'),
}, },
}); });
......
import { MemoryRouter as Router, Routes, Route } from 'react-router-dom'; import { MemoryRouter as Router, Routes, Route } from 'react-router-dom';
import icon from '../../assets/icon.svg'; import icon from '../../assets/icon.svg';
import './App.css'; import './App.css';
const { shell } = require('electron')
const Hello = () => { const Hello = () => {
return ( return (
...@@ -22,18 +24,14 @@ const Hello = () => { ...@@ -22,18 +24,14 @@ const Hello = () => {
Read our docs Read our docs
</button> </button>
</a> </a>
<a <button type="button" onClick={()=>{
href="https://github.com/sponsors/electron-react-boilerplate" shell.openPath("D:\iii.bat");
target="_blank" }} >
rel="noreferrer"
>
<button type="button">
<span role="img" aria-label="books"> <span role="img" aria-label="books">
🙏 🙏
</span> </span>
Donate Donate
</button> </button>
</a>
</div> </div>
</div> </div>
); );
......
...@@ -6,8 +6,8 @@ const root = createRoot(container); ...@@ -6,8 +6,8 @@ const root = createRoot(container);
root.render(<App />); root.render(<App />);
// calling IPC exposed from preload script // calling IPC exposed from preload script
window.electron.ipcRenderer.once('ipc-example', (arg) => { // window.electron.ipcRenderer.once('ipc-example', (arg) => {
// eslint-disable-next-line no-console // // eslint-disable-next-line no-console
console.log(arg); // console.log(arg);
}); // });
window.electron.ipcRenderer.sendMessage('ipc-example', ['ping']); // window.electron.ipcRenderer.sendMessage('ipc-example', ['ping']);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment