Skip to content

Commit c13f30d

Browse files
committed
feat(generator): remove old electron patches
1 parent 3774248 commit c13f30d

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

generator/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ module.exports = (api, options = {}) => {
2727
if (!hasBackground) {
2828
// If user does not have a background file it should be created
2929
api.render('./templates/base', {
30-
// Scheme registration changed in Electron 5.0.0
31-
newSchemeRegistrationFunction: semver.gte(
32-
(electronVersion || pkg.devDependencies.electron).replace('^', ''),
33-
'5.0.0'
34-
),
3530
devtoolsExtensionsBroken
3631
})
3732
}

generator/templates/base/src/background.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,21 @@ const isDevelopment = process.env.NODE_ENV !== 'production'
1212
let win
1313

1414
// Scheme must be registered before the app is ready
15-
<% if (newSchemeRegistrationFunction) { %>protocol.registerSchemesAsPrivileged([{scheme: 'app', privileges: { secure: true, standard: true } }])
16-
<% } else { %>protocol.registerStandardSchemes(['app'], { secure: true })
17-
<% } %>
18-
function createWindow () {
15+
protocol.registerSchemesAsPrivileged([
16+
{ scheme: 'app', privileges: { secure: true, standard: true } }
17+
])
18+
19+
function createWindow() {
1920
// Create the browser window.
20-
win = new BrowserWindow({ width: 800, height: 600, webPreferences: {
21-
// Use pluginOptions.nodeIntegration, leave this alone
22-
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
23-
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION
24-
} })
21+
win = new BrowserWindow({
22+
width: 800,
23+
height: 600,
24+
webPreferences: {
25+
// Use pluginOptions.nodeIntegration, leave this alone
26+
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
27+
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION
28+
}
29+
})
2530

2631
if (process.env.WEBPACK_DEV_SERVER_URL) {
2732
// Load the url of the dev server if in development mode
@@ -84,7 +89,7 @@ app.on('ready', async () => {
8489
// Exit cleanly on request from parent process in development mode.
8590
if (isDevelopment) {
8691
if (process.platform === 'win32') {
87-
process.on('message', data => {
92+
process.on('message', (data) => {
8893
if (data === 'graceful-exit') {
8994
app.quit()
9095
}

0 commit comments

Comments
 (0)