trunk icon indicating copy to clipboard operation
trunk copied to clipboard

Support workspaces and -p

Open ctron opened this issue 1 year ago • 8 comments

Coming out of a discussion on #670 … it might make more sense to support workspace projects and the ability to run trunk build -p frontend, which would:

  • Lookup the frontend crate inside the workspace
  • Then run trunk build/watch/serve --config <frontend>/Trunk.toml

ctron avatar Feb 19 '24 07:02 ctron

is this meaning that we can use workspace with multiple crates to reduce the compilation time?

Xu-Mj avatar Mar 17 '24 09:03 Xu-Mj

is this meaning that we can use workspace with multiple crates to reduce the compilation time?

You can already do that, assuming that workspace is an "all WASM" workspace. But you can split up your code like that already.

Even adding the ability to use -p when calling trunk would still mean that the workspaces needs to be compiled a second time for the "wasm" target. I guess this somehow also ties in #605. As it would make sense to a have different build profile for that part of the build.

ctron avatar Mar 17 '24 10:03 ctron

@ctron Do you have recommendations for the implementation?

This is now a high priority item for me, since most of the repos I work will workspace examples or demos.

Thanks!

nuzzles avatar Apr 19 '24 13:04 nuzzles

I would add a new --package argument to the CLI. There will be another discrepancy, as that's a clap only field, should be skipped from serde I guess.

And then, during the initialization of the configuration, perform the lookup, and change the base directory. Not actually change, but start processing with a different path.

ctron avatar Apr 19 '24 14:04 ctron

Something else that should come with this is that Trunk should detect changes in the workspace by default.

No need for a Trunk.toml or watch list addition to the parent and member packages.

nuzzles avatar May 03 '24 02:05 nuzzles