Add package use tracking to FHIR cache for validator.fhir.org

This commit is contained in:
Grahame Grieve 2023-10-20 16:32:16 +11:00
parent 7d15f271d0
commit 6a78fdd1e0
1 changed files with 5 additions and 0 deletions

View File

@ -242,6 +242,11 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
}
private NpmPackage loadPackageInfo(String path) throws IOException {
File f = new File(Utilities.path(path, "usage.ini"));
JsonObject j = f.exists() ? JsonParser.parseObject(f) : new JsonObject();
j.set("date", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
JsonParser.compose(j, f, true);
NpmPackage pi = minimalMemory ? NpmPackage.fromFolderMinimal(path) : NpmPackage.fromFolder(path);
return pi;
}