chore: update prettier configuration for print width (#519)
* feat: update prettier configuration for print width * chore: apply code formatting to entire repository * fix: remove build files * fix: format issue --------- Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
@@ -43,9 +43,7 @@ export const iconsUpdaterJob = createCronJob(EVERY_WEEK, {
|
||||
continue;
|
||||
}
|
||||
|
||||
const repositoryInDb = databaseIconGroups.find(
|
||||
(dbIconGroup) => dbIconGroup.slug === repositoryIconGroup.slug,
|
||||
);
|
||||
const repositoryInDb = databaseIconGroups.find((dbIconGroup) => dbIconGroup.slug === repositoryIconGroup.slug);
|
||||
const repositoryIconGroupId: string = repositoryInDb?.id ?? createId();
|
||||
if (!repositoryInDb?.id) {
|
||||
newIconRepositories.push({
|
||||
@@ -55,11 +53,7 @@ export const iconsUpdaterJob = createCronJob(EVERY_WEEK, {
|
||||
}
|
||||
|
||||
for (const icon of repositoryIconGroup.icons) {
|
||||
if (
|
||||
databaseIconGroups
|
||||
.flatMap((group) => group.icons)
|
||||
.some((dbIcon) => dbIcon.checksum === icon.checksum)
|
||||
) {
|
||||
if (databaseIconGroups.flatMap((group) => group.icons).some((dbIcon) => dbIcon.checksum === icon.checksum)) {
|
||||
skippedChecksums.push(icon.checksum);
|
||||
continue;
|
||||
}
|
||||
@@ -99,7 +93,5 @@ export const iconsUpdaterJob = createCronJob(EVERY_WEEK, {
|
||||
countDeleted += deadIcons.length;
|
||||
});
|
||||
|
||||
logger.info(
|
||||
`Updated database within ${stopWatch.getElapsedInHumanWords()} (-${countDeleted}, +${countInserted})`,
|
||||
);
|
||||
logger.info(`Updated database within ${stopWatch.getElapsedInHumanWords()} (-${countDeleted}, +${countInserted})`);
|
||||
});
|
||||
|
||||
@@ -6,10 +6,7 @@ interface CreateCronJobOptions {
|
||||
runOnStart?: boolean;
|
||||
}
|
||||
|
||||
export const createCronJob = (
|
||||
cronExpression: string,
|
||||
options: CreateCronJobOptions = { runOnStart: false },
|
||||
) => {
|
||||
export const createCronJob = (cronExpression: string, options: CreateCronJobOptions = { runOnStart: false }) => {
|
||||
return {
|
||||
withCallback: (callback: () => MaybePromise<void>) => {
|
||||
if (options.runOnStart) {
|
||||
|
||||
@@ -3,10 +3,7 @@ import { objectEntries } from "@homarr/common";
|
||||
import type { createCronJob } from "./creator";
|
||||
import { jobRegistry } from "./registry";
|
||||
|
||||
type Jobs = Record<
|
||||
string,
|
||||
ReturnType<ReturnType<typeof createCronJob>["withCallback"]>
|
||||
>;
|
||||
type Jobs = Record<string, ReturnType<ReturnType<typeof createCronJob>["withCallback"]>>;
|
||||
|
||||
export const createJobGroup = <TJobs extends Jobs>(jobs: TJobs) => {
|
||||
for (const [name, job] of objectEntries(jobs)) {
|
||||
|
||||
@@ -11,10 +11,7 @@ interface Queue<TInput extends z.ZodType = z.ZodType> {
|
||||
inputValidator: TInput;
|
||||
}
|
||||
|
||||
type Queues = Record<
|
||||
string,
|
||||
ReturnType<ReturnType<typeof createQueue>["withCallback"]>
|
||||
>;
|
||||
type Queues = Record<string, ReturnType<ReturnType<typeof createQueue>["withCallback"]>>;
|
||||
|
||||
export const createQueueClient = <TQueues extends Queues>(queues: TQueues) => {
|
||||
const queueRegistry = new Map<string, Queue>();
|
||||
@@ -31,10 +28,7 @@ export const createQueueClient = <TQueues extends Queues>(queues: TQueues) => {
|
||||
queueRegistry,
|
||||
client: objectKeys(queues).reduce(
|
||||
(acc, name) => {
|
||||
acc[name] = async (
|
||||
data: z.infer<TQueues[typeof name]["_input"]>,
|
||||
options,
|
||||
) => {
|
||||
acc[name] = async (data: z.infer<TQueues[typeof name]["_input"]>, options) => {
|
||||
if (typeof name !== "string") return;
|
||||
const queue = queueRegistry.get(name);
|
||||
if (!queue) return;
|
||||
@@ -42,10 +36,7 @@ export const createQueueClient = <TQueues extends Queues>(queues: TQueues) => {
|
||||
await queueChannel.addAsync({
|
||||
name,
|
||||
data,
|
||||
executionDate:
|
||||
typeof options === "object" && options.executionDate
|
||||
? options.executionDate
|
||||
: new Date(),
|
||||
executionDate: typeof options === "object" && options.executionDate ? options.executionDate : new Date(),
|
||||
});
|
||||
};
|
||||
return acc;
|
||||
|
||||
@@ -4,19 +4,14 @@ import { db } from "@homarr/db";
|
||||
import { serverSettings } from "@homarr/db/schema/sqlite";
|
||||
import { logger } from "@homarr/log";
|
||||
|
||||
import {
|
||||
defaultServerSettings,
|
||||
defaultServerSettingsKeys,
|
||||
} from "../../../packages/server-settings";
|
||||
import { defaultServerSettings, defaultServerSettingsKeys } from "../../../packages/server-settings";
|
||||
|
||||
export const seedServerSettingsAsync = async () => {
|
||||
const serverSettingsData = await db.query.serverSettings.findMany();
|
||||
let insertedSettingsCount = 0;
|
||||
|
||||
for (const settingsKey of defaultServerSettingsKeys) {
|
||||
if (
|
||||
serverSettingsData.some((setting) => setting.settingKey === settingsKey)
|
||||
) {
|
||||
if (serverSettingsData.some((setting) => setting.settingKey === settingsKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user