Skip to content

Commit

Permalink
mcconfig: typescript windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Soquet committed Sep 4, 2020
1 parent 7e22fc2 commit 3499033
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions tools/mcmanifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,21 @@ export class MakeFile extends FILE {
this.line("");

if (tool.tsFiles.length) {
let directories = tool.tsFiles.map(item => item.source);
let directory;
do {
directories = directories.map(item => tool.splitPath(item).directory);
directory = directories[0];
} while(directories.some(item => item != directory));
const common = directory.length;
let directories = tool.tsFiles.map(item => tool.splitPath(item.source).directory);
const length = directories.length;
let common;
if (length > 1) {
directories.sort();
const first = directories[0];
const last = directories[length - 1];
const firstLength = first.length;
const lastLength = last.length;
common = 0;
while ((common < firstLength) && (common < lastLength) && (first.charAt(common) === last.charAt(common)))
common++;
}
else
common = directories[0].length;
var temporaries = [];
for (var result of tool.tsFiles) {
var source = result.source;
Expand Down Expand Up @@ -738,18 +746,24 @@ export class TSConfigFile extends FILE {
sourceMap: true,
target: "ES2020",
types: [
tool.xsPath + "/includes/xs"
tool.xsPath + tool.slash + "includes" + tool.slash +"xs"
]
},
files: [
]
}
var paths = json.compilerOptions.paths;
for (var result of tool.dtsFiles) {
paths[result.target.slice(0, -2)] = [ result.source.slice(0, -5) ];
var specifier = result.target.slice(0, -2);
if (tool.windows)
specifier = specifier.replaceAll("\\", "/");
paths[specifier] = [ result.source.slice(0, -5) ];
}
for (var result of tool.tsFiles) {
paths[result.target.slice(0, -4)] = [ result.source.slice(0, -3) ];
var specifier = result.target.slice(0, -4);
if (tool.windows)
specifier = specifier.replaceAll("\\", "/");
paths[specifier] = [ result.source.slice(0, -3) ];
json.files.push(result.source);
}
this.write(JSON.stringify(json, null, "\t"));
Expand Down

0 comments on commit 3499033

Please sign in to comment.