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): Delete babel and terser cache dirs #26053

Merged
merged 9 commits into from
Jul 29, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"fast-levenshtein": "^2.0.6",
"file-loader": "^1.1.11",
"fs-exists-cached": "1.0.0",
"find-cache-dir": "^3.3.1",
"fs-extra": "^8.1.0",
"gatsby-cli": "^2.12.67",
"gatsby-core-utils": "^1.3.14",
Expand Down
13 changes: 12 additions & 1 deletion packages/gatsby/src/commands/clean.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from "fs-extra"
import path from "path"
import findCacheDir from "find-cache-dir"

import {
userPassesFeedbackRequestHeuristic,
Expand All @@ -10,7 +11,17 @@ import { IProgram } from "./types"
module.exports = async function clean(program: IProgram): Promise<void> {
const { directory, report } = program

const directories = [`.cache`, `public`]
const directories = [
`.cache`,
`public`,
// Ensure we clean babel loader cache
findCacheDir({
pieh marked this conversation as resolved.
Show resolved Hide resolved
name: `babel-loader`,
}),
findCacheDir({
name: `terser-webpack-plugin`,
}),
].filter(Boolean)

report.info(`Deleting ${directories.join(`, `)}`)

Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10025,7 +10025,7 @@ find-cache-dir@^2.0.0, find-cache-dir@^2.1.0:
make-dir "^2.0.0"
pkg-dir "^3.0.0"

find-cache-dir@^3.0.0:
find-cache-dir@^3.0.0, find-cache-dir@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880"
integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==
Expand Down