Skip to content

Add explicit --prod flag for rewatch commands#8347

Open
JonoPrest wants to merge 4 commits intorescript-lang:masterfrom
JonoPrest:jono-prod-flag
Open

Add explicit --prod flag for rewatch commands#8347
JonoPrest wants to merge 4 commits intorescript-lang:masterfrom
JonoPrest:jono-prod-flag

Conversation

@JonoPrest
Copy link
Copy Markdown
Contributor

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 17, 2026

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8347

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8347

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8347

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8347

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8347

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8347

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8347

commit: 43caff0

@JonoPrest JonoPrest marked this pull request as ready for review April 18, 2026 13:35
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>
}

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<()> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point 🤔, I suppose if it doesn't require the dependency to be there then we can just clean everything

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we just ignore errors returned from remove_dir_all and remove_file while cleaning.
I think we can clean everything.

Copy link
Copy Markdown
Contributor Author

@JonoPrest JonoPrest Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for testing! I am fine with this approach as well 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants