Skip to content

Commit

Permalink
refactor: move index.ts to src
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackDark committed Nov 2, 2024
1 parent 18c1b69 commit b6052e5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN --mount=type=cache,id=pnpm,target=~/.pnpm-store pnpm install --frozen-lockfi

FROM base AS builder
COPY src src/
COPY index.ts esbuild.ts ./
COPY esbuild.ts ./

RUN pnpm run build

Expand Down
2 changes: 1 addition & 1 deletion esbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const externalizedModules = {};

await esbuild.build({
//inject: ["cjs-shim.ts"],
entryPoints: ["index.ts"],
entryPoints: ["./src/index.ts"],
bundle: true,
sourcemap: "inline",
platform: "node",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"coverage": "vitest run --coverage",
"generateApi": "tsx generate-api.ts && prettier src/__generated__ --write",
"lint": "prettier . --check",
"start": "tsx index.ts",
"start": "tsx src/index.ts",
"test": "vitest",
"typecheck": "tsc --noEmit"
},
Expand Down
33 changes: 13 additions & 20 deletions index.ts → src/index.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
import "dotenv/config";

import fs from "node:fs";
import { MergedCustomFormatResource } from "./src/__generated__/mergedTypes";
import { configureRadarrApi, configureSonarrApi, getArrApi, unsetApi } from "./src/api";
import { getConfig, validateConfig } from "./src/config";
import {
calculateCFsToManage,
loadCFFromConfig,
loadLocalCfs,
loadServerCustomFormats,
manageCf,
mergeCfSources,
} from "./src/custom-formats";
import { logHeading, logger } from "./src/logger";
import { calculateQualityDefinitionDiff, loadQualityDefinitionFromServer } from "./src/quality-definitions";
import { MergedCustomFormatResource } from "./__generated__/mergedTypes";
import { configureRadarrApi, configureSonarrApi, getArrApi, unsetApi } from "./api";
import { getConfig, validateConfig } from "./config";
import { calculateCFsToManage, loadCFFromConfig, loadLocalCfs, loadServerCustomFormats, manageCf, mergeCfSources } from "./custom-formats";
import { logHeading, logger } from "./logger";
import { calculateQualityDefinitionDiff, loadQualityDefinitionFromServer } from "./quality-definitions";
import {
calculateQualityProfilesDiff,
filterInvalidQualityProfiles,
loadQualityProfilesFromServer,
mapQualityProfiles,
} from "./src/quality-profiles";
import { cloneRecyclarrTemplateRepo, loadRecyclarrTemplates } from "./src/recyclarr-importer";
} from "./quality-profiles";
import { cloneRecyclarrTemplateRepo, loadRecyclarrTemplates } from "./recyclarr-importer";
import {
cloneTrashRepo,
loadQPFromTrash,
loadQualityDefinitionSonarrFromTrash,
loadSonarrTrashCFs,
transformTrashQPCFs,
transformTrashQPToTemplate,
} from "./src/trash-guide";
import { ArrType, CFProcessing, MappedMergedTemplates } from "./src/types/common.types";
import { ConfigQualityProfile, InputConfigArrInstance, InputConfigIncludeItem, MergedConfigInstance } from "./src/types/config.types";
import { TrashQualityDefintion } from "./src/types/trashguide.types";
import { DEBUG_CREATE_FILES, IS_DRY_RUN } from "./src/util";
} from "./trash-guide";
import { ArrType, CFProcessing, MappedMergedTemplates } from "./types/common.types";
import { ConfigQualityProfile, InputConfigArrInstance, InputConfigIncludeItem, MergedConfigInstance } from "./types/config.types";
import { TrashQualityDefintion } from "./types/trashguide.types";
import { DEBUG_CREATE_FILES, IS_DRY_RUN } from "./util";

/**
* Load data from trash, recyclarr, custom configs and merge.
Expand Down
11 changes: 3 additions & 8 deletions src/quality-definitions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import path from "node:path";
import { MergedQualityDefinitionResource } from "./__generated__/mergedTypes";
import { getArrApi } from "./api";
import { logger } from "./logger";
import { TrashQualityDefintion, TrashQualityDefintionQuality } from "./types/trashguide.types";
import { IS_LOCAL_SAMPLE_MODE, loadJsonFile } from "./util";

Expand Down Expand Up @@ -29,18 +28,14 @@ export const calculateQualityDefinitionDiff = (serverQDs: MergedQualityDefinitio
if (element) {
const changes: string[] = [];

if (!element.maxSize) {
logger.info(`No maxSize defined: ${element.title}`);
}

if (element.minSize !== tq.min) {
changes.push(`MinSize diff: ${element.minSize} - ${tq.min}`);
changes.push(`MinSize diff: Server ${element.minSize} - Config ${tq.min}`);
}
if (element.maxSize !== tq.max) {
changes.push(`MaxSize diff: ${element.maxSize} - ${tq.max}`);
changes.push(`MaxSize diff: Server ${element.maxSize} - Config ${tq.max}`);
}
if (element.preferredSize !== tq.preferred) {
changes.push(`PreferredSize diff: ${element.preferredSize} - ${tq.preferred}`);
changes.push(`PreferredSize diff: Server ${element.preferredSize} - Config ${tq.preferred}`);
}

if (changes.length > 0) {
Expand Down
14 changes: 13 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"module": "ESNext",
"moduleResolution": "Bundler",
"noUncheckedIndexedAccess": true,
"paths": {
"~/*": ["./src/*"]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,
"target": "ESNext"
},
"exclude": ["./dist"]
"exclude": ["./dist"],
"include": ["**/*.ts", "**/*.tsx"]
}

0 comments on commit b6052e5

Please sign in to comment.