Add explicit --prod flag for rewatch commands#8347
Add explicit --prod flag for rewatch commands#8347JonoPrest wants to merge 4 commits intorescript-lang:masterfrom
--prod flag for rewatch commands#8347Conversation
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
Skip dev-dependencies and dev source folders (type: "dev") when --prod is passed, enabling production builds without dev tooling installed. Signed-Off-By: Jono Prest <jjprest@gmail.com>
90493c9 to
43caff0
Compare
| } | ||
|
|
||
| pub fn clean(path: &Path, show_progress: bool, plain_output: bool) -> Result<()> { | ||
| pub fn clean(path: &Path, show_progress: bool, plain_output: bool, prod: bool) -> Result<()> { |
There was a problem hiding this comment.
What would happen if I compile in normal mode, but clean in prod mode?
Are 'dev' packages left intact then? Do we want that behavior?
There was a problem hiding this comment.
Good point 🤔, I suppose if it doesn't require the dependency to be there then we can just clean everything
There was a problem hiding this comment.
Yes, we just ignore errors returned from remove_dir_all and remove_file while cleaning.
I think we can clean everything.
There was a problem hiding this comment.
I just tested, if you don't have the dev dep installed then the clean fails. It always needs to resolve dependencies. I don't think clean is really going to be used in this way so I'm happy to remove the prod flag from clean entirely. It's mainly for building. But I think it doesn't hurt to keep it and make it possible to run clean on a prod environment.
There was a problem hiding this comment.
Ok, thanks for testing! I am fine with this approach as well 👍
As per this discussion:
https://forum.rescript-lang.org/t/proposal-exclude-dev-sources-and-dev-dependencies-from-builds/7151