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

fix(gatsby): better heuristic for automatic cache purging #27682

Merged
merged 1 commit into from
Oct 27, 2020

Conversation

vladar
Copy link
Contributor

@vladar vladar commented Oct 27, 2020

Description

A follow up for #27549. That PR didn't take into account that the .cache directory exists in develop by the moment we call initialize. In develop the .cache directory is actually created here:

const tmpFileName = tmp.tmpNameSync({
tmpdir: path.join(process.cwd(), `.cache`),
})
fs.outputFileSync(tmpFileName, this.script)

This PR uses a different heuristic to check for cache presence by just checking for .cache/json folder. We ensure this dir exists in the same initialize method, so it seems an appropriate target for this check:

await fs.ensureDirSync(`${cacheDirectory}/json`)

Related Issues

Fixes #27641

@vladar vladar requested a review from a team as a code owner October 27, 2020 10:10
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 27, 2020
@vladar vladar removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 27, 2020
@vladar vladar added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Oct 27, 2020
@gatsbybot gatsbybot merged commit a5665d2 into master Oct 27, 2020
@delete-merged-branch delete-merged-branch bot deleted the vladar/gh-27641 branch October 27, 2020 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gatsby develop falsly detects incomplete cache
3 participants