Add contents to .index.json in package (per update to spec)
This commit is contained in:
parent
3ee52938d6
commit
064c4ce896
|
@ -179,7 +179,7 @@ public class NpmPackage {
|
|||
}
|
||||
|
||||
public boolean readIndex(JsonObject index) {
|
||||
if (!index.has("index-version") || (index.asInteger("index-version") != 1)) {
|
||||
if (!index.has("index-version") || (index.asInteger("index-version") != NpmPackageIndexBuilder.CURRENT_INDEX_VERSION)) {
|
||||
return false;
|
||||
}
|
||||
this.index = index;
|
||||
|
|
|
@ -18,12 +18,13 @@ import org.hl7.fhir.utilities.json.parser.JsonParser;
|
|||
*/
|
||||
public class NpmPackageIndexBuilder {
|
||||
|
||||
public static final Integer CURRENT_INDEX_VERSION = 2;
|
||||
private JsonObject index;
|
||||
private JsonArray files;
|
||||
|
||||
public void start() {
|
||||
index = new JsonObject();
|
||||
index.add("index-version", 1);
|
||||
index.add("index-version", CURRENT_INDEX_VERSION);
|
||||
files = new JsonArray();
|
||||
index.add("files", files);
|
||||
}
|
||||
|
@ -56,6 +57,9 @@ public class NpmPackageIndexBuilder {
|
|||
if (json.hasPrimitive("supplements")) {
|
||||
fi.add("supplements", json.asString("supplements"));
|
||||
}
|
||||
if (json.hasPrimitive("content")) {
|
||||
fi.add("content", json.asString("content"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error parsing "+name+": "+e.getMessage());
|
||||
|
|
Loading…
Reference in New Issue