Skip to content

Commit 3f9a4c2

Browse files
dustinlacewellPerryvw
authored andcommitted
Refactor LuaTranspiler.emitFilesAndReportErrors to create LuaTranspiler.emitLuaLib (#379)
1 parent 9e0a0f0 commit 3f9a4c2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/LuaTranspiler.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ export class LuaTranspiler {
5555
return 0;
5656
}
5757

58+
public emitLuaLib(): string {
59+
const outPath = path.join(this.options.outDir, "lualib_bundle.lua");
60+
fs.copyFileSync(
61+
path.resolve(__dirname, "../dist/lualib/lualib_bundle.lua"),
62+
outPath
63+
);
64+
return outPath;
65+
}
66+
5867
public emitFilesAndReportErrors(): number {
5968
const error = this.reportErrors();
6069
if (error > 0) {
@@ -67,10 +76,7 @@ export class LuaTranspiler {
6776
if (this.options.luaLibImport === LuaLibImportKind.Require
6877
|| this.options.luaLibImport === LuaLibImportKind.Always
6978
) {
70-
fs.copyFileSync(
71-
path.resolve(__dirname, "../dist/lualib/lualib_bundle.lua"),
72-
path.join(this.options.outDir, "lualib_bundle.lua")
73-
);
79+
this.emitLuaLib();
7480
}
7581

7682
return 0;

0 commit comments

Comments
 (0)