-
Notifications
You must be signed in to change notification settings - Fork 3
Trying to figure out the best API #1
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
Comments
"Clumsiest but safest is to just have a central site where you can share presets but you have to manually copy to them to your local machine" If there's a central site, it could have an api. So maybe the presets get saved there and can be installed with something like mise:install-preset artisan-build/set-up-pint Then the preset gets pulled down and stored where it needs to be. |
Oh, that's a clever way to handle it. So it's not installing directly from the repo, but instead forcing you to look at it, make sure you like it, etc. Maybe even forces you to look at the code before you accept it. |
Also a note: It's possible steps are PHP but recipes are yaml. Just curious whether yaml can actually be good enough to handle things like nested confirmation and taking user input. Probably not, tbh. |
Hey @mattstauffer, here’s my take! I put it in a separate Gist because it’s kinda long 😅 https://gist.github.com/nicodevs/0cfd8780d5bc952243fb31b07aae665c Thank you for reading! |
@nicodevs love the Lego it approach! - perhaps even these's steps curl -L https://mise.com/nicodevs/money-maker-api.txt -o recipe.sh
chmod +x recipe.sh
./recipe.sh could take the shape of a cli mise apply nicodevs/money-maker-api so that it's 2 tools
|
Hey guys, honored to join the discussion and look at Matt's idea! It reminded me of a
Also reminds me a bit of GitHub Actions (YAML, then?). But @nicodevs I like your approach of accessing a Bash file and executing what's inside. I think this idea would work best as a library of Bash scripts/recipes, because in reality most developers do exactly that: execute some scripts they have internally, prepared from experience with multiple projects. But if it's a public thing, then, as someone mentioned, the validation becomes a problem. Who would guarantee that those scripts wouldn't break anything? They may do it unintentionally, just by not following some latest convention or something. Similarly to community starter kits now: they are not checked/validated by core team (and they shouldn't do it, obviously), so who would be trusted that the starter kit is updated, secure, etc? Also, as the first MVP approach, maybe it's worth to just publish 10 random recipes on GitHub somewhere, that would paint the picture of real examples, and then people would get the idea and contribute? So, potentially, it's maybe even not that technical project about parsing YAML or something else, but rather an idea to gather Bash/other scripts used by people? Happy to discuss further. |
Thanks so much for writing that up! My thoughts:
|
There's actually a project out by my friend Josh which uses Comper's https://github.com/aniftyco/skeletor Part of the question of Mise is whether it can offer something that Skeletor doesn't.
Yah. That's why I like the idea of some official "steps" and also you can bring your own. We'll verify the official steps but nothing else.
I think that's a good idea. I still don't want them as Bash, though lol. |
I think Skeletor is currently a useful tool, albeit new and in progress, for holding on to your recipe you want to always run when you spin up a new app. It's very similar to Lambo's post-install recipes in that way. There are two things I am excited about that Mise offers:
|
Yeah I get the idea now: you're going for scenarios/recipes more complex than just a one-liner to run some |
I only had a few minutes to work on this last week, but I started thinking about what the PHP shape would look like. Not done, but here's how far I made it: |
Anything that can make Starter kits even better, I'm on board with 👏 This sounds really exciting. I love the approach of providing developers with useful recipes. @PovilasKorop was right that it would be nice to see an example of a handful of recipes to get a clearer picture. I'm trying to envision other recipes 🤔 for instance, some of these might be features like:
The bigger mystery might be how each recipe would be applied/used. For instance, how would they interact with the I can't wait to see how this progresses 🤘 Really excited about it! Let me know if there's any way that I can help out. |
@tnylea So, most of these things would be steps or components, not recipes. Let's say you wanted to build a recipe that was a mega-starter-kit like the old Breeze. The recipe would prompt the user whether they want dark mode, and if so, take the dark mode Tailwind step. It'd ask if they want teams, and if so, take the teams step. etc. So in that way, Mise could distribute starter kit builders. The user would install Mise, and then run:
(we could even, if this was a common use case, have a Mise command that runs the But let's say you wanted to go the way starter kits are now: Just distributed repositories. So let's say one of the starter kits is the "Laravel with React, teams, and user impersonation" starter kit. Good luck keeping that, and 20 other starter kit repos, up to date with every new change to Laravel, right? But you could build a Mise recipe for each of those 20, and every time something happens (new tag, once a week, whatever), you re-build those repos using Mise and, if they're different, push and tag an update. In that case, there'd be a (CI?) build step somewhere that automatically runs Make sense? |
OK, new API point pulled from talking to Tony above:
So If I'm spinning up a new Laravel app using the "ai-chat" recipe: cd Sites
mise init myCleverAiAppName ai-chat or, if that doesn't feel good, maybe one has to be a param/flag. I dunno. If you want to do it the standard way, it's: cd Sites
laravel new myCleverAiAppName
cd myCleverAiAppName
mise apply ai-chat If you're a starter kit maintainer and you want to distribute this kit using the Laravel standard |
This comment got me thinking, suppose I maintain a package that lets users sign in with magic links. It would be awesome if I could publish a set of mise steps somewhere in the repo that handles installing the package, publishing the blade files, updating the User model, running the migrations, etc. Then a recipe author who wants to include my package could pull in the repo's steps with something like This would download the predefined steps to their local Steps directory and add the step calls to the likeBreezeButBetter recipe. |
Oh. The idea of a package publishing its preferred Mise steps in the repo is faassssscinating. I had previously been assuming, as in my Duster examples, that the package author would PR a Mise step to the Mise codebase. And that's still a strong option. But putting those steps directly in the repo is also very interesting, and maybe allows versioning in a different way? Let me think about it a bit! |
Talking with @PovilasKorop on a call, and we are brainstorming the first few recipes we should launch with:
I think the initial pitch is probably about using this as an installer you run on your local machine. composer global require tightenco/mise
cd Sites/
mise init myNewProject breeze composer global require tightenco/mise
cd Sites/
laravel new myProject
cd myProject
mise apply breeze We can deal with issues later of whether some recipes are hosted on a SaaS version, etc. |
I think the first version will not run composer global require tightenco/mise
cd Sites/
laravel new myProject
cd myProject
mise apply breeze |
Yep. It was a nightmare. |
@mattstauffer, totally makes sense. Thanks for clarifying. Do you envision that each of these will have |
@jonsugar man you are great. Can't wait to read it over. @tnylea Great question. It could go a few ways. It could be that someone has a React-specific recipe and it really only makes sense for React. OK. That's a React recipe. But let's someone else makes a recipe that either is very similar regardless of your frontend stack, or they're willing to do the work to maintain it despite there being huge differences between frontend stack. They certainly could publish a single recipe that asks the user which frontend stack they want, and takes different steps depending. |
@mattstauffer I love this general idea - I worked on something similar a few years back (around the time you were building Lambo), I still think the idea has legs. It leverages the idea of a 'compose' file that you define your steps in. The majority of the API lives in the link below, but the readme also has a good overview: (Forgive me Taylor for naming this Laravel Hub not Hub for Laravel - I was but a young new Artisan 🥲)
If you (or others) thinks the idea is aligned with your vision - would be happy to dust it off and add more details. :) |
@WyattCast44 I already responded on Twitter, but I like the idea! I think the main thing I want to think about is, and you can see me mention it above: is the choice to use a static configuration (Yaml) limiting when it comes to asking for user input or any other things that using PHP for config makes possible? I assume so, but curious whether you solved that problem. |
Jumping in here a bit in the middle of the discussion, but as far as the configuration language goes, I'd 100% be in favor of PHP. I have a handful of reasons:
Admittedly, these are just a handful of thoughts that have been bumping around in the back of my head for a few days, but hopefully they get the point across! Regardless of the direction, I think this is going to be an awesome project to have around 🎉 |
Just got off a call with @WyattCast44. He's been building something similar to this but YAML, which is limiting (no conditionals, etc.), but if we were to think YAML is good enough, he's already much further down this road, even has a rudimentary NovaPackages-style app for sharing configurations and favoring others. I think I feel safe to say:
Of our currently-discussed use cases, here's what you can't do with YAML:
He did mention that he can add conditionals within a step. So you could potentially have "do you want this or not" inside of a step, and then the yaml just says "run this step". So it would be a React starter kit, but then when you tell yaml to add the Teams step, the teams step's YAML config could have a "confirm" parameter, and if you set that to true, the step asks the user if they want to install teams. So we're getting some conditionality. I'm gonna think about this for a bit. |
We've talked a lot at Tighten and I think, despite wanting to not take on another project if I don't need to, Mise probably has legs. Excited to read through #3 and start digging into what the Mise app will look like. Plus this gives me an excuse to go domain shopping. Thanks for all your input, everyone! |
Big questions:
step('duster/install')
runsSteps/Duster/Install
PHP class?Copied from current README for context (so that future people looking at this can understand the state of thinking at the time of creation):
Vision
I imagine it'll look like this. Once Mise is installed globally with Composer, you'll install a new Laravel app:
Usage
laravel new money-maker cd money-maker
Then you can use Mise to apply presets:
Or you can use it interactively, where Prompts will let you choose which you want to apply:
How it would work
I can imagine Mise comes with predefined "steps"; for example, a step named "duster" could do the following:
composer rqeuire-dev tightenco/duster
./vendor/bin/duster github-actions
git add . && git commit -m "Install Duster"
./vendor/bin/duster fix
git add . && git commit -m "Run Duster"
The definition for this step would be built into code in Mise, using some combination of convenience helpers that make common tasks (e.g. "git commit with message", "composer require dev") easy; then presets would include this step.
How presets/recipes would be defined/loaded
Presets would be defined... that's the hard part. I know some can be defined in Mise. And I know some can be defined locally. But what is a safe way to define presets to be shared?
Also maybe some useful thing where you can set a configuration item so if you run
mise default
or something, it'll run a predefined set of presets, so you can say "all my new Laravel apps should have these three presets run" as your default.Building a step
OK, so I'm imagining a step is single file (?), either a PHP class or a procedural PHP file. It could be yaml, which would be cleaner, but wouldn't allow for arbitrary PHP. Maybe allow both?
Let's imagine
duster
is a step. Maybe this? Will keep working on the API...I can imagine we'll want tooling to create files, replace content in files, rename or move files. More Git tooling, more Composer tooling, NPM tooling.
Some of this will come from having a
filesystem
component directly available, and, of course, access to the entire Laravel world through the container. Some it'd be nice to have one-off commands or even little suites of tools (e.g thisgit
helper described above) to simplify some of the steps. I'll be looking to Lambo and Valet for at least some inspiration on those.Building a recipe/preset
Let's imagine we have a preset for creating a new Tighten SaaS. What steps do we want to take after
laravel new
?We could have it be a simple YML/JSON file... just with a list of steps... or it can be a PHP file so it can have standalone work outside of steps, or pass configuration items to steps?
I don't know if I want any steps to take user input, but if they can, doing it as a class would help that:
Reference
Composer
so I'll consider it a cousin :)The text was updated successfully, but these errors were encountered: