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

Use file's created time to print build error message #74

Merged
merged 1 commit into from
Jun 14, 2019
Merged
Changes from all 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
6 changes: 3 additions & 3 deletions scripts/build-tries.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}),
};
Expand All @@ -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
Expand Down