Skip to content

Commit

Permalink
potential resolutions for the 4001 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shogunpurple committed Nov 5, 2020
1 parent c9695fc commit 6e02f1f
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 14 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"eslint-plugin-cypress": "^2.11.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-svelte3": "^2.7.3",
"kill-port": "^1.6.1",
"lerna": "3.14.1",
"prettier": "^1.19.1",
"prettier-plugin-svelte": "^1.4.0",
Expand All @@ -24,7 +25,8 @@
"restore": "npm run clean && npm run bootstrap && npm run build",
"nuke": "rimraf ~/.budibase && npm run restore",
"clean": "lerna clean",
"dev": "node ./scripts/symlinkDev.js && lerna run --parallel dev:builder",
"kill-port": "kill-port 4001",
"dev": "npm run kill-port && node ./scripts/symlinkDev.js && lerna run --parallel dev:builder --concurrency 1",
"test": "lerna run test",
"lint": "eslint packages",
"lint:fix": "eslint --fix packages",
Expand All @@ -35,4 +37,4 @@
"dependencies": {
"@fortawesome/fontawesome": "^1.1.8"
}
}
}
1 change: 1 addition & 0 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"electron-is-dev": "^1.2.0",
"electron-unhandled": "^3.0.2",
"electron-updater": "^4.3.1",
"electron-util": "^0.14.2",
"fix-path": "^3.0.0",
"fs-extra": "^8.1.0",
"handlebars": "^4.7.6",
Expand Down
2 changes: 0 additions & 2 deletions packages/server/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ const server = http.createServer(app.callback())

server.on("close", () => console.log("Server Closed"))

process.on("SIGINT", () => process.exit(1))

module.exports = server.listen(env.PORT || 4001, () => {
console.log(`Budibase running on ${JSON.stringify(server.address())}`)
automations.init()
Expand Down
23 changes: 17 additions & 6 deletions packages/server/src/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const unhandled = require("electron-unhandled")
const { existsSync } = require("fs-extra")
const initialiseBudibase = require("./utilities/initialiseBudibase")
const { budibaseAppsDir } = require("./utilities/budibaseDir")
const { openNewGitHubIssue, debugInfo } = require("electron-util")

const budibaseDir = budibaseAppsDir()
const envFile = join(budibaseDir, ".env")
Expand All @@ -18,11 +19,18 @@ async function startApp() {
delete require.cache[require.resolve("./environment")]
require("dotenv").config({ path: envFile })

if (isDev) {
unhandled({
showDialog: true,
})
}
unhandled({
showDialog: true,
reportButton: error => {
openNewGitHubIssue({
user: "Budibase",
repo: "budibase",
body: `### Error that occurred when using the budibase builder:\n\`\`\`\n${
error.stack
}\n\`\`\`\n### Operating System Information:\n---\n\n${debugInfo()}`,
})
},
})

const APP_URL = "http://localhost:4001/_builder"
const APP_TITLE = "Budibase Builder"
Expand Down Expand Up @@ -59,7 +67,10 @@ async function startApp() {
app.on("window-all-closed", () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== "darwin") app.quit()
if (process.platform !== "darwin") {
app.server.close()
app.quit()
}
})

app.on("activate", () => {
Expand Down
Loading

0 comments on commit 6e02f1f

Please sign in to comment.