From 85bf27c17b0de5a1f5e1c80e47d3ce06b16b6904 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 15 Jul 2020 13:42:12 +0100 Subject: [PATCH] fixing dev path when running in electron --- packages/server/src/api/controllers/application.js | 2 +- packages/server/src/api/controllers/component.js | 1 + packages/server/src/api/index.js | 3 ++- packages/server/src/app.js | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js index 4caa64f5a7..fcc3bc0579 100644 --- a/packages/server/src/api/controllers/application.js +++ b/packages/server/src/api/controllers/application.js @@ -85,7 +85,7 @@ exports.create = async function(ctx) { await instanceController.create(createInstCtx) newApplication.instances.push(createInstCtx.body) - if (ctx.isDev) { + if (process.env.NODE_ENV !== "jest") { const newAppFolder = await createEmptyAppPackage(ctx, newApplication) await downloadExtractComponentLibraries(newAppFolder) } diff --git a/packages/server/src/api/controllers/component.js b/packages/server/src/api/controllers/component.js index 3d631bcaec..3f0326af4c 100644 --- a/packages/server/src/api/controllers/component.js +++ b/packages/server/src/api/controllers/component.js @@ -27,6 +27,7 @@ exports.fetchAppComponentDefinitions = async function(ctx) { const componentJson = require(join( appDirectory, componentLibrary, + "package", "components.json" )) diff --git a/packages/server/src/api/index.js b/packages/server/src/api/index.js index a2af19ae9e..cb31b0d6b8 100644 --- a/packages/server/src/api/index.js +++ b/packages/server/src/api/index.js @@ -43,7 +43,8 @@ router jwtSecret: env.JWT_SECRET, useAppRootPath: true, } - ctx.isDev = env.NODE_ENV !== "production" && env.NODE_ENV !== "jest" + ctx.isDev = + process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "jest" await next() }) .use(authenticated) diff --git a/packages/server/src/app.js b/packages/server/src/app.js index adf4c7e46d..3353ff76d0 100644 --- a/packages/server/src/app.js +++ b/packages/server/src/app.js @@ -28,6 +28,7 @@ app.context.eventEmitter = eventEmitter app.use(api.routes()) if (electron.app && electron.app.isPackaged) { + process.env.NODE_ENV = "production" Sentry.init() app.on("error", (err, ctx) => {