Commit 1610acc3 authored by rocosen's avatar rocosen

Merge branch 'feat-test-bat' into 'master'

Feat test bat

See merge request !1
parents 7ecd153a efc8bc56
...@@ -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: {
......
...@@ -31,3 +31,5 @@ npm-debug.log.* ...@@ -31,3 +31,5 @@ npm-debug.log.*
# eslint ignores hidden directories by default: # eslint ignores hidden directories by default:
# https://github.com/eslint/eslint/issues/8429 # https://github.com/eslint/eslint/issues/8429
!.erb !.erb
src/
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
".prettierrc": "jsonc", ".prettierrc": "jsonc",
".eslintignore": "ignore" ".eslintignore": "ignore"
}, },
"eslint.validate": [ "eslint.validate": [
"javascript", "javascript",
"javascriptreact", "javascriptreact",
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
"javascript.validate.enable": false, "javascript.validate.enable": false,
"javascript.format.enable": false, "javascript.format.enable": false,
"typescript.format.enable": false, "typescript.format.enable": false,
"search.exclude": { "search.exclude": {
".git": true, ".git": true,
".eslintcache": true, ".eslintcache": true,
......
22
\ No newline at end of file
This diff is collapsed.
This diff was suppressed by a .gitattributes entry.
chcp 65001
sc config LanmanServer start= disabled
echo N | net stop LanmanServer
sc config iphlpsvc start= auto
start "" /w /B "%cd%\resources\assets\exe\devcon.exe" /install %windir%\inf\netloop.inf *msloop
powershell -Command "$interfaces = Get-WmiObject Win32_NetworkAdapter;$interfaces | foreach {$friendlyname = $_ | Select-Object -ExpandProperty NetConnectionID;$name = $_ | Select-Object -ExpandProperty Name;$friendlyname | Out-File -Encoding utf8 aa.txt;}
set /p netname=<aa.txt
echo %netname%
netsh interface ip add address "%netname%" 1.10.0.1 255.255.255.0
netsh interface ip add address "%netname%" 1.10.1.1 255.255.255.0
netsh interface portproxy add v4tov4 listenport=445 listenaddress=1.10.0.1 connectaddress=47.93.217.126 connectport=4555
netsh interface portproxy add v4tov4 listenport=445 listenaddress=1.10.1.1 connectaddress=180.76.134.227 connectport=4555
md C:\test
mklink /D c:\test\aliyun \\1.10.0.1\ali\1b520eb8a56147299ad803f9f87b6297
mklink /D c:\test\baiduyun \\1.10.1.1\data\1b520eb8a56147299ad803f9f87b6297
\ No newline at end of file
@echo off
net use \\1.10.0.1\ali\1b520eb8a56147299ad803f9f87b6297 123456 /user:cloudam /persistent:yes
net use \\1.10.1.1\data\1b520eb8a56147299ad803f9f87b6297 123456 /user:cloudam /persistent:yes
subst Z: C:\test
\ No newline at end of file
currentpath = createobject("Scripting.FileSystemObject").GetFolder(".").Path
path = Chr(34) & currentpath & "\mount.bat" & Chr(34)
Set shell=CreateObject("WScript.Shell")
a = shell.run (path,0)
Set wshell = Nothing
!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 "开机自动启动"
SetRebootFlag true
IfRebootFlag 0 +2
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
!include nsDialogs.nsh
XPStyle on
Var Dialog
Page custom myCustomPage
Function myCustomPage
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
SetRebootFlag true
IfRebootFlag 0 +2
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 "$INSTDIR\resources\assets\script\init.bat"
!macroend
!macro customUnInstall
DeleteRegKey HKCR "cloudam"
!macroend
\ No newline at end of file
...@@ -108,8 +108,12 @@ ...@@ -108,8 +108,12 @@
} }
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@mui/material": "^5.10.8",
"electron-debug": "^3.2.0", "electron-debug": "^3.2.0",
"electron-log": "^4.4.8", "electron-log": "^4.4.8",
"electron-root-path": "^1.1.0",
"electron-updater": "^5.2.1", "electron-updater": "^5.2.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
...@@ -183,8 +187,8 @@ ...@@ -183,8 +187,8 @@
"webpack-merge": "^5.8.0" "webpack-merge": "^5.8.0"
}, },
"build": { "build": {
"productName": "ElectronReact", "productName": "bkunyun",
"appId": "org.erb.ElectronReact", "appId": "org.erb.bkunyun",
"asar": true, "asar": true,
"asarUnpack": "**\\*.{node,dll}", "asarUnpack": "**\\*.{node,dll}",
"files": [ "files": [
...@@ -221,6 +225,14 @@ ...@@ -221,6 +225,14 @@
} }
] ]
}, },
"nsis": {
"include": "build/installer.nsh",
"oneClick": false,
"perMachine": true,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"createDesktopShortcut": "always"
},
"win": { "win": {
"target": [ "target": [
"nsis" "nsis"
......
{ {
"name": "electron-react-boilerplate", "name": "electron-react-boilerplate",
"version": "4.6.0", "version": "4.6.0",
"lockfileVersion": 2, "lockfileVersion": 1
"requires": true,
"packages": {
"": {
"name": "electron-react-boilerplate",
"version": "4.6.0",
"hasInstallScript": true,
"license": "MIT"
}
}
} }
{ {
"name": "electron-react-boilerplate", "name": "bkunyun",
"version": "4.6.0", "version": "0.0.1",
"description": "A foundation for scalable desktop apps", "description": "北鲲云盘",
"license": "MIT", "license": "MIT",
"author": { "author": {
"name": "Electron React Boilerplate Maintainers", "name": "Electron React Boilerplate Maintainers",
...@@ -14,5 +14,7 @@ ...@@ -14,5 +14,7 @@
"postinstall": "npm run electron-rebuild && npm run link-modules", "postinstall": "npm run electron-rebuild && npm run link-modules",
"link-modules": "node -r ts-node/register ../../.erb/scripts/link-modules.ts" "link-modules": "node -r ts-node/register ../../.erb/scripts/link-modules.ts"
}, },
"dependencies": {} "dependencies": {
"install": "^0.13.0"
}
} }
...@@ -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';
import path from 'path';
import { Button } from '@mui/material';
const rootPath = require('electron-root-path').rootPath;
const { shell } = require('electron');
const location = path.join(
rootPath.substring(0, rootPath.length - 8),
'./assets/script/start.vbs'
);
const Hello = () => { const Hello = () => {
return ( return (
<div> <div>
<div className="Hello"> <div className="Hello">
<img width="200" alt="icon" src={icon} /> <img width="200" alt="icon" src={icon} />
</div> </div>
<h1>electron-react-boilerplate</h1> <h1>electron-react</h1>
<div className="Hello"> <div className="Hello">
<a <Button
href="https://electron-react-boilerplate.js.org/" variant="contained"
target="_blank" onClick={() => {
rel="noreferrer" shell.openPath(location);
> }}
<button type="button">
<span role="img" aria-label="books">
📚
</span>
Read our docs
</button>
</a>
<a
href="https://github.com/sponsors/electron-react-boilerplate"
target="_blank"
rel="noreferrer"
> >
<button type="button"> 挂载
<span role="img" aria-label="books"> </Button>
🙏
</span>
Donate
</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