mirror of
https://github.com/upscayl/upscayl.git
synced 2024-11-23 23:21:05 +01:00
Fix build
This commit is contained in:
parent
e0d2505b00
commit
523d035ecd
4
.gitignore
vendored
4
.gitignore
vendored
@ -16,7 +16,9 @@
|
|||||||
/renderer/out/
|
/renderer/out/
|
||||||
|
|
||||||
# production
|
# production
|
||||||
/dist
|
/dist/
|
||||||
|
/export/electron
|
||||||
|
/export/common
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
7
common/feature-flags.ts
Normal file
7
common/feature-flags.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
type FeatureFlags = {
|
||||||
|
APP_STORE_BUILD: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const featureFlags: FeatureFlags = {
|
||||||
|
APP_STORE_BUILD: true,
|
||||||
|
};
|
@ -1,7 +1,7 @@
|
|||||||
import prepareNext from "electron-next";
|
import prepareNext from "electron-next";
|
||||||
import { autoUpdater } from "electron-updater";
|
import { autoUpdater } from "electron-updater";
|
||||||
import log from "electron-log";
|
import log from "electron-log";
|
||||||
import { app, ipcMain, protocol, net } from "electron";
|
import { app, ipcMain, protocol } from "electron";
|
||||||
import COMMAND from "./constants/commands";
|
import COMMAND from "./constants/commands";
|
||||||
import logit from "./utils/logit";
|
import logit from "./utils/logit";
|
||||||
import openFolder from "./commands/open-folder";
|
import openFolder from "./commands/open-folder";
|
||||||
@ -18,7 +18,7 @@ import batchUpscayl from "./commands/batch-upscayl";
|
|||||||
import doubleUpscayl from "./commands/double-upscayl";
|
import doubleUpscayl from "./commands/double-upscayl";
|
||||||
import autoUpdate from "./commands/auto-update";
|
import autoUpdate from "./commands/auto-update";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
import { getPlatform } from "./utils/get-device-specs";
|
import { featureFlags } from "../common/feature-flags";
|
||||||
|
|
||||||
// INITIALIZATION
|
// INITIALIZATION
|
||||||
log.initialize({ preload: true });
|
log.initialize({ preload: true });
|
||||||
@ -51,7 +51,8 @@ app.on("window-all-closed", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ! ENABLE THIS FOR MACOS APP STORE BUILD
|
// ! ENABLE THIS FOR MACOS APP STORE BUILD
|
||||||
if (getPlatform() === "mac") {
|
if (featureFlags.APP_STORE_BUILD) {
|
||||||
|
logit("🚀 APP STORE BUILD ENABLED");
|
||||||
app.commandLine.appendSwitch("in-process-gpu");
|
app.commandLine.appendSwitch("in-process-gpu");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,4 +74,6 @@ ipcMain.on(COMMAND.FOLDER_UPSCAYL, batchUpscayl);
|
|||||||
|
|
||||||
ipcMain.on(COMMAND.DOUBLE_UPSCAYL, doubleUpscayl);
|
ipcMain.on(COMMAND.DOUBLE_UPSCAYL, doubleUpscayl);
|
||||||
|
|
||||||
// autoUpdater.on("update-downloaded", autoUpdate);
|
if (!featureFlags.APP_STORE_BUILD) {
|
||||||
|
autoUpdater.on("update-downloaded", autoUpdate);
|
||||||
|
}
|
||||||
|
@ -2,23 +2,14 @@ import { BrowserWindow, shell } from "electron";
|
|||||||
import { getPlatform } from "./utils/get-device-specs";
|
import { getPlatform } from "./utils/get-device-specs";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import COMMAND from "./constants/commands";
|
import COMMAND from "./constants/commands";
|
||||||
import {
|
import { fetchLocalStorage } from "./utils/config-variables";
|
||||||
overwrite,
|
|
||||||
setCustomModelsFolderPath,
|
|
||||||
setFolderPath,
|
|
||||||
setImagePath,
|
|
||||||
setOutputFolderPath,
|
|
||||||
setOverwrite,
|
|
||||||
setCompression,
|
|
||||||
setSaveOutputFolder,
|
|
||||||
fetchLocalStorage,
|
|
||||||
} from "./utils/config-variables";
|
|
||||||
import electronIsDev from "electron-is-dev";
|
import electronIsDev from "electron-is-dev";
|
||||||
import { format } from "url";
|
import { format } from "url";
|
||||||
|
|
||||||
let mainWindow: BrowserWindow | undefined;
|
let mainWindow: BrowserWindow | undefined;
|
||||||
|
|
||||||
const createMainWindow = () => {
|
const createMainWindow = () => {
|
||||||
|
console.log("📂 DIRNAME", __dirname);
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
icon: join(__dirname, "build", "icon.png"),
|
icon: join(__dirname, "build", "icon.png"),
|
||||||
width: 1300,
|
width: 1300,
|
||||||
|
BIN
export/build/background.png
Normal file
BIN
export/build/background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 326 KiB |
BIN
export/build/icon.icns
Normal file
BIN
export/build/icon.icns
Normal file
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Binary file not shown.
@ -1,48 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const electron_1 = require("electron");
|
|
||||||
const commands_1 = __importDefault(require("../../commands"));
|
|
||||||
function default_1({ mainWindow, customModelsFolderPath, logit, slash, getModels, }) {
|
|
||||||
electron_1.ipcMain.handle(commands_1.default.SELECT_CUSTOM_MODEL_FOLDER, (event, message) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const { canceled, filePaths: folderPaths } = yield electron_1.dialog.showOpenDialog({
|
|
||||||
properties: ["openDirectory"],
|
|
||||||
title: "Select Custom Models Folder",
|
|
||||||
defaultPath: customModelsFolderPath,
|
|
||||||
});
|
|
||||||
if (canceled) {
|
|
||||||
logit("🚫 Select Custom Models Folder Operation Cancelled");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
customModelsFolderPath = folderPaths[0];
|
|
||||||
if (!folderPaths[0].endsWith(slash + "models") &&
|
|
||||||
!folderPaths[0].endsWith(slash + "models" + slash)) {
|
|
||||||
logit("❌ Invalid Custom Models Folder Detected: Not a 'models' folder");
|
|
||||||
const options = {
|
|
||||||
type: "error",
|
|
||||||
title: "Invalid Folder",
|
|
||||||
message: "Please make sure that the folder name is 'models' and nothing else.",
|
|
||||||
buttons: ["OK"],
|
|
||||||
};
|
|
||||||
electron_1.dialog.showMessageBoxSync(options);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
mainWindow.webContents.send(commands_1.default.CUSTOM_MODEL_FILES_LIST, getModels(customModelsFolderPath));
|
|
||||||
logit("📁 Custom Folder Path: ", customModelsFolderPath);
|
|
||||||
return customModelsFolderPath;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
exports.default = default_1;
|
|
@ -1,139 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const electron_1 = require("electron");
|
|
||||||
const commands_1 = __importDefault(require("../../commands"));
|
|
||||||
const path_1 = require("path");
|
|
||||||
const upscayl_1 = require("../../upscayl");
|
|
||||||
const getArguments_1 = require("../getArguments");
|
|
||||||
const jimp_1 = __importDefault(require("jimp"));
|
|
||||||
function default_1({ mainWindow, slash, logit, childProcesses, stopped, modelsPath, customModelsFolderPath, saveOutputFolder, outputFolderPath, quality, defaultModels, }) {
|
|
||||||
electron_1.ipcMain.on(commands_1.default.DOUBLE_UPSCAYL, (event, payload) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const model = payload.model;
|
|
||||||
let inputDir = (payload.imagePath.match(/(.*)[\/\\]/)[1] || "");
|
|
||||||
let outputDir = payload.outputPath;
|
|
||||||
if (saveOutputFolder === true && outputFolderPath) {
|
|
||||||
outputDir = outputFolderPath;
|
|
||||||
}
|
|
||||||
const gpuId = payload.gpuId;
|
|
||||||
const saveImageAs = payload.saveImageAs;
|
|
||||||
const isDefaultModel = defaultModels.includes(model);
|
|
||||||
// COPY IMAGE TO TMP FOLDER
|
|
||||||
const fullfileName = payload.imagePath.split(slash).slice(-1)[0];
|
|
||||||
const fileName = (0, path_1.parse)(fullfileName).name;
|
|
||||||
const outFile = outputDir +
|
|
||||||
slash +
|
|
||||||
fileName +
|
|
||||||
"_upscayl_16x_" +
|
|
||||||
model +
|
|
||||||
"." +
|
|
||||||
saveImageAs;
|
|
||||||
let scale = "4";
|
|
||||||
if (model.includes("x2")) {
|
|
||||||
scale = "2";
|
|
||||||
}
|
|
||||||
else if (model.includes("x3")) {
|
|
||||||
scale = "3";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
scale = "4";
|
|
||||||
}
|
|
||||||
// UPSCALE
|
|
||||||
let upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getDoubleUpscaleArguments)(inputDir, fullfileName, outFile, isDefaultModel ? modelsPath : customModelsFolderPath !== null && customModelsFolderPath !== void 0 ? customModelsFolderPath : modelsPath, model, gpuId, saveImageAs, scale), logit);
|
|
||||||
childProcesses.push(upscayl);
|
|
||||||
stopped = false;
|
|
||||||
let failed = false;
|
|
||||||
let isAlpha = false;
|
|
||||||
let failed2 = false;
|
|
||||||
const onData = (data) => {
|
|
||||||
// CONVERT DATA TO STRING
|
|
||||||
data = data.toString();
|
|
||||||
// SEND UPSCAYL PROGRESS TO RENDERER
|
|
||||||
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);
|
|
||||||
// IF PROGRESS HAS ERROR, UPSCAYL FAILED
|
|
||||||
if (data.includes("invalid gpu") || data.includes("failed")) {
|
|
||||||
failed = true;
|
|
||||||
}
|
|
||||||
if (data.includes("has alpha channel")) {
|
|
||||||
isAlpha = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const onError = (data) => {
|
|
||||||
data.toString();
|
|
||||||
// SEND UPSCAYL PROGRESS TO RENDERER
|
|
||||||
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);
|
|
||||||
// SET FAILED TO TRUE
|
|
||||||
failed = true;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
const onData2 = (data) => {
|
|
||||||
// CONVERT DATA TO STRING
|
|
||||||
data = data.toString();
|
|
||||||
// SEND UPSCAYL PROGRESS TO RENDERER
|
|
||||||
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);
|
|
||||||
// IF PROGRESS HAS ERROR, UPSCAYL FAILED
|
|
||||||
if (data.includes("invalid gpu") || data.includes("failed")) {
|
|
||||||
failed2 = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const onError2 = (data) => {
|
|
||||||
data.toString();
|
|
||||||
// SEND UPSCAYL PROGRESS TO RENDERER
|
|
||||||
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);
|
|
||||||
// SET FAILED TO TRUE
|
|
||||||
failed2 = true;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
const onClose2 = (code) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!failed2 && !stopped) {
|
|
||||||
logit("💯 Done upscaling");
|
|
||||||
logit("♻ Scaling and converting now...");
|
|
||||||
const originalImage = yield jimp_1.default.read(inputDir + slash + fullfileName);
|
|
||||||
try {
|
|
||||||
const newImage = yield jimp_1.default.read(isAlpha ? outFile + ".png" : outFile);
|
|
||||||
try {
|
|
||||||
newImage
|
|
||||||
.scaleToFit(originalImage.getWidth() * parseInt(payload.scale), originalImage.getHeight() * parseInt(payload.scale))
|
|
||||||
.quality(100 - quality)
|
|
||||||
.write(isAlpha ? outFile + ".png" : outFile);
|
|
||||||
mainWindow.setProgressBar(-1);
|
|
||||||
mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_DONE, isAlpha ? outFile + ".png" : outFile);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
logit("❌ Error converting to PNG: ", error);
|
|
||||||
onError(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
logit("❌ Error reading original image metadata", error);
|
|
||||||
onError(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
upscayl.process.stderr.on("data", onData);
|
|
||||||
upscayl.process.on("error", onError);
|
|
||||||
upscayl.process.on("close", (code) => {
|
|
||||||
// IF NOT FAILED
|
|
||||||
if (!failed && !stopped) {
|
|
||||||
// UPSCALE
|
|
||||||
let upscayl2 = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getDoubleUpscaleSecondPassArguments)(isAlpha, outFile, isDefaultModel ? modelsPath : customModelsFolderPath !== null && customModelsFolderPath !== void 0 ? customModelsFolderPath : modelsPath, model, gpuId, saveImageAs, scale), logit);
|
|
||||||
childProcesses.push(upscayl2);
|
|
||||||
upscayl2.process.stderr.on("data", onData2);
|
|
||||||
upscayl2.process.on("error", onError2);
|
|
||||||
upscayl2.process.on("close", onClose2);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
exports.default = default_1;
|
|
@ -1,72 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const electron_1 = require("electron");
|
|
||||||
const commands_1 = __importDefault(require("../../commands"));
|
|
||||||
const upscayl_1 = require("../../upscayl");
|
|
||||||
const getArguments_1 = require("../getArguments");
|
|
||||||
const fs_1 = __importDefault(require("fs"));
|
|
||||||
function default_1({ mainWindow, logit, childProcesses, stopped, modelsPath, customModelsFolderPath, saveOutputFolder, outputFolderPath, defaultModels, }) {
|
|
||||||
electron_1.ipcMain.on(commands_1.default.FOLDER_UPSCAYL, (event, payload) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// GET THE MODEL
|
|
||||||
const model = payload.model;
|
|
||||||
const gpuId = payload.gpuId;
|
|
||||||
const saveImageAs = payload.saveImageAs;
|
|
||||||
const scale = payload.scale;
|
|
||||||
// GET THE IMAGE DIRECTORY
|
|
||||||
let inputDir = payload.batchFolderPath;
|
|
||||||
// GET THE OUTPUT DIRECTORY
|
|
||||||
let outputDir = payload.outputPath;
|
|
||||||
if (saveOutputFolder === true && outputFolderPath) {
|
|
||||||
outputDir = outputFolderPath;
|
|
||||||
}
|
|
||||||
if (!fs_1.default.existsSync(outputDir)) {
|
|
||||||
fs_1.default.mkdirSync(outputDir, { recursive: true });
|
|
||||||
}
|
|
||||||
const isDefaultModel = defaultModels.includes(model);
|
|
||||||
// UPSCALE
|
|
||||||
const upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getBatchArguments)(inputDir, outputDir, isDefaultModel ? modelsPath : customModelsFolderPath !== null && customModelsFolderPath !== void 0 ? customModelsFolderPath : modelsPath, model, gpuId, saveImageAs, scale), logit);
|
|
||||||
childProcesses.push(upscayl);
|
|
||||||
stopped = false;
|
|
||||||
let failed = false;
|
|
||||||
const onData = (data) => {
|
|
||||||
data = data.toString();
|
|
||||||
mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_PROGRESS, data.toString());
|
|
||||||
if (data.includes("invalid gpu") || data.includes("failed")) {
|
|
||||||
logit("❌ INVALID GPU OR INVALID FILES IN FOLDER - FAILED");
|
|
||||||
failed = true;
|
|
||||||
upscayl.kill();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const onError = (data) => {
|
|
||||||
mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_PROGRESS, data.toString());
|
|
||||||
failed = true;
|
|
||||||
upscayl.kill();
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
const onClose = () => {
|
|
||||||
if (!failed && !stopped) {
|
|
||||||
logit("💯 Done upscaling");
|
|
||||||
mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_DONE, outputDir);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
upscayl.kill();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
upscayl.process.stderr.on("data", onData);
|
|
||||||
upscayl.process.on("error", onError);
|
|
||||||
upscayl.process.on("close", onClose);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
exports.default = default_1;
|
|
@ -1,26 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const electron_1 = require("electron");
|
|
||||||
const commands_1 = __importDefault(require("../../commands"));
|
|
||||||
function default_1({ mainWindow, customModelsFolderPath, logit, getModels, }) {
|
|
||||||
electron_1.ipcMain.on(commands_1.default.GET_MODELS_LIST, (event, payload) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (payload) {
|
|
||||||
customModelsFolderPath = payload;
|
|
||||||
logit("📁 Custom Models Folder Path: ", customModelsFolderPath);
|
|
||||||
mainWindow.webContents.send(commands_1.default.CUSTOM_MODEL_FILES_LIST, getModels(payload));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
exports.default = default_1;
|
|
@ -1,118 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const electron_1 = require("electron");
|
|
||||||
const commands_1 = __importDefault(require("../../commands"));
|
|
||||||
const path_1 = require("path");
|
|
||||||
const upscayl_1 = require("../../upscayl");
|
|
||||||
const jimp_1 = __importDefault(require("jimp"));
|
|
||||||
const getArguments_1 = require("../getArguments");
|
|
||||||
const fs_1 = __importDefault(require("fs"));
|
|
||||||
function default_1({ mainWindow, slash, logit, childProcesses, stopped, modelsPath, customModelsFolderPath, saveOutputFolder, outputFolderPath, quality, defaultModels, folderPath, }) {
|
|
||||||
electron_1.ipcMain.on(commands_1.default.UPSCAYL, (event, payload) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const model = payload.model;
|
|
||||||
const gpuId = payload.gpuId;
|
|
||||||
const saveImageAs = payload.saveImageAs;
|
|
||||||
let inputDir = (payload.imagePath.match(/(.*)[\/\\]/)[1] || "");
|
|
||||||
let outputDir = folderPath || payload.outputPath;
|
|
||||||
if (saveOutputFolder === true && outputFolderPath) {
|
|
||||||
outputDir = outputFolderPath;
|
|
||||||
}
|
|
||||||
const isDefaultModel = defaultModels.includes(model);
|
|
||||||
const fullfileName = payload.imagePath.replace(/^.*[\\\/]/, "");
|
|
||||||
const fileName = (0, path_1.parse)(fullfileName).name;
|
|
||||||
const fileExt = (0, path_1.parse)(fullfileName).ext;
|
|
||||||
let scale = "4";
|
|
||||||
if (model.includes("x2")) {
|
|
||||||
scale = "2";
|
|
||||||
}
|
|
||||||
else if (model.includes("x3")) {
|
|
||||||
scale = "3";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
scale = "4";
|
|
||||||
}
|
|
||||||
const outFile = outputDir +
|
|
||||||
slash +
|
|
||||||
fileName +
|
|
||||||
"_upscayl_" +
|
|
||||||
payload.scale +
|
|
||||||
"x_" +
|
|
||||||
model +
|
|
||||||
"." +
|
|
||||||
saveImageAs;
|
|
||||||
// UPSCALE
|
|
||||||
if (fs_1.default.existsSync(outFile)) {
|
|
||||||
// If already upscayled, just output that file
|
|
||||||
logit("✅ Already upscayled at: ", outFile);
|
|
||||||
mainWindow.webContents.send(commands_1.default.UPSCAYL_DONE, outFile);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getSingleImageArguments)(inputDir, fullfileName, outFile, isDefaultModel ? modelsPath : customModelsFolderPath !== null && customModelsFolderPath !== void 0 ? customModelsFolderPath : modelsPath, model, scale, gpuId, saveImageAs), logit);
|
|
||||||
childProcesses.push(upscayl);
|
|
||||||
stopped = false;
|
|
||||||
let isAlpha = false;
|
|
||||||
let failed = false;
|
|
||||||
const onData = (data) => {
|
|
||||||
logit("image upscayl: ", data.toString());
|
|
||||||
mainWindow.setProgressBar(parseFloat(data.slice(0, data.length)) / 100);
|
|
||||||
data = data.toString();
|
|
||||||
mainWindow.webContents.send(commands_1.default.UPSCAYL_PROGRESS, data.toString());
|
|
||||||
if (data.includes("invalid gpu") || data.includes("failed")) {
|
|
||||||
logit("❌ INVALID GPU OR FAILED");
|
|
||||||
failed = true;
|
|
||||||
}
|
|
||||||
if (data.includes("has alpha channel")) {
|
|
||||||
logit("📢 INCLUDES ALPHA CHANNEL, CHANGING OUTFILE NAME!");
|
|
||||||
isAlpha = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const onError = (data) => {
|
|
||||||
mainWindow.webContents.send(commands_1.default.UPSCAYL_PROGRESS, data.toString());
|
|
||||||
failed = true;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
const onClose = () => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!failed && !stopped) {
|
|
||||||
logit("💯 Done upscaling");
|
|
||||||
logit("♻ Scaling and converting now...");
|
|
||||||
const originalImage = yield jimp_1.default.read(inputDir + slash + fullfileName);
|
|
||||||
try {
|
|
||||||
const newImage = yield jimp_1.default.read(isAlpha ? outFile + ".png" : outFile);
|
|
||||||
try {
|
|
||||||
newImage
|
|
||||||
.scaleToFit(originalImage.getWidth() * parseInt(payload.scale), originalImage.getHeight() * parseInt(payload.scale))
|
|
||||||
.quality(100 - quality)
|
|
||||||
.write(isAlpha ? outFile + ".png" : outFile);
|
|
||||||
mainWindow.setProgressBar(-1);
|
|
||||||
mainWindow.webContents.send(commands_1.default.UPSCAYL_DONE, isAlpha ? outFile + ".png" : outFile);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
logit("❌ Error converting to PNG: ", error);
|
|
||||||
onError(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
logit("❌ Error reading original image metadata", error);
|
|
||||||
onError(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
upscayl.process.stderr.on("data", onData);
|
|
||||||
upscayl.process.on("error", onError);
|
|
||||||
upscayl.process.on("close", onClose);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
exports.default = default_1;
|
|
@ -1,61 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const electron_1 = require("electron");
|
|
||||||
const commands_1 = __importDefault(require("../../commands"));
|
|
||||||
function default_1({ mainWindow, imagePath, logit }) {
|
|
||||||
return electron_1.ipcMain.handle(commands_1.default.SELECT_FILE, () => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const { canceled, filePaths } = yield electron_1.dialog.showOpenDialog({
|
|
||||||
properties: ["openFile", "multiSelections"],
|
|
||||||
title: "Select Image",
|
|
||||||
defaultPath: imagePath,
|
|
||||||
});
|
|
||||||
if (canceled) {
|
|
||||||
logit("🚫 File Operation Cancelled");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
imagePath = filePaths[0];
|
|
||||||
let isValid = false;
|
|
||||||
// READ SELECTED FILES
|
|
||||||
filePaths.forEach((file) => {
|
|
||||||
// log.log("Files in Folder: ", file);
|
|
||||||
if (file.endsWith(".png") ||
|
|
||||||
file.endsWith(".jpg") ||
|
|
||||||
file.endsWith(".jpeg") ||
|
|
||||||
file.endsWith(".webp") ||
|
|
||||||
file.endsWith(".JPG") ||
|
|
||||||
file.endsWith(".PNG") ||
|
|
||||||
file.endsWith(".JPEG") ||
|
|
||||||
file.endsWith(".WEBP")) {
|
|
||||||
isValid = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (!isValid) {
|
|
||||||
logit("❌ Invalid File Detected");
|
|
||||||
const options = {
|
|
||||||
type: "error",
|
|
||||||
title: "Invalid File",
|
|
||||||
message: "The selected file is not a valid image. Make sure you select a '.png', '.jpg', or '.webp' file.",
|
|
||||||
};
|
|
||||||
electron_1.dialog.showMessageBoxSync(mainWindow, options);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
logit("📄 Selected File Path: ", filePaths[0]);
|
|
||||||
// CREATE input AND upscaled FOLDER
|
|
||||||
return filePaths[0];
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
exports.default = default_1;
|
|
@ -1,34 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const electron_1 = require("electron");
|
|
||||||
const commands_1 = __importDefault(require("../../commands"));
|
|
||||||
function default_1({ folderPath, logit }) {
|
|
||||||
electron_1.ipcMain.handle(commands_1.default.SELECT_FOLDER, (event, message) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const { canceled, filePaths: folderPaths } = yield electron_1.dialog.showOpenDialog({
|
|
||||||
properties: ["openDirectory"],
|
|
||||||
defaultPath: folderPath,
|
|
||||||
});
|
|
||||||
if (canceled) {
|
|
||||||
logit("🚫 Select Folder Operation Cancelled");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
folderPath = folderPaths[0];
|
|
||||||
logit("📁 Selected Folder Path: ", folderPath);
|
|
||||||
return folderPaths[0];
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
exports.default = default_1;
|
|
@ -6,6 +6,9 @@ const nextConfig = {
|
|||||||
images: {
|
images: {
|
||||||
unoptimized: true,
|
unoptimized: true,
|
||||||
},
|
},
|
||||||
|
experimental: {
|
||||||
|
externalDir: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = nextConfig;
|
module.exports = nextConfig;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
"KDE",
|
"KDE",
|
||||||
"Gnome"
|
"Gnome"
|
||||||
],
|
],
|
||||||
"main": "main/index.js",
|
"main": "export/electron/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf dist renderer/.next renderer/out",
|
"clean": "rimraf dist renderer/.next renderer/out",
|
||||||
"start": "tsc && electron .",
|
"start": "tsc && electron .",
|
||||||
@ -180,7 +180,7 @@
|
|||||||
"target": [
|
"target": [
|
||||||
"nsis"
|
"nsis"
|
||||||
],
|
],
|
||||||
"icon": "main/build/icon.png"
|
"icon": "build/icon.png"
|
||||||
},
|
},
|
||||||
"nsis": {
|
"nsis": {
|
||||||
"allowToChangeInstallationDirectory": true,
|
"allowToChangeInstallationDirectory": true,
|
||||||
@ -189,7 +189,7 @@
|
|||||||
"perMachine": true
|
"perMachine": true
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"main",
|
"export",
|
||||||
"renderer/out"
|
"renderer/out"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,7 @@ import OverwriteToggle from "./OverwriteToggle";
|
|||||||
import { UpscaylCloudModal } from "../UpscaylCloudModal";
|
import { UpscaylCloudModal } from "../UpscaylCloudModal";
|
||||||
import { ResetSettings } from "./ResetSettings";
|
import { ResetSettings } from "./ResetSettings";
|
||||||
import ProcessImageToggle from "./ProcessImageToggle";
|
import ProcessImageToggle from "./ProcessImageToggle";
|
||||||
import { FLAGS } from "@/utils/flags";
|
import { featureFlags } from "@common/feature-flags";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
batchMode: boolean;
|
batchMode: boolean;
|
||||||
@ -190,7 +190,7 @@ function SettingsTab({
|
|||||||
target="_blank">
|
target="_blank">
|
||||||
Read Wiki Guide
|
Read Wiki Guide
|
||||||
</a>
|
</a>
|
||||||
{!FLAGS.APP_STORE_BUILD && <DonateButton />}
|
{!featureFlags.APP_STORE_BUILD && <DonateButton />}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LogArea
|
<LogArea
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
} from "../atoms/userSettingsAtom";
|
} from "../atoms/userSettingsAtom";
|
||||||
import useLog from "../components/hooks/useLog";
|
import useLog from "../components/hooks/useLog";
|
||||||
import { UpscaylCloudModal } from "../components/UpscaylCloudModal";
|
import { UpscaylCloudModal } from "../components/UpscaylCloudModal";
|
||||||
import { FLAGS } from "@/utils/flags";
|
import { featureFlags } from "@common/feature-flags";
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
// STATES
|
// STATES
|
||||||
@ -505,7 +505,7 @@ const Home = () => {
|
|||||||
)}
|
)}
|
||||||
{/* HEADER */}
|
{/* HEADER */}
|
||||||
<Header version={version} />
|
<Header version={version} />
|
||||||
{!dontShowCloudModal && !FLAGS.APP_STORE_BUILD && (
|
{!dontShowCloudModal && !featureFlags.APP_STORE_BUILD && (
|
||||||
<button
|
<button
|
||||||
className="mb-5 rounded-btn p-1 mx-5 bg-success shadow-lg shadow-success/40 text-slate-50 animate-pulse text-sm"
|
className="mb-5 rounded-btn p-1 mx-5 bg-success shadow-lg shadow-success/40 text-slate-50 animate-pulse text-sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -19,6 +19,12 @@
|
|||||||
"@common/*": ["../common/*"]
|
"@common/*": ["../common/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../app.module.ts"],
|
"include": [
|
||||||
|
"next-env.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
"../app.module.ts",
|
||||||
|
"../common/**/*"
|
||||||
|
],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
export const FLAGS = {
|
|
||||||
APP_STORE_BUILD: true,
|
|
||||||
};
|
|
112
tsconfig.json
112
tsconfig.json
@ -1,107 +1,15 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
"target": "es2016",
|
||||||
|
"module": "commonjs",
|
||||||
/* Projects */
|
"rootDir": "./",
|
||||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
"outDir": "./export",
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
"esModuleInterop": true,
|
||||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
"forceConsistentCasingInFileNames": true,
|
||||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
"strict": true,
|
||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
"noImplicitAny": false,
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
"skipLibCheck": true
|
||||||
|
|
||||||
/* Language and Environment */
|
|
||||||
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
||||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
||||||
"jsx": "preserve" /* Specify what JSX code is generated. */,
|
|
||||||
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
||||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
||||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
||||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
||||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
||||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
||||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
||||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
||||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
||||||
|
|
||||||
/* Modules */
|
|
||||||
"module": "commonjs" /* Specify what module code is generated. */,
|
|
||||||
"rootDir": "./electron" /* Specify the root folder within your source files. */,
|
|
||||||
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
||||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
||||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
||||||
"rootDirs": [
|
|
||||||
"./electron",
|
|
||||||
"./renderer"
|
|
||||||
] /* Allow multiple folders to be treated as one when resolving modules. */,
|
|
||||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
||||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
||||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
||||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
||||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
||||||
|
|
||||||
/* JavaScript Support */
|
|
||||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
||||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
||||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
||||||
|
|
||||||
/* Emit */
|
|
||||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
||||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
||||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
||||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
||||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
||||||
"outDir": "./main" /* Specify an output folder for all emitted files. */,
|
|
||||||
// "removeComments": true, /* Disable emitting comments. */
|
|
||||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
||||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
||||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
||||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
||||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
||||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
||||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
||||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
||||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
||||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
||||||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
||||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
||||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
||||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
||||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
||||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
||||||
|
|
||||||
/* Interop Constraints */
|
|
||||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
||||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
||||||
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
||||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
||||||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
||||||
|
|
||||||
/* Type Checking */
|
|
||||||
"strict": true /* Enable all strict type-checking options. */,
|
|
||||||
"noImplicitAny": false /* Enable error reporting for expressions and declarations with an implied 'any' type. */,
|
|
||||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
||||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
||||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
||||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
||||||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
||||||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
||||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
||||||
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
||||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
||||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
||||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
||||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
||||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
||||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
||||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
||||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
||||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
||||||
|
|
||||||
/* Completeness */
|
|
||||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
||||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
||||||
},
|
},
|
||||||
|
"include": ["./electron/**/*", "./common/**/*"],
|
||||||
"exclude": ["node_modules", "public", "renderer"]
|
"exclude": ["node_modules", "public", "renderer"]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user