Created
August 10, 2021 22:30
-
-
Save revanth0212/ebc634435eb37bc3e68f1af543f42da9 to your computer and use it in GitHub Desktop.
While using PWA Studio's scaffolding command if you run into any errors or if you notice the command using old packages, run this file to clear your cache and try again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
const os = require("os"); | |
const { promisify } = require("util"); | |
const exec = promisify(require("child_process").exec); | |
const temptdir = os.tmpdir(); | |
if (fs.existsSync(`${temptdir}/@magento`)) { | |
fs.rmdirSync(`${temptdir}/@magento`, { recursive: true }); | |
console.log("Done cleaning node cache"); | |
} else { | |
console.log("No cached node packages to clear"); | |
} | |
exec("yarn cache clean") | |
.then(() => { | |
console.log("Done cleaning yarn cache"); | |
}) | |
.catch((err) => { | |
console.log("No cached yarn packages to clear"); | |
console.log(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run
node pwaCacheClean.js