Merge pull request #717 from hapifhir/gg-202201-npm-path-fix

fix bug in package generator where files go in the wrong place
This commit is contained in:
Grahame Grieve 2022-01-18 08:25:59 +11:00 committed by GitHub
commit fec9f68c56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View File

@ -1,8 +1,9 @@
## Validator Changes
* fix inclusion of Java constants in CLI help text.
* fix bug on `-compile` output when using 'current' version.
* no changes
## Other code changes
n/a
* fix bug where generated packages have files in the wrong places
* fix inclusion of Java constants in CLI help text.
* fix bug on `-compile` output when using 'current' version.

View File

@ -80,14 +80,14 @@ public class NPMPackageGenerator {
private String getDirectory() {
switch (this) {
case RESOURCE: return "package/";
case EXAMPLE: return "example/";
case OPENAPI: return "openapi/";
case SCHEMATRON: return "xml/";
case RDF: return "rdf/";
case OTHER: return "other/";
case TEMPLATE: return "other/";
case JEKYLL: return "jekyll/";
case TOOL: return "bin/";
case EXAMPLE: return "package/example/";
case OPENAPI: return "package/openapi/";
case SCHEMATRON: return "package/xml/";
case RDF: return "package/rdf/";
case OTHER: return "package/other/";
case TEMPLATE: return "package/other/";
case JEKYLL: return "package/jekyll/";
case TOOL: return "package/bin/";
}
return "/";
}
@ -323,7 +323,7 @@ public class NPMPackageGenerator {
public void addFile(Category cat, String name, byte[] content) throws IOException {
String path = cat.getDirectory()+name;
if (path.length() > 100) {
name = name.substring(0, name.indexOf("-"))+"-"+UUID.randomUUID().toString();
name = name.substring(0, name.indexOf("-"))+"-"+UUID.randomUUID().toString()+".json";
path = cat.getDirectory()+name;
}