From 23ca419fc760a7ada4fe5f8dba9d777c7860f2ec Mon Sep 17 00:00:00 2001 From: Dmitry Baranov Date: Fri, 14 Jun 2019 19:38:31 +0300 Subject: [PATCH] Use file's created time to print build error message (#74) --- scripts/build-tries.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/build-tries.js b/scripts/build-tries.js index 4e8cbc4..617688f 100644 --- a/scripts/build-tries.js +++ b/scripts/build-tries.js @@ -59,7 +59,6 @@ got(PUBLIC_SUFFIX_URL, {timeout: 60 * 1000}) return { path: path.resolve(triesPath, trie.filename), content: JSON.stringify({ - updatedAt: new Date().toISOString(), trie: serializeTrie(parsedList, trie.type), }), }; @@ -85,9 +84,10 @@ got(PUBLIC_SUFFIX_URL, {timeout: 60 * 1000}) console.error(""); console.error(`Could not update list of known top-level domains for parse-domain because of "${err.message}"`); - const prebuiltList = JSON.parse(fs.readFileSync(path.resolve(triesPath, tries[0].filename), "utf8")); + const filePath = path.resolve(triesPath, tries[0].filename); + const fileCreatedTime = fs.statSync(filePath).birthtime; - console.error("Using possibly outdated prebuilt list from " + new Date(prebuiltList.updatedAt).toDateString()); + console.error("Using possibly outdated prebuilt list from " + new Date(fileCreatedTime).toDateString()); // We can recover using the (possibly outdated) prebuilt list, hence exit code 0 process.exit(0); // eslint-disable-line no-process-exit