From b27927a0cd9454e76d8812ff8ab657d3b748a5ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Thu, 3 Feb 2022 08:36:51 +0800 Subject: [PATCH] Spaces instead Tabs --- .electron-builder.config.js | 64 ++++++------- README.md | 28 +++--- src/main/index.ts | 6 +- src/renderer/index.html | 6 +- src/renderer/src/App.tsx | 122 ++++++++++++------------ src/renderer/src/main.tsx | 12 +-- src/renderer/src/styles/app.module.scss | 108 ++++++++++----------- 7 files changed, 173 insertions(+), 173 deletions(-) diff --git a/.electron-builder.config.js b/.electron-builder.config.js index a4ab56d..8e0a156 100644 --- a/.electron-builder.config.js +++ b/.electron-builder.config.js @@ -3,36 +3,36 @@ * @see https://www.electron.build/configuration/configuration */ module.exports = { - appId: "YourAppID@qq.com", - productName: "YourAppName", - copyright: "Copyright © 2022 ${author}", - asar: true, - directories: { - output: "release/${version}", - buildResources: "build", - }, - files: ["dist"], - win: { - target: [ - { - target: "nsis", - arch: ["x64"], - }, - ], - artifactName: "${productName}-${version}-Setup.${ext}", - }, - nsis: { - oneClick: false, - perMachine: false, - allowToChangeInstallationDirectory: true, - deleteAppDataOnUninstall: false, - }, - mac: { - target: ["dmg"], - artifactName: "${productName}-${version}-Installer.${ext}", - }, - linux: { - target: ["AppImage"], - artifactName: "${productName}-${version}-Installer.${ext}", - }, + appId: "YourAppID@qq.com", + productName: "YourAppName", + copyright: "Copyright © 2022 ${author}", + asar: true, + directories: { + output: "release/${version}", + buildResources: "build", + }, + files: ["dist"], + win: { + target: [ + { + target: "nsis", + arch: ["x64"], + }, + ], + artifactName: "${productName}-${version}-Setup.${ext}", + }, + nsis: { + oneClick: false, + perMachine: false, + allowToChangeInstallationDirectory: true, + deleteAppDataOnUninstall: false, + }, + mac: { + target: ["dmg"], + artifactName: "${productName}-${version}-Installer.${ext}", + }, + linux: { + target: ["AppImage"], + artifactName: "${productName}-${version}-Installer.${ext}", + }, } diff --git a/README.md b/README.md index eba22ea..565bcfa 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,8 @@ Once `dev` or `build` npm-script is executed, the `dist` folder will be generate ```typescript // Defined in the window interface Window { - fs: typeof import("fs") - ipcRenderer: import("electron").IpcRenderer + fs: typeof import("fs") + ipcRenderer: import("electron").IpcRenderer } ``` @@ -115,18 +115,18 @@ Once `dev` or `build` npm-script is executed, the `dist` folder will be generate ```js export default { - build: { - // built lib for Main-process, Preload-script - lib: { - entry: "index.ts", - formats: ["cjs"], - fileName: () => "[name].js", - }, - rollupOptions: { - // configuration here - external: ["serialport", "sqlite3"], - }, - }, + build: { + // built lib for Main-process, Preload-script + lib: { + entry: "index.ts", + formats: ["cjs"], + fileName: () => "[name].js", + }, + rollupOptions: { + // configuration here + external: ["serialport", "sqlite3"], + }, + }, } ``` diff --git a/src/main/index.ts b/src/main/index.ts index 7f54791..ecd6f7d 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -38,9 +38,9 @@ async function createWindow() { // Make all links open with the browser, not with the application win.webContents.setWindowOpenHandler(({ url }) => { - if (url.startsWith('https:')) shell.openExternal(url) - return { action: 'deny' } - }) + if (url.startsWith('https:')) shell.openExternal(url) + return { action: 'deny' } + }) } app.whenReady().then(createWindow) diff --git a/src/renderer/index.html b/src/renderer/index.html index c2f5171..41fece5 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -5,9 +5,9 @@ + http-equiv="Content-Security-Policy" + content="script-src 'self' 'unsafe-inline';" + />
Hello Electron + Vite + React!
-- -
-
- Edit App.tsx
and save to test HMR updates.
-
src/renderer/public
folder
- Hello Electron + Vite + React!
++ +
+
+ Edit App.tsx
and save to test HMR updates.
+
src/renderer/public
folder
+