🔧 Refactoring

This commit is contained in:
2022-04-17 19:38:31 -07:00
parent 9548db5d63
commit d53ab0432e
4 changed files with 17 additions and 19 deletions

4
package-lock.json generated
View File

@@ -35,6 +35,7 @@
"moleculer-db": "^0.8.17", "moleculer-db": "^0.8.17",
"moleculer-db-adapter-mongo": "^0.4.7", "moleculer-db-adapter-mongo": "^0.4.7",
"moleculer-db-adapter-mongoose": "^0.8.12", "moleculer-db-adapter-mongoose": "^0.8.12",
"moleculer-io": "^2.0.0",
"moleculer-web": "^0.10.4", "moleculer-web": "^0.10.4",
"mongoosastic-ts": "^5.0.7", "mongoosastic-ts": "^5.0.7",
"mongoose": "^5.12.7", "mongoose": "^5.12.7",
@@ -61,7 +62,6 @@
"install": "^0.13.0", "install": "^0.13.0",
"jest": "^27.2.5", "jest": "^27.2.5",
"jest-cli": "^27.2.5", "jest-cli": "^27.2.5",
"moleculer-io": "^2.0.0",
"moleculer-repl": "^0.7.0", "moleculer-repl": "^0.7.0",
"npm": "^8.4.1", "npm": "^8.4.1",
"ts-jest": "^25.3.0", "ts-jest": "^25.3.0",
@@ -9234,7 +9234,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/moleculer-io/-/moleculer-io-2.0.0.tgz", "resolved": "https://registry.npmjs.org/moleculer-io/-/moleculer-io-2.0.0.tgz",
"integrity": "sha512-de/t7cG5at5KYPiukkR+cEnZ0nb0xRmSHkCoLrd7mmHfNI8+FwoUbg1fE2+Yt5aoEnVhpvY7UE2x8qcBOT6T3w==", "integrity": "sha512-de/t7cG5at5KYPiukkR+cEnZ0nb0xRmSHkCoLrd7mmHfNI8+FwoUbg1fE2+Yt5aoEnVhpvY7UE2x8qcBOT6T3w==",
"dev": true,
"dependencies": { "dependencies": {
"kleur": "^4.1.4", "kleur": "^4.1.4",
"lodash": "^4.17.21", "lodash": "^4.17.21",
@@ -22359,7 +22358,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/moleculer-io/-/moleculer-io-2.0.0.tgz", "resolved": "https://registry.npmjs.org/moleculer-io/-/moleculer-io-2.0.0.tgz",
"integrity": "sha512-de/t7cG5at5KYPiukkR+cEnZ0nb0xRmSHkCoLrd7mmHfNI8+FwoUbg1fE2+Yt5aoEnVhpvY7UE2x8qcBOT6T3w==", "integrity": "sha512-de/t7cG5at5KYPiukkR+cEnZ0nb0xRmSHkCoLrd7mmHfNI8+FwoUbg1fE2+Yt5aoEnVhpvY7UE2x8qcBOT6T3w==",
"dev": true,
"requires": { "requires": {
"kleur": "^4.1.4", "kleur": "^4.1.4",
"lodash": "^4.17.21", "lodash": "^4.17.21",

View File

@@ -29,7 +29,6 @@
"install": "^0.13.0", "install": "^0.13.0",
"jest": "^27.2.5", "jest": "^27.2.5",
"jest-cli": "^27.2.5", "jest-cli": "^27.2.5",
"moleculer-io": "^2.0.0",
"moleculer-repl": "^0.7.0", "moleculer-repl": "^0.7.0",
"npm": "^8.4.1", "npm": "^8.4.1",
"ts-jest": "^25.3.0", "ts-jest": "^25.3.0",
@@ -47,6 +46,7 @@
"axios": "^0.25.0", "axios": "^0.25.0",
"axios-retry": "^3.2.4", "axios-retry": "^3.2.4",
"bree": "^7.1.5", "bree": "^7.1.5",
"moleculer-io": "^2.0.0",
"chokidar": "^3.5.3", "chokidar": "^3.5.3",
"delay": "^5.0.0", "delay": "^5.0.0",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",

View File

@@ -68,7 +68,7 @@ export default class SocketService extends Service {
actions: {}, actions: {},
methods: {}, methods: {},
async started() { async started() {
this.io.on("connection", (data) => console.log("Connected to socket.io server.")) this.io.on("connection", (data) => console.log("socket.io server initialized."))
} }
}, },
schema schema

View File

@@ -32,23 +32,22 @@ SOFTWARE.
*/ */
import { import {
createWriteStream, createReadStream, createWriteStream,
createReadStream,
promises as fs,
readFileSync,
existsSync, existsSync
} from "fs"; } from "fs";
import { isEmpty, isNil, isUndefined, remove } from "lodash";
import * as p7zip from "p7zip-threetwo";
import path from "path";
import sharp from "sharp";
import { IMPORT_IMAGE_FILE_FORMATS } from "../constants/allowedFileFormats";
import { USERDATA_DIRECTORY } from "../constants/directories";
import { checkFileExists, getFileConstituents } from "../utils/file.utils";
import { convertXMLToJSON } from "./xml.utils";
const fse = require("fs-extra"); const fse = require("fs-extra");
const Unrar = require("unrar"); const Unrar = require("unrar");
import path, { parse } from "path";
import * as p7zip from "p7zip-threetwo";
import { IExtractedComicBookCoverFile } from "threetwo-ui-typings";
import sharp from "sharp";
import { getFileConstituents, checkFileExists } from "../utils/file.utils";
import { flatten, isEmpty, isNil, isUndefined, remove } from "lodash";
import { convertXMLToJSON } from "./xml.utils";
import { USERDATA_DIRECTORY, COMICS_DIRECTORY } from "../constants/directories";
import { IMPORT_IMAGE_FILE_FORMATS } from "../constants/allowedFileFormats";
interface RarFile { interface RarFile {
name: string; name: string;
type: string; type: string;
@@ -63,6 +62,7 @@ interface RarFile {
} }
const UNRAR_BIN_PATH = process.env.UNRAR_BIN_PATH || "/opt/homebrew/bin/unrar"; const UNRAR_BIN_PATH = process.env.UNRAR_BIN_PATH || "/opt/homebrew/bin/unrar";
export const extractComicInfoXMLFromRar = async ( export const extractComicInfoXMLFromRar = async (
filePath: string filePath: string
): Promise<any> => { ): Promise<any> => {