[JavaScript] fix JS shell scripts, add log to show template version (#5907)

* fix JS shell script, add log to show es version

* change CLI option default value for useES6

* fix shell script in JS ES6 promise

* fix windows batch files

* set useES6 to false
This commit is contained in:
wing328
2017-06-23 22:09:07 +08:00
committed by GitHub
parent 69ce921371
commit 5b4e8a8ed5
9 changed files with 17 additions and 8 deletions

View File

@@ -2511,7 +2511,6 @@ public class DefaultCodegen {
}
} else {
LOGGER.info("proessing body parameter ...");
if (!(param instanceof BodyParameter)) {
LOGGER.error("Cannot use Parameter " + param + " as Body Parameter");
}

View File

@@ -96,7 +96,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
protected String modelDocPath = "docs/";
protected String apiTestPath = "api/";
protected String modelTestPath = "model/";
protected boolean useES6;
protected boolean useES6 = false; // default is ES5
public JavascriptClientCodegen() {
super();
@@ -197,7 +197,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
.defaultValue(Boolean.TRUE.toString()));
cliOptions.add(new CliOption(USE_ES6,
"use JavaScript ES6 (ECMAScript 6)")
.defaultValue(Boolean.TRUE.toString()));
.defaultValue(Boolean.FALSE.toString()));
}
@Override
@@ -268,6 +268,8 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
}
if (additionalProperties.containsKey(USE_ES6)) {
setUseES6(convertPropertyToBooleanAndWriteBack(USE_ES6));
} else {
setUseES6(false);
}
}
@@ -432,8 +434,10 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
this.useES6 = useES6;
if (useES6) {
embeddedTemplateDir = templateDir = "Javascript/es6";
LOGGER.info("Using JS ES6 templates");
} else {
embeddedTemplateDir = templateDir = "Javascript";
LOGGER.info("Using JS ES5 templates");
}
}