Skip to content

Commit

Permalink
Default import package.json for spec compatibility
Browse files Browse the repository at this point in the history
Co-authored-by: Raphael Varonos <r.varonos@gmail.com>
  • Loading branch information
trivikr and rvaronos committed Sep 8, 2020
1 parent 0dd8c14 commit 58f768a
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ final class RuntimeConfigGenerator {
writer.addDependency(TypeScriptDependency.AWS_SDK_UTIL_USER_AGENT_NODE);
writer.addImport("defaultUserAgent", "defaultUserAgent",
TypeScriptDependency.AWS_SDK_UTIL_USER_AGENT_NODE.packageName);
writer.addImport("name", "name", "./package.json");
writer.addImport("version", "version", "./package.json");
writer.write("defaultUserAgent: defaultUserAgent(name, version),");
writer.addImport("*", "packageInfo", "./package.json");
writer.write("defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),");
}
);
private final Map<String, Consumer<TypeScriptWriter>> browserRuntimeConfigDefaults = MapUtils.of(
Expand Down Expand Up @@ -163,9 +162,8 @@ final class RuntimeConfigGenerator {
writer.addDependency(TypeScriptDependency.AWS_SDK_UTIL_USER_AGENT_BROWSER);
writer.addImport("defaultUserAgent", "defaultUserAgent",
TypeScriptDependency.AWS_SDK_UTIL_USER_AGENT_BROWSER.packageName);
writer.addImport("name", "name", "./package.json");
writer.addImport("version", "version", "./package.json");
writer.write("defaultUserAgent: defaultUserAgent(name, version),");
writer.addImport("*", "packageInfo", "./package.json");
writer.write("defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),");
}
);
private final Map<String, Consumer<TypeScriptWriter>> reactNativeRuntimeConfigDefaults = MapUtils.of(
Expand All @@ -182,9 +180,9 @@ final class RuntimeConfigGenerator {
writer.write("urlParser: parseUrl,");
},
"defaultUserAgent", writer -> {
writer.addImport("name", "name", "./package.json");
writer.addImport("version", "version", "./package.json");
writer.write("defaultUserAgent: `aws-sdk-js-v3-react-native-$${name}/$${version}`,");
writer.addImport("*", "packageInfo", "./package.json");
writer.write("defaultUserAgent: "
+ "`aws-sdk-js-v3-react-native-$${packageInfo.name}/$${packageInfo.version}`,");
}
);
private final Map<String, Consumer<TypeScriptWriter>> sharedRuntimeConfigDefaults = MapUtils.of(
Expand Down

0 comments on commit 58f768a

Please sign in to comment.