refactor: improve variable logic (#17086)

* Improve app processing with async/await and dynamic imports, also fix eslint errors.

* refactor

* added back a comment
This commit is contained in:
amrit
2024-10-15 06:35:26 -03:00
committed by GitHub
parent be1c6eb65c
commit 2acb5559dc
+4 -11
View File
@@ -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<AppMeta> & {
name: string;