From 2acb5559dccc9687f8fab4d78ba72eddabca4e42 Mon Sep 17 00:00:00 2001 From: amrit Date: Tue, 15 Oct 2024 15:05:26 +0530 Subject: [PATCH] refactor: improve variable logic (#17086) * Improve app processing with async/await and dynamic imports, also fix eslint errors. * refactor * added back a comment --- packages/app-store-cli/src/build.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/app-store-cli/src/build.ts b/packages/app-store-cli/src/build.ts index 91c461b548..d8f1e3bbaa 100644 --- a/packages/app-store-cli/src/build.ts +++ b/packages/app-store-cli/src/build.ts @@ -13,10 +13,7 @@ import type { AppMeta } from "@calcom/types/App"; import { APP_STORE_PATH } from "./constants"; import { getAppName } from "./utils/getAppName"; -let isInWatchMode = false; -if (process.argv[2] === "--watch") { - isInWatchMode = true; -} +const isInWatchMode = process.argv[2] === "--watch"; const formatOutput = (source: string) => prettier.format(source, { @@ -24,14 +21,10 @@ const formatOutput = (source: string) => ...prettierConfig, }); -const getVariableName = function (appName: string) { - return appName.replace(/[-.]/g, "_"); -}; +const getVariableName = (appName: string) => appName.replace(/[-.]/g, "_"); -const getAppId = function (app: { name: string }) { - // Handle stripe separately as it's an old app with different dirName than slug/appId - return app.name === "stripepayment" ? "stripe" : app.name; -}; +// INFO: Handle stripe separately as it's an old app with different dirName than slug/appId +const getAppId = (app: { name: string }) => (app.name === "stripepayment" ? "stripe" : app.name); type App = Partial & { name: string;