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

Add --disable-clear option #136

Merged
merged 11 commits into from
Jul 13, 2023
Merged

Conversation

simonhamp
Copy link
Contributor

@simonhamp simonhamp commented Jun 25, 2023

Edit by @jesseleite:
We decided to keep default functionality and add this as opt-in functionality via --disable-clear 👍


The SSG generate method currently always destroys all files on a run... this can become problematic when you're trying to figure out why certain pages are failing if it doesn't reliably generate all pages on each run

This won't necessarily save much time yet, as it will still process all entries and other URLs and try to write the final copies to disk... but if you have other steps in your build process and don't want to always start from scratch, this allows you that flexibility

NB: This changes the default behaviour. If you want to maintain the old behaviour, you have to pass --fresh on the CLI

This is somewhat related to #135 as non-deterministic builds are tricky to manage

Keep it all consistent
Save polluting the generate method parameters. Should make merging easier
@simonhamp simonhamp changed the title Add fresh option Add fresh option Jun 25, 2023
@simonhamp simonhamp changed the title Add fresh option Add --fresh option Jun 25, 2023
@jesseleite
Copy link
Member

This is somewhat related to #135 as non-deterministic builds are tricky to manage

Curious what you mean here?

@simonhamp
Copy link
Contributor Author

Curious what you mean here?

Basically some of this stuff came out of me trying to use the SSG incrementally. The reason I was wanting to do that is because it was failing in ways that were hard to investigate (minimal output, especially when running multiple threads).

I needed a way for it to run deterministically multiple times without wiping everything out - that way I could eventually get it to run to completion.

(I believe my problems related specifically to rendering images in Glide - I'm using Spatie's Responsive Images addon) and it doesn't play particularly nicely with the SSG in my setup)

This PR came out of that but isn't directly related to trying to solve those issues - I think this is useful aside of those issues.

Though you may want to maintain current behaviour (where ssg:generate deletes all files in the build folders and starts from scratch every time) and the flag be the thing that prevents that... so maybe something like --gentle instead

@jesseleite
Copy link
Member

For sure, but after an internal discussion we want to keep clearDirectory() as default behaviour. We're definitely open to an inverse flag though, maybe something like --disable-clear?

@simonhamp
Copy link
Contributor Author

Makes sense. I'll rework this after Laracon 😉

@jesseleite jesseleite changed the title Add --fresh option Add --disable-clear option Jul 13, 2023
@jesseleite
Copy link
Member

All good, I gotchyoo. Just going to add a test here once #140 gets merged, as I added some basic generator test coverage over there 👍

@jesseleite jesseleite marked this pull request as draft July 13, 2023 14:18
@jesseleite jesseleite marked this pull request as ready for review July 13, 2023 18:29
@jasonvarga jasonvarga merged commit 87c5909 into statamic:master Jul 13, 2023
13 checks passed
thomaskenne pushed a commit to thomaskenne/ssg that referenced this pull request Feb 10, 2024
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.

None yet

3 participants