Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

The plan

Manav Rathif7b7bae0af42
diff --git a/web/packages/next/next.config.base.js b/web/packages/next/next.config.base.js
index 812ed7618d..ce1005e11b 100644
--- a/web/packages/next/next.config.base.js
+++ b/web/packages/next/next.config.base.js
@@ -12,6 +12,7 @@
const cp = require("child_process");
const os = require("os");
+const path = require("path");
/**
* Return the current commit ID if we're running inside a git repository.
@@ -39,6 +40,30 @@ const gitSHA = () => {
return result ? result : undefined;
};
+/**
+ * The name of the Ente app we're building.
+ *
+ * This is taken from the name of the directory which we're building. e.g. `yarn
+ * dev:auth` will cause yarn to be invoked in `web/apps/auth`, and so this will
+ * be set to `auth`.
+ *
+ * In our runtime code, all references to `process.env.appName` will be
+ * statically replaced by this value at build time.
+ */
+const appName = path.basename(process.cwd());
+
+/**
+ * "1" if we're building our desktop app.
+ *
+ * The _ENTE_IS_DESKTOP environment variable will be set by the yarn script that
+ * builds the web app for embedding in the desktop app. Whenever it is set, we
+ * set this value to "1".
+ *
+ * In our runtime code, all references to `process.env.isDesktop` will be
+ * statically replaced by this value at build time.
+ */
+const isDesktop = process.env._ENTE_IS_DESKTOP ? "1" : "";
+
/**
* Configuration for the Next.js build
*
@@ -57,9 +82,11 @@ const nextConfig = {
// available as `process.env.VAR_NAME` to our code.
env: {
GIT_SHA: gitSHA(),
+ appName,
+ isDesktop,
},
- // Customize the webpack configuration used by Next.js
+ // Customize the webpack configuration used by Next.js.
webpack: (config, { isServer }) => {
// https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6j
if (!isServer) {