"wasp compile" is not documented or I'm missing something?

Hi, I was messing on Wasp CLI internals earlier, and I found there is a command called compile https://github.com/wasp-lang/wasp/blob/53ee9297f9c781bd82453d5364c64272d1f33911/waspc/cli/exe/Main.hs#L46 but I don't see it being documented on cli --help page nor here https://wasp-lang.dev/docs/cli#. Is it the same as wasp start minus the running web server part?
24 Replies
shayne
shayne•2y ago
Hi @Deleted User you are correct, and that is something I hadn't noticed. wasp compile simply (re-)compiles/generates your entire Wasp project (which spits it out into the .wasp/out dir you may have noticed). It is used by wasp start, amongst other commands, as the build step. wasp start will also watch your project tree, and then automatically call compile anytime a file changes. You can call wasp compile in your terminal if you just want to quickly check something, but in general, wasp start should be the main go to when developing Wasp apps. We use wasp compile more when building Wasp features so we can see what the generated output dir looks like periodically. Do you have a use case for calling/documenting it? Or mainly was just curious about what it does?
Deleted User
Deleted UserOP•2y ago
ah i see. oh yeah, I was curious about this command because I found that the rests of the commands are documented..so I thought it is being called by something somewhere..which I didn't know what to be exact thx for the info!
martinsos
martinsos•2y ago
Good one @Deleted User and as @shayne said, it is not documented on purpose: I added it some time ago because I found it useful in some situations for debugging / testing, but decided not to document it since typical users normally won't need it. But I thought leaving it undocumented can't hurt anybody. I am interested, what have you been playing with, how is that going?
Deleted User
Deleted UserOP•2y ago
@martinsos Oh! I'm just trying to replace most part of CLI commands with optparse-applicative because I want fish shell autocompletion. I stumbled on the compile command in the process and was curious where it's actually being used I'm not using it directly..so i think it's fine if it's left being documented..but more doc won't hurt either
martinsos
martinsos•2y ago
Oh nice, well we actually have an issue open for using optparse-applicative -> do you plan to create a PR with these changes once you are done? If so, that would be awesome / very helpful!
Deleted User
Deleted UserOP•2y ago
I'm glad to. In fact, I already am - https://github.com/wasp-lang/wasp/pull/1202 i just need to refine it more and understand how these commands works
martinsos
martinsos•2y ago
Oh wow awesome, ok looking forward to checking that out thorougly once it is not a draft anymore -> in the meantime, if you have any questions about the commands, feel free to ask us, will be happy to clarify stuff!
Deleted User
Deleted UserOP•2y ago
thank you! I surely will. Also, I'd actually wanted to ask about the completion commands. Do we still need it if we got auto-completion for free from https://hackage.haskell.org/package/optparse-applicative-0.17.0.0#bash-zsh-and-fish-completions
Hackage
optparse-applicative
Utilities and combinators for parsing command line options
martinsos
martinsos•2y ago
I am not 100% sure, but based on what you just shared, it sounds like we will not need it anymore. Actually, we won't need wasp completion:generate, because optparse will provide --bash-completion-script, --zsh-completion-script and so on, that do the same thing as completion:generate. I would probably still keep wasp completion because it is a good place to provide instructions to user on how to get completion -> we would inform them there about --bash-completion-script and other flags, and how to use them. I would also maybe consider having wasp completion:generate:bash instead of wasp --bash-completion-script, because I like that naming scheme better (I am not fan of using flags for stuff that are really commands and not options), I am not sure how hard is that to do with optparse though.
Deleted User
Deleted UserOP•2y ago
if that's the case, then I would try to implement wasp completion for doc purposes and wasp completion:generate:*sh using optparse too. I'm sure there's a public function somewhere to generate them from Haskell code. If none of that exists, I could try calling the flag programmatically instead by using the shell (need research). The only downside to this that I'm aware of is, the generation code need to be updated in case optparse includes new shell support, such as - https://github.com/pcapriotti/optparse-applicative/pull/420/files
martinsos
martinsos•2y ago
That sounds like the right approach to me! You are right, we rely on how optparse does shell support, but I think that is fine, we need to document it anyway for users, we can't expect them to know what optparse works like, so that is unavoidable. And of course we have version of optparse fixed in our deps. The only thing that would be "ugly" is that compiler wouldn't catch this part of optparse API changing if we update optparse version -> but maybe there is a way to ask optparse to provide names of those flags via its Haskell API?
Deleted User
Deleted UserOP•2y ago
I see. I tried looking for the flag names in the docs, but couldn't find any of the sort unless I'm missing something (as always).
martinsos
martinsos•2y ago
Hmmm, well might be they don't have it hm, although that is not great on their side
Deleted User
Deleted UserOP•2y ago
also, sadly I don't think there's any exposed API to get the shell completion script text. I've opened a PR to make them public - https://github.com/pcapriotti/optparse-applicative/pull/472 until that's sorted out..we could just copy paste those script text or go with the invoking by shell
martinsos
martinsos•2y ago
Sounds good then!
Deleted User
Deleted UserOP•2y ago
alright! :boi:
martinsos
martinsos•2y ago
awesome, thanks for this and I am excited to see how ti turns out :)! If you need early PR review we can also do that, otherwise we can do it once it is out of draft, whatever you feel like.
Deleted User
Deleted UserOP•2y ago
I would be really happy if you could do early review of it so I can fix them before it's actually ready. Large part of the PR is already done (including parser tests) minus the completion stuff. Only few of text formatting in db migrate-dev help prompt and missing colors are left to be done.
martinsos
martinsos•2y ago
Sounds good, we can do it soon! We will most likely get to it in the next couple of days so you can keep working and expect review to happen in the meantime 🙂
Deleted User
Deleted UserOP•2y ago
hi again! sorry for bothering you with completion stuff (again). 👉 👈 I noticed that all the commands use x y z format. Is there any particular reason why we use x:y:z for completion instead?
MEE6
MEE6•2y ago
Wohooo @Deleted User, you just became a Waspeteer level 3!
martinsos
martinsos•2y ago
Good question -> I think that was just me having some kind of weird ideas hehe, probably best to drop that and go with the normal x y z :). Btw I am reviewing your PR today, so expect initial round of comments soon!
Konwea
Konwea•2y ago
@martinsos hi i would you to review my PR, i'm new to open source contributions and i spotted wasp as a good project to contribute to. i noticed the tutorial link in the contributing.md file is broken and i fixed it. i would really love your feedback!! thanks
martinsos
martinsos•2y ago
Sure, will check it out!
Want results from more Discord servers?
Add your server