Skip to content

Commit 2005609

Browse files
Remove luaLibDir and fix rootDir on Windows
1 parent 651c978 commit 2005609

File tree

3 files changed

+14
-48
lines changed

3 files changed

+14
-48
lines changed

package-lock.json

Lines changed: 0 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222
},
2323
"dependencies": {
2424
"dedent": "^0.7.0",
25-
"mkdirp": "^0.5.1",
2625
"typescript": "^2.7.2",
2726
"yargs": "^11.0.0"
2827
},
2928
"devDependencies": {
30-
"@types/mkdirp": "^0.5.2",
3129
"@types/yargs": "^11.0.0",
3230
"alsatian": "^2.2.1",
3331
"codecov": "^3.0.0",

src/Compiler.ts

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ import * as yargs from 'yargs'
77

88
// ES6 syntax broken
99
import dedent = require("dedent")
10-
import mkdirp = require("mkdirp")
1110

1211
import { LuaTranspiler, TranspileError } from "./Transpiler";
1312
import { TSHelper as tsEx } from "./TSHelper";
1413

1514
interface CompilerOptions extends ts.CompilerOptions {
1615
addHeader?: boolean;
17-
luaTarget?: string
18-
luaLibDir?: string;
16+
luaTarget?: string;
1917
}
2018

2119
function compile(fileNames: string[], options: CompilerOptions): void {
@@ -49,17 +47,6 @@ function compile(fileNames: string[], options: CompilerOptions): void {
4947
options.outDir = options.rootDir;
5048
}
5149

52-
options.luaLibDir = path.resolve(options.outDir, options.luaLibDir);
53-
mkdirp.sync(options.luaLibDir);
54-
55-
// Copy lualib to target dir
56-
// This isnt run in sync because copyFileSync wont report errors.
57-
fs.copyFile(path.resolve(__dirname, "../dist/lualib/typescript.lua"), path.join(options.luaLibDir, "typescript_lualib.lua"), (err: NodeJS.ErrnoException) => {
58-
if (err) {
59-
console.log("ERROR: copying lualib to output.");
60-
}
61-
});
62-
6350
program.getSourceFiles().forEach(sourceFile => {
6451
if (!sourceFile.isDeclarationFile) {
6552
try {
@@ -70,7 +57,8 @@ function compile(fileNames: string[], options: CompilerOptions): void {
7057

7158
let outPath = sourceFile.fileName;
7259
if (options.outDir !== options.rootDir) {
73-
outPath = path.join(options.outDir, path.resolve(sourceFile.fileName).replace(rootDir, ""));
60+
const relativeSourcePath = path.resolve(sourceFile.fileName).replace(path.resolve(rootDir), "");
61+
outPath = path.join(options.outDir, relativeSourcePath);
7462
}
7563

7664
// change extension
@@ -94,7 +82,17 @@ function compile(fileNames: string[], options: CompilerOptions): void {
9482
}
9583
});
9684

97-
process.exit(0);
85+
// Copy lualib to target dir
86+
// This isnt run in sync because copyFileSync wont report errors.
87+
fs.copyFile(path.resolve(__dirname, "../dist/lualib/typescript.lua"), path.join(options.outDir, "typescript_lualib.lua"), (err: NodeJS.ErrnoException) => {
88+
if (err) {
89+
console.log("ERROR: copying lualib to output.");
90+
process.exit(1);
91+
}
92+
else {
93+
process.exit(0);
94+
}
95+
});
9896
}
9997

10098
function printAST(node: ts.Node, indent: number) {
@@ -139,12 +137,6 @@ function executeCommandLine(args: ReadonlyArray<string>) {
139137
describe: 'Specify Lua target version.',
140138
type: 'string'
141139
},
142-
'lld': {
143-
alias: 'luaLibDir',
144-
describe: 'Specify typescript_lualib.lua location relative to outDir.',
145-
default: './',
146-
type: 'string'
147-
},
148140
'ah': {
149141
alias: 'addHeader',
150142
describe: 'Specify if a header will be added to compiled files.',

0 commit comments

Comments
 (0)