aboutsummaryrefslogtreecommitdiff
path: root/typescript
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-08-05 17:21:23 +0200
committerMinteck <nekostarfan@gmail.com>2021-08-05 17:21:23 +0200
commitd5a620cf09b835db2bccd99556525c90b458719f (patch)
tree1507f96be0413bd20026878890b0c1ad438e51d2 /typescript
parent44210691ee8444509ac466a362337af77f2bcd49 (diff)
downloadkartik-client-d5a620cf09b835db2bccd99556525c90b458719f.tar.gz
kartik-client-d5a620cf09b835db2bccd99556525c90b458719f.tar.bz2
kartik-client-d5a620cf09b835db2bccd99556525c90b458719f.zip
i18n for 21.08
Diffstat (limited to 'typescript')
-rw-r--r--typescript/builder.js98
-rw-r--r--typescript/interface.ts44
-rw-r--r--typescript/mainloader.js18
-rw-r--r--typescript/preloader.js8
4 files changed, 84 insertions, 84 deletions
diff --git a/typescript/builder.js b/typescript/builder.js
index e3294a1..d021fb2 100644
--- a/typescript/builder.js
+++ b/typescript/builder.js
@@ -1,50 +1,50 @@
-const os = require('os');
-const fs = require('fs');
-const { dialog } = require('electron');
-
-if (os.platform() === "win32") {
- cmd = "typescript\\engine-win32.exe";
-} else {
- cmd = "./typescript/engine-" + os.platform();
-}
-
-fs.copyFileSync("./typescript/interface.ts", homedir + "/.kartik/build/kartik.ts");
-
-cp = require('child_process').spawnSync(cmd, [ "./node_modules/typescript/bin/tsc", "--skipLibCheck", "--removeComments", "--sourceMap", "-m", "commonjs", "--target", "es6", homedir + "/.kartik/build/kartik.ts" ], { cwd: KartikRoot });
-if (cp.status !== 0) {
- console.error(cp.stdout.toString());
- throw new Error("Subprocess exited with code " + cp.status);
-}
-
-fs.unlinkSync(homedir + "/.kartik/build/kartik.ts");
-
-module.exports = (source, destination) => {
- if (os.platform() === "win32") {
- source = source.replaceAll("/", "\\");
- destination = destination.replaceAll("/", "\\");
- }
-
- console.log(destination.substr(0, destination.length - 3));
- fs.copyFileSync(source, destination.substr(0, destination.length - 3));
- fs.writeFileSync(destination.substr(0, destination.length - 3), fs.readFileSync(destination.substr(0, destination.length - 3)).toString().replaceAll("$KARTIK:", homedir.replaceAll("\\", "\\\\") + "/.kartik/build/kartik.js"))
- cp = require('child_process').spawnSync(cmd, [ "./node_modules/typescript/bin/tsc", "--skipLibCheck", "--removeComments", "--sourceMap", "-m", "commonjs", "--target", "es5", destination.substr(0, destination.length - 3) ], { cwd: KartikRoot });
- if (cp.status !== 0) {
- if (cp.stdout !== undefined) {
- dialog.showMessageBoxSync(
- {
- type: "error",
- title: "KMP Mod Loader",
- message: "On package " + item + ": KMP-API building " + source + ":\n\n" + cp.stdout.toString().trim() + "\n\nEXITING."
- }
- )
- process.exit(2);
- } else {
- throw new Error("Subprocess exited with code " + cp.status);
- }
- }
- compiledTypeScriptFiles.push(destination.substr(0, destination.length - 6) + ".js");
-
- lines = fs.readFileSync(destination.substr(0, destination.length - 6) + ".js").toString().split("\n");
- lines[1] = "";
- fs.writeFileSync(destination.substr(0, destination.length - 6) + ".js", lines.join("\n"));
+const os = require('os');
+const fs = require('fs');
+const { dialog } = require('electron');
+
+if (os.platform() === "win32") {
+ cmd = "typescript\\engine-win32.exe";
+} else {
+ cmd = "./typescript/engine-" + os.platform();
+}
+
+fs.copyFileSync("./typescript/interface.ts", homedir + "/.kartik/build/kartik.ts");
+
+cp = require('child_process').spawnSync(cmd, [ "./node_modules/typescript/bin/tsc", "--skipLibCheck", "--removeComments", "--sourceMap", "-m", "commonjs", "--target", "es6", homedir + "/.kartik/build/kartik.ts" ], { cwd: KartikRoot });
+if (cp.status !== 0) {
+ console.error(cp.stdout.toString());
+ throw new Error("Subprocess exited with code " + cp.status);
+}
+
+fs.unlinkSync(homedir + "/.kartik/build/kartik.ts");
+
+module.exports = (source, destination) => {
+ if (os.platform() === "win32") {
+ source = source.replaceAll("/", "\\");
+ destination = destination.replaceAll("/", "\\");
+ }
+
+ console.log(destination.substr(0, destination.length - 3));
+ fs.copyFileSync(source, destination.substr(0, destination.length - 3));
+ fs.writeFileSync(destination.substr(0, destination.length - 3), fs.readFileSync(destination.substr(0, destination.length - 3)).toString().replaceAll("$KARTIK:", homedir.replaceAll("\\", "\\\\") + "/.kartik/build/kartik.js"))
+ cp = require('child_process').spawnSync(cmd, [ "./node_modules/typescript/bin/tsc", "--skipLibCheck", "--removeComments", "--sourceMap", "-m", "commonjs", "--target", "es5", destination.substr(0, destination.length - 3) ], { cwd: KartikRoot });
+ if (cp.status !== 0) {
+ if (cp.stdout !== undefined) {
+ dialog.showMessageBoxSync(
+ {
+ type: "error",
+ title: "KMP Mod Loader",
+ message: "On package " + item + ": KMP-API building " + source + ":\n\n" + cp.stdout.toString().trim() + "\n\nEXITING."
+ }
+ )
+ process.exit(2);
+ } else {
+ throw new Error("Subprocess exited with code " + cp.status);
+ }
+ }
+ compiledTypeScriptFiles.push(destination.substr(0, destination.length - 6) + ".js");
+
+ lines = fs.readFileSync(destination.substr(0, destination.length - 6) + ".js").toString().split("\n");
+ lines[1] = "";
+ fs.writeFileSync(destination.substr(0, destination.length - 6) + ".js", lines.join("\n"));
} \ No newline at end of file
diff --git a/typescript/interface.ts b/typescript/interface.ts
index 28e8219..18821c1 100644
--- a/typescript/interface.ts
+++ b/typescript/interface.ts
@@ -1,23 +1,23 @@
-// @ts-nocheck
-
-let item = {
- context: null,
-
- dom: {
- document: null,
- window: null,
- },
-
-};
-
-if (typeof HTML !== "undefined") {
- if (typeof HTML.document !== "undefined") {
- item.dom.document = HTML.document;
- }
-
- if (typeof window !== "undefined") {
- item.dom.window = HTML.window;
- }
-}
-
+// @ts-nocheck
+
+let item = {
+ context: null,
+
+ dom: {
+ document: null,
+ window: null,
+ },
+
+};
+
+if (typeof HTML !== "undefined") {
+ if (typeof HTML.document !== "undefined") {
+ item.dom.document = HTML.document;
+ }
+
+ if (typeof window !== "undefined") {
+ item.dom.window = HTML.window;
+ }
+}
+
module.exports = item; \ No newline at end of file
diff --git a/typescript/mainloader.js b/typescript/mainloader.js
index 6fee294..32c1144 100644
--- a/typescript/mainloader.js
+++ b/typescript/mainloader.js
@@ -1,10 +1,10 @@
-window.addEventListener("load", () => {
- files = require('@electron/remote').getCurrentWindow().modsfiles;
- global.HTML = window;
-
- for (file of files) {
- var script = document.createElement('script');
- script.src = "file://" + file.replaceAll("\\", "/");
- document.head.appendChild(script)
- }
+window.addEventListener("load", () => {
+ files = require('@electron/remote').getCurrentWindow().modsfiles;
+ global.HTML = window;
+
+ for (file of files) {
+ var script = document.createElement('script');
+ script.src = "file://" + file.replaceAll("\\", "/");
+ document.head.appendChild(script)
+ }
}) \ No newline at end of file
diff --git a/typescript/preloader.js b/typescript/preloader.js
index fae3caf..d5d9129 100644
--- a/typescript/preloader.js
+++ b/typescript/preloader.js
@@ -1,5 +1,5 @@
-files = compiledTypeScriptFiles;
-
-for (file of files) {
- require(file);
+files = compiledTypeScriptFiles;
+
+for (file of files) {
+ require(file);
} \ No newline at end of file