Last active
July 18, 2018 03:07
-
-
Save sporto/87a50c4a6fa136b887e8c795a45c4925 to your computer and use it in GitHub Desktop.
Compare timestamps of elmi files
This file contains 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
/* | |
This script compares timestamp of elmi files | |
To try getting files that take a long time to compile | |
But this attempt has proven very useful | |
*/ | |
var fs = require("fs") | |
var path = require("path") | |
var dir = "./elm-stuff/build-artifacts/0.18.0/Versent/stax/1.0.0/"; | |
var files = fs.readdirSync(dir); | |
var wantedExtension = ".elmi" | |
var previousTime = 0 | |
function getFileTime(name) { | |
return fs.statSync(dir + name).mtime.getTime() | |
} | |
files.sort(function(a, b) { | |
return getFileTime(a) - getFileTime(b); | |
}); | |
files = files.filter(function(name) { | |
var ext = path.extname(name) | |
return ext == wantedExtension | |
}) | |
files.forEach(function(name) { | |
var time = getFileTime(name) | |
var thisTime = time - previousTime | |
if (thisTime > 800) console.log(name, thisTime) | |
previousTime = time | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment