diff --git a/.github/workflows/build-remote.js b/.github/workflows/build-remote.js index 155fdb7d..2eaec0c9 100644 --- a/.github/workflows/build-remote.js +++ b/.github/workflows/build-remote.js @@ -11,6 +11,27 @@ const UI_FRAMEWORK = process.env.UI_FRAMEWORK; const USER_AGENT = process.env.CI_USER_AGENT; const FRAMEWORK = process.env.FRAMEWORK; +const getExampleProjectFromAnswers = (framework, uiFramework) => { + console.log("framework", framework); + if (framework === "vite") { + const uiFrameworkToExampleMap = { + antd: "antd-example", + mui: "mui-example", + no: "headless-example", + }; + + return { + [uiFrameworkToExampleMap[uiFramework]]: + uiFrameworkToExampleMap[uiFramework], + }; + } + + return { + [uiFramework === "no" ? "inferencer-headless" : "inferencer"]: + uiFramework === "no" ? "inferencer-headless" : "inferencer", + }; +}; + const buildRemote = async () => { const dataProviderMap = { "custom-json-rest": ["keycloak", "custom"], @@ -22,12 +43,6 @@ const buildRemote = async () => { hasura: ["keycloak", "custom"], }; - const uiFrameworkToExampleMap = { - antd: "antd-example", - mui: "mui-example", - no: "headless-example", - }; - let AUTH_PROVIDER = dataProviderMap[DATA_PROVIDER]; if (Array.isArray(AUTH_PROVIDER)) { @@ -53,8 +68,7 @@ const buildRemote = async () => { icon: "refine.svg", "data-provider": `data-provider-${DATA_PROVIDER}`, "ui-framework": UI_FRAMEWORK, - [uiFrameworkToExampleMap[UI_FRAMEWORK]]: - uiFrameworkToExampleMap[UI_FRAMEWORK], + ...getExampleProjectFromAnswers(FRAMEWORK, UI_FRAMEWORK), "auth-provider": `auth-provider-${AUTH_PROVIDER}`, [`i18n-${UI_FRAMEWORK}`]: FRAMEWORK === "vite" diff --git a/.github/workflows/build-template.js b/.github/workflows/build-template.js index 36cb2d1e..b35d69ca 100644 --- a/.github/workflows/build-template.js +++ b/.github/workflows/build-template.js @@ -18,6 +18,27 @@ const randomString = (length) => { return result; }; +const getExampleProjectFromAnswers = (framework, uiFramework) => { + console.log("framework", framework); + if (framework === "vite") { + const uiFrameworkToExampleMap = { + antd: "antd-example", + mui: "mui-example", + no: "headless-example", + }; + + return { + [uiFrameworkToExampleMap[uiFramework]]: + uiFrameworkToExampleMap[uiFramework], + }; + } + + return { + [uiFramework === "no" ? "inferencer-headless" : "inferencer"]: + uiFramework === "no" ? "inferencer-headless" : "inferencer", + }; +}; + const buildTemplate = async () => { const dataProviderMap = { "custom-json-rest": ["keycloak", "custom"], @@ -29,12 +50,6 @@ const buildTemplate = async () => { hasura: ["keycloak", "custom"], }; - const uiFrameworkToExampleMap = { - antd: "antd-example", - mui: "mui-example", - no: "headless-example", - }; - let AUTH_PROVIDER = dataProviderMap[DATA_PROVIDER]; if (Array.isArray(AUTH_PROVIDER)) { @@ -61,8 +76,7 @@ const buildTemplate = async () => { icon: "refine.svg", "data-provider": `data-provider-${DATA_PROVIDER}`, "ui-framework": UI_FRAMEWORK, - [uiFrameworkToExampleMap[UI_FRAMEWORK]]: - uiFrameworkToExampleMap[UI_FRAMEWORK], + ...getExampleProjectFromAnswers(FRAMEWORK, UI_FRAMEWORK), "auth-provider": `auth-provider-${AUTH_PROVIDER}`, [`i18n-${UI_FRAMEWORK}`]: FRAMEWORK === "vite"