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

trunk serve --bin/--example #670

Open
simbleau opened this issue Jan 11, 2024 · 3 comments
Open

trunk serve --bin/--example #670

simbleau opened this issue Jan 11, 2024 · 3 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed needs design This item needs design work

Comments

@simbleau
Copy link
Member

Highly desired feature to include support for --bin (which would set data-bin on the index.html, unless already present) and --example.

@simbleau simbleau added help wanted Extra attention is needed good first issue Good for newcomers needs design This item needs design work labels Jan 11, 2024
@ctron
Copy link
Collaborator

ctron commented Feb 9, 2024

I took a brief look into this. And I am not sure this is achievable.

I personally would also like to to just run:

trunk serve --example foo

However, … --bin is already used for dealing with web-workers. Having the data-bin attribute you mentioned triggers this. And having a web-worker in the mix, the examples I saw make actual use of that. You have two data-bin with <link rel="rust">. Overriding that might make things just complex.

Which brings me to --example, I am not sure how that would properly with the web-worker example mentioned above. --bin in combination with --example might not lead to a sane environment.

So fiddling with this, I fear we would be breaking some things that work quite well at the moment.

On the other hand, back the --example case, I noticed that most projects anyway have a full cargo project for examples. So why not improve the situation of starting trunk with a different base directory?

So that one can do:

trunk serve example/foo

@simbleau
Copy link
Member Author

@ctron - Maybe we could prioritize workspaces over examples?

I believe it's an extremely common case to have a monorepo with a frontend and backend crate in a workspace, but having an index.html in the example folder might be difficult to make sense of since there's no standard way to handle this.

For example, trunk serve -p frontend could just be a syntax sugar for (essentially) cd frontend && trunk serve

@ctron
Copy link
Collaborator

ctron commented Feb 19, 2024

Maybe … however, so far (due to the way cargo works) we always ended up having the UI excluded from the main workspace. Still keeping things in the same repository.

Still, I do see the benefit of having -p foo for even more reasons. My hope would also be that this should be easier to implement, without breaking existing behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed needs design This item needs design work
Projects
None yet
Development

No branches or pull requests

2 participants