mirror of
https://github.com/C4illin/ConvertX.git
synced 2026-11-12 17:20:54 +01:00
chore: use bun fmt and bun check (#685)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
e607bb5f1c
commit
2135c6b9f1
89 files changed
+156
-63
No files matched your search
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true
|
||||
"js/ts.tsdk.path": "node_modules/typescript/lib",
|
||||
"js/ts.tsdk.promptToUseWorkspaceVersion": true
|
||||
}
|
||||
@@ -26,7 +26,6 @@
|
||||
"knip": "^6.38.0",
|
||||
"npm-run-all2": "^9.0.3",
|
||||
"postcss": "^8.5.28",
|
||||
"prettier": "^3.9.9",
|
||||
"tailwind-scrollbar": "^4.0.2",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"typescript": "^5.9.3",
|
||||
@@ -530,8 +529,6 @@
|
||||
|
||||
"prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
|
||||
|
||||
"prettier": ["prettier@3.9.10", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA=="],
|
||||
|
||||
"prism-react-renderer": ["prism-react-renderer@2.4.1", "", { "dependencies": { "@types/prismjs": "^1.26.0", "clsx": "^2.0.0" }, "peerDependencies": { "react": ">=16.0.0" } }, "sha512-ey8Ls/+Di31eqzUxC46h8MksNuGx/n0AAC8uKpwFau4RPDYLuE3EXTp8N8G2vX2N7UC/+IXeNUnlWBGGcAG+Ig=="],
|
||||
|
||||
"punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
|
||||
|
||||
+12
-3
@@ -1,6 +1,15 @@
|
||||
[test]
|
||||
preload = ["./tests/preload.ts"]
|
||||
coverage = true
|
||||
coveragePathIgnorePatterns = [
|
||||
"tests/converters/helpers/commonTests.ts"
|
||||
]
|
||||
coveragePathIgnorePatterns = ["tests/converters/helpers/commonTests.ts"]
|
||||
|
||||
[fmt]
|
||||
arrowParens = "always"
|
||||
printWidth = 100
|
||||
singleQuote = false
|
||||
semi = true
|
||||
tabWidth = 2
|
||||
sortImports = true
|
||||
sortTailwindcss = false
|
||||
sortPackageJson = true
|
||||
jsdoc = true
|
||||
@@ -19,7 +19,8 @@
|
||||
"potrace",
|
||||
"soffice",
|
||||
"perl",
|
||||
"markitdown"
|
||||
"markitdown",
|
||||
"fmt"
|
||||
],
|
||||
"tailwind": {
|
||||
"entry": ["src/main.css"]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tools]
|
||||
bun = "1.4.4"
|
||||
|
||||
[env]
|
||||
JWT_SECRET = "aLongAndSecretStringUsedToSignTheJSONWebToken1234"
|
||||
FFMPEG_OUTPUT_ARGS = "-preset veryfast -threads 2"
|
||||
[tools]
|
||||
bun = "1.4.4"
|
||||
|
||||
[env]
|
||||
JWT_SECRET = "aLongAndSecretStringUsedToSignTheJSONWebToken1234"
|
||||
FFMPEG_OUTPUT_ARGS = "-preset veryfast -threads 2"
|
||||
+8
-9
@@ -1,22 +1,24 @@
|
||||
{
|
||||
"name": "convertx-frontend",
|
||||
"version": "0.20.0",
|
||||
"type": "module",
|
||||
"module": "src/index.tsx",
|
||||
"scripts": {
|
||||
"dev": "bun run --watch src/index.tsx",
|
||||
"hot": "bun run --hot src/index.tsx",
|
||||
"format": "npm-run-all 'format:*'",
|
||||
"format:eslint": "eslint --fix .",
|
||||
"format:prettier": "prettier --write .",
|
||||
"format:prettier": "bun fmt",
|
||||
"build:css": "bun x @tailwindcss/cli -i ./src/main.css -o ./public/generated.css",
|
||||
"build:js": "tsc",
|
||||
"build:bin": "bun run build:css && bun build --compile --minify --sourcemap --bytecode --format=esm --define 'process.env.NODE_ENV=\"production\"' src/index.tsx --outfile dist/convertx",
|
||||
"build:docker": "docker compose build",
|
||||
"build": "bun run build:css && bun run build:js",
|
||||
"lint": "npm-run-all 'lint:*'",
|
||||
"lint:tsc": "tsc --noEmit",
|
||||
"lint:tsc": "bun check",
|
||||
"lint:knip": "knip",
|
||||
"lint:eslint": "eslint .",
|
||||
"lint:prettier": "prettier --check .",
|
||||
"lint:prettier": "bun fmt --check",
|
||||
"lint:xss": "xss-scan",
|
||||
"test": "bun test --path-ignore-patterns=tests/integration",
|
||||
"test:integration": "docker build --target test -t convertx:test . && docker run --rm -t -v ./tests:/app/tests -v ./src:/app/src -v ./package.json:/app/package.json convertx:test bun test tests/integration"
|
||||
@@ -30,11 +32,6 @@
|
||||
"sanitize-filename": "^1.6.4",
|
||||
"tar": "^7.5.22"
|
||||
},
|
||||
"module": "src/index.tsx",
|
||||
"type": "module",
|
||||
"bun-create": {
|
||||
"start": "bun run src/index.tsx"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@kitajs/ts-html-plugin": "^4.1.4",
|
||||
@@ -48,12 +45,14 @@
|
||||
"knip": "^6.38.0",
|
||||
"npm-run-all2": "^9.0.3",
|
||||
"postcss": "^8.5.28",
|
||||
"prettier": "^3.9.9",
|
||||
"tailwind-scrollbar": "^4.0.2",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.70.1"
|
||||
},
|
||||
"bun-create": {
|
||||
"start": "bun run src/index.tsx"
|
||||
},
|
||||
"trustedDependencies": [
|
||||
"@parcel/watcher",
|
||||
"@tailwindcss/oxide",
|
||||
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* @type {import('prettier').Config}
|
||||
*/
|
||||
/** @type {import("prettier").Config} */
|
||||
const config = {
|
||||
arrowParens: "always",
|
||||
printWidth: 100,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import fs from "fs";
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import type { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
execFile as execFileOriginal,
|
||||
type ChildProcess,
|
||||
execFile as execFileOriginal,
|
||||
type ExecFileOptions,
|
||||
} from "node:child_process";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
// declare possible conversions
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
// declare possible conversions
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Cookie } from "elysia";
|
||||
import db from "../db/db";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { Cookie } from "elysia";
|
||||
|
||||
import db from "../db/db";
|
||||
import { MAX_CONVERT_PROCESS } from "../helpers/env";
|
||||
import { normalizeFiletype, normalizeOutputFiletype } from "../helpers/normalizeFiletype";
|
||||
import { convert as convertassimp, properties as propertiesassimp } from "./assimp";
|
||||
@@ -19,16 +21,16 @@ import { convert as convertInkscape, properties as propertiesInkscape } from "./
|
||||
import { convert as convertLibheif, properties as propertiesLibheif } from "./libheif";
|
||||
import { convert as convertLibjxl, properties as propertiesLibjxl } from "./libjxl";
|
||||
import { convert as convertLibreOffice, properties as propertiesLibreOffice } from "./libreoffice";
|
||||
import { convert as convertMarkitdown, properties as propertiesMarkitdown } from "./markitdown";
|
||||
import { convert as convertMsgconvert, properties as propertiesMsgconvert } from "./msgconvert";
|
||||
import { convert as convertPandoc, properties as propertiesPandoc } from "./pandoc";
|
||||
import { convert as convertPdftops, properties as propertiesPdftops } from "./pdftops";
|
||||
import { convert as convertPotrace, properties as propertiesPotrace } from "./potrace";
|
||||
import { convert as convertresvg, properties as propertiesresvg } from "./resvg";
|
||||
import { convert as convertVcf, properties as propertiesVcf } from "./vcf";
|
||||
import { convert as convertImage, properties as propertiesImage } from "./vips";
|
||||
import { convert as convertVtracer, properties as propertiesVtracer } from "./vtracer";
|
||||
import { convert as convertVcf, properties as propertiesVcf } from "./vcf";
|
||||
import { convert as convertxelatex, properties as propertiesxelatex } from "./xelatex";
|
||||
import { convert as convertMarkitdown, properties as propertiesMarkitdown } from "./markitdown";
|
||||
|
||||
// This should probably be reconstructed so that the functions are not imported instead the functions hook into this to make the converters more modular
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
// declare possible conversions
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { execFile as execFileOriginal } from "node:child_process";
|
||||
|
||||
import { ExecFileFn } from "./types";
|
||||
|
||||
export const properties = {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { exec } from "node:child_process";
|
||||
import { readFile } from "node:fs";
|
||||
|
||||
import { version } from "../../package.json";
|
||||
|
||||
console.log(`ConvertX v${version}`);
|
||||
|
||||
+3
-1
@@ -1,7 +1,9 @@
|
||||
import { rmSync } from "node:fs";
|
||||
|
||||
import { html } from "@elysiajs/html";
|
||||
import { staticPlugin } from "@elysiajs/static";
|
||||
import { Elysia } from "elysia";
|
||||
import { rmSync } from "node:fs";
|
||||
|
||||
import db from "./db/db";
|
||||
import { Jobs } from "./db/types";
|
||||
import { AUTO_DELETE_EVERY_N_HOURS, WEBROOT } from "./helpers/env";
|
||||
|
||||
+3
-3
@@ -20,13 +20,13 @@
|
||||
}
|
||||
|
||||
@utility article {
|
||||
@apply px-2 sm:px-4 py-4 mb-4 bg-neutral-800/40 w-full mx-auto max-w-4xl rounded-sm;
|
||||
@apply mx-auto mb-4 w-full max-w-4xl rounded-sm bg-neutral-800/40 px-2 py-4 sm:px-4;
|
||||
}
|
||||
|
||||
@utility btn-primary {
|
||||
@apply bg-accent-500 text-contrast rounded-sm p-2 sm:p-4 hover:bg-accent-400 cursor-pointer transition-colors;
|
||||
@apply bg-accent-500 text-contrast hover:bg-accent-400 cursor-pointer rounded-sm p-2 transition-colors sm:p-4;
|
||||
}
|
||||
|
||||
@utility btn-secondary {
|
||||
@apply bg-neutral-400 text-contrast rounded-sm p-2 sm:p-4 hover:bg-neutral-300 cursor-pointer transition-colors;
|
||||
@apply text-contrast cursor-pointer rounded-sm bg-neutral-400 p-2 transition-colors hover:bg-neutral-300 sm:p-4;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import Elysia, { t } from "elysia";
|
||||
|
||||
import { getPossibleTargets } from "../converters/main";
|
||||
import { userService } from "./user";
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { mkdir } from "node:fs/promises";
|
||||
|
||||
import { Elysia, t } from "elysia";
|
||||
import sanitize from "sanitize-filename";
|
||||
|
||||
import { outputDir, uploadsDir } from "..";
|
||||
import { handleConvert } from "../converters/main";
|
||||
import db from "../db/db";
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { unlink } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
import { Elysia, t } from "elysia";
|
||||
import sanitize from "sanitize-filename";
|
||||
|
||||
import { uploadsDir } from "..";
|
||||
import db from "../db/db";
|
||||
import { WEBROOT } from "../helpers/env";
|
||||
import { userService } from "./user";
|
||||
import sanitize from "sanitize-filename";
|
||||
import path from "node:path";
|
||||
|
||||
export const deleteFile = new Elysia().use(userService).post(
|
||||
"/delete",
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { rmSync } from "node:fs";
|
||||
|
||||
import { Elysia, t } from "elysia";
|
||||
|
||||
import { outputDir, uploadsDir } from "..";
|
||||
import db from "../db/db";
|
||||
import { Jobs } from "../db/types";
|
||||
import { WEBROOT } from "../helpers/env";
|
||||
import { userService } from "./user";
|
||||
import { Jobs } from "../db/types";
|
||||
|
||||
export const deleteJob = new Elysia()
|
||||
.use(userService)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import path from "node:path";
|
||||
|
||||
import { Elysia } from "elysia";
|
||||
import sanitize from "sanitize-filename";
|
||||
import * as tar from "tar";
|
||||
|
||||
import { outputDir } from "..";
|
||||
import db from "../db/db";
|
||||
import { WEBROOT } from "../helpers/env";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Elysia from "elysia";
|
||||
|
||||
import { userService } from "./user";
|
||||
|
||||
export const healthcheck = new Elysia().use(userService).get(
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
import { Elysia } from "elysia";
|
||||
|
||||
import { BaseHtml } from "../components/base";
|
||||
import { Header } from "../components/header";
|
||||
import db from "../db/db";
|
||||
import { Filename, Jobs } from "../db/types";
|
||||
import {
|
||||
ALLOW_UNAUTHENTICATED,
|
||||
BRANDING,
|
||||
HIDE_HISTORY,
|
||||
LANGUAGE,
|
||||
TIMEZONE,
|
||||
WEBROOT,
|
||||
BRANDING,
|
||||
} from "../helpers/env";
|
||||
import { userService } from "./user";
|
||||
import { EyeIcon } from "../icons/eye";
|
||||
import { DeleteIcon } from "../icons/delete";
|
||||
import { EyeIcon } from "../icons/eye";
|
||||
import { userService } from "./user";
|
||||
|
||||
export const history = new Elysia().use(userService).get(
|
||||
"/history",
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import Elysia from "elysia";
|
||||
|
||||
import { BaseHtml } from "../components/base";
|
||||
import { Header } from "../components/header";
|
||||
import { getAllInputs, getAllTargets } from "../converters/main";
|
||||
import { ALLOW_UNAUTHENTICATED, WEBROOT, BRANDING } from "../helpers/env";
|
||||
import { ALLOW_UNAUTHENTICATED, BRANDING, WEBROOT } from "../helpers/env";
|
||||
import { userService } from "./user";
|
||||
|
||||
export const listConverters = new Elysia().use(userService).get(
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Elysia } from "elysia";
|
||||
|
||||
import { BaseHtml } from "../components/base";
|
||||
import { Header } from "../components/header";
|
||||
import db from "../db/db";
|
||||
import { Filename, Jobs } from "../db/types";
|
||||
import { buildDownloadUrl } from "../helpers/buildDownloadUrl";
|
||||
import { ALLOW_UNAUTHENTICATED, WEBROOT, BRANDING } from "../helpers/env";
|
||||
import { DownloadIcon } from "../icons/download";
|
||||
import { ALLOW_UNAUTHENTICATED, BRANDING, WEBROOT } from "../helpers/env";
|
||||
import { DeleteIcon } from "../icons/delete";
|
||||
import { DownloadIcon } from "../icons/download";
|
||||
import { EyeIcon } from "../icons/eye";
|
||||
import { userService } from "./user";
|
||||
|
||||
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
import { randomInt } from "node:crypto";
|
||||
|
||||
import { JWTPayloadSpec } from "@elysiajs/jwt";
|
||||
import { Elysia, t } from "elysia";
|
||||
|
||||
import { BaseHtml } from "../components/base";
|
||||
import { Header } from "../components/header";
|
||||
import { getAllTargets } from "../converters/main";
|
||||
@@ -9,11 +11,11 @@ import { User } from "../db/types";
|
||||
import {
|
||||
ACCOUNT_REGISTRATION,
|
||||
ALLOW_UNAUTHENTICATED,
|
||||
BRANDING,
|
||||
HIDE_HISTORY,
|
||||
HTTP_ALLOWED,
|
||||
UNAUTHENTICATED_USER_SHARING,
|
||||
WEBROOT,
|
||||
BRANDING,
|
||||
} from "../helpers/env";
|
||||
import { FIRST_RUN, userService } from "./user";
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Elysia, t } from "elysia";
|
||||
import sanitize from "sanitize-filename";
|
||||
|
||||
import db from "../db/db";
|
||||
import { WEBROOT } from "../helpers/env";
|
||||
import { uploadsDir } from "../index";
|
||||
import { userService } from "./user";
|
||||
import sanitize from "sanitize-filename";
|
||||
|
||||
export const upload = new Elysia().use(userService).post(
|
||||
"/upload",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Elysia, t } from "elysia";
|
||||
|
||||
import { BaseHtml } from "../components/base";
|
||||
import { Header } from "../components/header";
|
||||
import db from "../db/db";
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
import { jwt } from "@elysiajs/jwt";
|
||||
import { Elysia, t } from "elysia";
|
||||
|
||||
import { WEBROOT } from "../helpers/env";
|
||||
import { isHtmlPageRequest } from "../helpers/isHtmlPageRequest";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/assimp";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/calibre";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
||||
import fs from "fs";
|
||||
import { beforeEach, afterEach, expect, test, describe } from "bun:test";
|
||||
|
||||
import { buildDaselArgs, convert } from "../../src/converters/dasel";
|
||||
import type { ExecFileFn } from "../../src/converters/types";
|
||||
import { captureConsole } from "./helpers/converters";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ExecFileException } from "node:child_process";
|
||||
import { expect, test } from "bun:test";
|
||||
import type { ExecFileException } from "node:child_process";
|
||||
|
||||
import { convert, properties } from "../../src/converters/djvu";
|
||||
import type { ExecFileFn } from "../../src/converters/types";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/dvisvgm";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { afterAll, afterEach, beforeEach, expect, test } from "bun:test";
|
||||
import { convert } from "../../src/converters/ffmpeg";
|
||||
import type { ExecFileOptions } from "node:child_process";
|
||||
|
||||
import { convert } from "../../src/converters/ffmpeg";
|
||||
import { captureConsole } from "./helpers/converters";
|
||||
|
||||
let calls: string[][] = [];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/graphicsmagick";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { test } from "bun:test";
|
||||
|
||||
import { ConvertFnWithExecFile } from "../../../src/converters/types";
|
||||
import {
|
||||
runConvertFailTest,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { expect } from "bun:test";
|
||||
|
||||
import type { ConvertFnWithExecFile, ExecFileFn } from "../../../src/converters/types";
|
||||
|
||||
type ExecFileCall = { cmd: string; args: string[] };
|
||||
|
||||
/**
|
||||
* Creates an execFile replacement that records every invocation and answers with the
|
||||
* given error/stdout/stderr, so converter tests never spawn real binaries.
|
||||
* Creates an execFile replacement that records every invocation and answers with the given
|
||||
* error/stdout/stderr, so converter tests never spawn real binaries.
|
||||
*/
|
||||
export function createMockExecFile({
|
||||
error = null,
|
||||
@@ -21,8 +22,8 @@ export function createMockExecFile({
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects console.log/error/warn into arrays so tests can assert on them without
|
||||
* printing to the terminal. Always call restore() afterwards (e.g. in afterEach).
|
||||
* Redirects console.log/error/warn into arrays so tests can assert on them without printing to the
|
||||
* terminal. Always call restore() afterwards (e.g. in afterEach).
|
||||
*/
|
||||
export function captureConsole() {
|
||||
const original = { log: console.log, error: console.error, warn: console.warn };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/imagemagick";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/inkscape";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/libheif";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/libjxl";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { afterEach, beforeEach, expect, test } from "bun:test";
|
||||
import { convert } from "../../src/converters/libreoffice";
|
||||
|
||||
import { convert, filters, getFilters } from "../../src/converters/libreoffice";
|
||||
import type { ExecFileFn } from "../../src/converters/types";
|
||||
import { filters, getFilters } from "../../src/converters/libreoffice";
|
||||
|
||||
function requireDefined<T>(value: T, msg: string): NonNullable<T> {
|
||||
if (value === undefined || value === null) throw new Error(msg);
|
||||
|
||||
@@ -3,7 +3,9 @@ import { mkdirSync, mkdtempSync, rmSync } from "node:fs";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
import type { Cookie } from "elysia";
|
||||
|
||||
import { properties as libreofficeProperties } from "../../src/converters/libreoffice";
|
||||
import { captureConsole } from "./helpers/converters";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { afterEach, beforeEach, expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/markitdown";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { captureConsole, createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { afterEach, beforeEach, expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/msgconvert";
|
||||
import { captureConsole, createMockExecFile } from "./helpers/converters";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test, describe } from "bun:test";
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/pandoc";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { afterEach, beforeEach, expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/pdftops";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { captureConsole, createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/potrace";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/resvg";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { afterAll, beforeAll, expect, test, describe } from "bun:test";
|
||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import { mkdtempSync, rmSync } from "node:fs";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { convert, parseVCF, toCSV } from "../../src/converters/vcf";
|
||||
|
||||
describe("parseVCF", () => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/vips";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { afterEach, beforeEach, expect, test, describe } from "bun:test";
|
||||
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/vtracer";
|
||||
import { captureConsole, createMockExecFile } from "./helpers/converters";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { convert } from "../../src/converters/xelatex";
|
||||
import { runCommonTests } from "./helpers/commonTests";
|
||||
import { createMockExecFile } from "./helpers/converters";
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { test, expect, beforeEach, afterEach } from "bun:test";
|
||||
import { Database } from "bun:sqlite";
|
||||
import { unlinkSync, existsSync } from "node:fs";
|
||||
import { afterEach, beforeEach, expect, test } from "bun:test";
|
||||
import { existsSync, unlinkSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
const testRoot = process.env.CONVERTX_TEST_ROOT;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { test, expect } from "bun:test";
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { normalizeFiletype, normalizeOutputFiletype } from "../../src/helpers/normalizeFiletype";
|
||||
|
||||
test("normalizeFiletype maps known inputs", () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { Elysia } from "elysia";
|
||||
|
||||
import { isHtmlPageRequest } from "../../src/helpers/isHtmlPageRequest";
|
||||
import { userService } from "../../src/services/user";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import { request } from "./helpers/app";
|
||||
|
||||
async function conversionsFor(fileType: string) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { mkdirSync } from "node:fs";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
|
||||
import { createJob, createUser, db, jobDirs, request, waitFor } from "./helpers/app";
|
||||
|
||||
type JobRow = { status: string; num_files: number };
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
||||
|
||||
import { createJob, createUser, jobDirs, request, uploadsDir } from "./helpers/app";
|
||||
|
||||
async function userWithUploads(...fileNames: string[]) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
||||
|
||||
import { createJob, createUser, db, jobDirs, request } from "./helpers/app";
|
||||
|
||||
async function userWithJobs(count = 1) {
|
||||
|
||||
@@ -2,7 +2,9 @@ import { describe, expect, test } from "bun:test";
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
import * as tar from "tar";
|
||||
|
||||
import { createJob, createUser, jobDirs, request } from "./helpers/app";
|
||||
|
||||
async function userWithOutputs(files: Record<string, string>) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import type { User } from "../../src/db/types";
|
||||
import { db, FIRST_ACCOUNT, firstRun as recordedFirstRun, SECOND_ACCOUNT } from "./helpers/app";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import { request } from "./helpers/app";
|
||||
|
||||
describe("GET /healthcheck", () => {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { mock } from "bun:test";
|
||||
|
||||
import { html } from "@elysiajs/html";
|
||||
import { Elysia } from "elysia";
|
||||
|
||||
import * as realEnvModule from "../../../src/helpers/env";
|
||||
|
||||
if (!process.env.CONVERTX_TEST_ROOT) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { afterEach, describe, expect, test } from "bun:test";
|
||||
|
||||
import { createJob, createUser, request, resetEnv, setEnv } from "./helpers/app";
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import { getAllInputs, getAllTargets } from "../../src/converters/main";
|
||||
import { createUser, request } from "./helpers/app";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { afterEach, describe, expect, test } from "bun:test";
|
||||
|
||||
import { buildDownloadUrl } from "../../src/helpers/buildDownloadUrl";
|
||||
import { createJob, createUser, request, resetEnv, setCookie, setEnv } from "./helpers/app";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { afterEach, describe, expect, test } from "bun:test";
|
||||
|
||||
import {
|
||||
app,
|
||||
createUser,
|
||||
|
||||
@@ -2,6 +2,7 @@ import { describe, expect, test } from "bun:test";
|
||||
import { existsSync, readdirSync } from "node:fs";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import { createJob, createUser, jobDirs, request } from "./helpers/app";
|
||||
|
||||
function uploadForm(...files: File[]) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { afterEach, describe, expect, test } from "bun:test";
|
||||
|
||||
import type { User } from "../../src/db/types";
|
||||
import {
|
||||
app,
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
import { jwt } from "@elysiajs/jwt";
|
||||
import { Elysia } from "elysia";
|
||||
|
||||
import { WEBROOT } from "../../src/helpers/env";
|
||||
import { userService } from "../../src/services/user";
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
"noEmit": false,
|
||||
"composite": true,
|
||||
"strict": true,
|
||||
"downlevelIteration": true,
|
||||
"skipLibCheck": true,
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "@kitajs/html",
|
||||
|
||||
Reference in new issue
Block a user