app-generator / free-site-builder

Free Site Builder - Open-Source Tool | Simpllo
https://www.simpllo.com
Other
295 stars 61 forks source link

[✅ASSIGNED] Builder InitParams: API_URL and UI Kit #79

Closed app-generator closed 1 year ago

app-generator commented 1 year ago

STATUS: ASSIGNED to @umarali

Context

In the current version, the URL of the backend and the UI Kit are both hardcoded. The DNDBuilder.setup() helper needs to be updated to allow the injection of the mentioned variable at runtime:

  <script type="module">
    import { DNDBuilder } from "./index";

    DNDBuilder.setup(BACKEND_URL='https://components-server.onrender.com/', UI_KIT='bs5');
    // Defaults:
    // BACKEND_URL=https://components-server.onrender.com/
    // UI_KIT=bs5
    DNDBuilder.render();
  </script>

The above variables are used to query the backend server, currently managed via ENV.

https://github.com/app-generator/free-site-builder/blob/main/src/main.ts

const BACKEND_URL = "https://components-server.onrender.com/";
const url = import.meta.env.VITE_BACKEND_URL
  ? import.meta.env.VITE_BACKEND_URL
  : BACKEND_URL;

const UI_KIT = "bs5";
const ui_kit = import.meta.env.VITE_UI_KIT
  ? import.meta.env.VITE_UI_KIT
  : UI_KIT;

@umarali please take a look.

TY!

umarali commented 1 year ago

I'd be glad to hear some feedback on the commits under branch fix-79 (3c57899). I'm sure there could be a better way.

app-generator commented 1 year ago

At first look works great. More tests tmrw. TY @umarali