update examples cache: use tropohouse path and handle write failures gracefully

This commit is contained in:
Nacho Codoñer
2026-03-26 15:58:16 +01:00
parent 33f33c98e8
commit 2bb34d4e96

View File

@@ -26,7 +26,8 @@ function validateExamplesData(data, { warn = (msg) => Console.warn(msg) } = {})
}
function getCachePath() {
return files.pathJoin(files.getHomeDir(), '.meteor', 'examples-cache.json');
var tropohouse = require('../packaging/tropohouse.js');
return files.pathJoin(tropohouse.default.root, 'examples-cache.json');
}
function readCache() {
@@ -41,8 +42,12 @@ function readCache() {
}
function writeCache(data) {
const cachePath = getCachePath();
files.writeFile(cachePath, JSON.stringify(data, null, 2), 'utf8');
try {
const cachePath = getCachePath();
files.writeFile(cachePath, JSON.stringify(data, null, 2), 'utf8');
} catch (e) {
// Don't fail the command if it can't write
}
}
async function fetchExamplesJson() {