Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brainstorming: Symfony Bundle #53

Open
tacman opened this issue May 20, 2023 · 4 comments
Open

Brainstorming: Symfony Bundle #53

tacman opened this issue May 20, 2023 · 4 comments

Comments

@tacman
Copy link
Contributor

tacman commented May 20, 2023

I'd like to run this script in my Symfony project, and trying to think of the best way to do it.

I'm wondering if this workflow would be appropriate:

composer install survos/meiliadmin-bundle

Add the default engine and api key

survos_meiliadmin:
    host: http://localhost:7700
    api_key: 2u24ksdafjj

The adjust the route if necessary, otherwise, open the symfony project project and go to /meiliadmin (or /admin/meili, especially if you have a route rule that block non-admins from that endpoint.

I think this will work, but I wonder in fact if it's the best way.

@kaermorchen
Copy link
Owner

You need the latest version (1.2), I have updated it today.

In dist folder you have index.html file.

index.html has special meta tag. You need to modify it.

<meta name="meiliadmin/config/environment" content="%7B%22modulePrefix%22%3A%22meiliadmin%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22history%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22meiliadmin%22%2C%22version%22%3A%220.0.0%2Bbd7f85d7%22%7D%7D">

The content attribute is just URL-encoded json and looks something like that:

{
  "modulePrefix": "meiliadmin",
  "environment": "production",
  "rootURL": "/",
  "locationType": "history",
  "EmberENV": {
    "FEATURES": {},
    " APPLICATION_TEMPLATE_WRAPPER": false,
    " DEFAULT_ASYNC_OBSERVERS": true,
    " JQUERY_INTEGRATION": false,
    " TEMPLATE_ONLY_GLIMMER_COMPONENTS": true
  },
  "APP": { 
    "name": "meiliadmin", 
    "version": "0.0.0+bd7f85d7" 
  }
}

Take you settings from survos_meiliadmin and add it to the APP section:

{
  "modulePrefix": "meiliadmin",
  "environment": "production",
  "rootURL": "/",
  "locationType": "history",
  "EmberENV": {
    "FEATURES": {},
    " APPLICATION_TEMPLATE_WRAPPER": false,
    " DEFAULT_ASYNC_OBSERVERS": true,
    " JQUERY_INTEGRATION": false,
    " TEMPLATE_ONLY_GLIMMER_COMPONENTS": true
  },
  "APP": { 
    "meilisearch": { "url": "http://localhost:7700", "key": "MASTER_KEY" },
    "name": "meiliadmin", 
    "version": "0.0.0+bd7f85d7" 
  }
}

And the app will take the settings from the APP.meilisearch field.

Also you can modify rootURL if you need subpath in url.

@tacman
Copy link
Contributor Author

tacman commented May 22, 2023

Thanks!

I'd like to avoid copying the compiled files into my bundle, but instead simply "install' them. Is there a yarn package that does that?

Again, I'm not even sure that's the approach. What I'm envisioning for the bundle is a very thin wrapper around your application. When the bundle installs, how should it get the code, besides extracting it from https://github.com/kaermorchen/meiliadmin/releases/download/v1.2.0/dist.tgz

@kaermorchen
Copy link
Owner

Try this in your bundle:

  1. Install this repo via composer, not like a composer package but like a git repo from github
  2. Build it with your settings
  3. Use the result from the dist folder

@kaermorchen
Copy link
Owner

I can publish this repo as a npm package, may it help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants