Skip to content

Commit 3f96588

Browse files
committed
prevent to append _helper.d.ts on each run
1 parent 15ea818 commit 3f96588

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

dts-generator/src/main/java/com/telerik/dts/FileWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ public void write(String content, String fileName) {
5656
}
5757
}
5858

59-
public void writeHelperTypings(String content) {
59+
public void writeHelperTypings(String content, boolean append) {
6060
try {
6161
String outFile = this.outDir.getAbsolutePath() + File.separator + "_helpers.d.ts";
62-
this.ps = new PrintStream(new FileOutputStream(outFile, true));
62+
this.ps = new PrintStream(new FileOutputStream(outFile, append));
6363

6464
this.ps.print(content);
6565
this.ps.println();

dts-generator/src/main/java/com/telerik/dts/Generator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ private void generateDts() {
4141
}
4242

4343
private void writeHelperTypings() {
44-
4544
List<String> helperTypings = new ArrayList<>();
4645
helperTypings.add("declare module native {\n" +
4746
"\texport class Array<T> {\n" +
4847
"\t\tpublic constructor();\n" +
4948
"\t}\n" +
5049
"}\n");
5150

51+
boolean append = false;
52+
5253
for (String helper : helperTypings) {
53-
this.fw.writeHelperTypings(helper);
54+
this.fw.writeHelperTypings(helper, append);
55+
append = true;
5456
}
5557
}
5658

0 commit comments

Comments
 (0)