From 410c519953d662e51806d4111bc71914511bc3d5 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Fri, 19 May 2023 00:32:11 +0200 Subject: [PATCH] remove some default exports --- packages/backend/src/boot/master.ts | 2 +- packages/backend/src/config/load.ts | 2 +- packages/backend/src/server/file/index.ts | 2 +- packages/backend/src/server/file/send-drive-file.ts | 3 +-- packages/backend/src/server/web/feed.ts | 2 +- packages/backend/src/server/web/index.ts | 2 +- packages/backend/src/services/stream.ts | 4 +--- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/backend/src/boot/master.ts b/packages/backend/src/boot/master.ts index f68a2d310..7a27deb9a 100644 --- a/packages/backend/src/boot/master.ts +++ b/packages/backend/src/boot/master.ts @@ -8,7 +8,7 @@ import chalkTemplate from 'chalk-template'; import semver from 'semver'; import Logger from '@/services/logger.js'; -import loadConfig from '@/config/load.js'; +import { loadConfig } from '@/config/load.js'; import { Config } from '@/config/types.js'; import { showMachineInfo } from '@/misc/show-machine-info.js'; import { envOption } from '@/env.js'; diff --git a/packages/backend/src/config/load.ts b/packages/backend/src/config/load.ts index a6431162d..f16fb850b 100644 --- a/packages/backend/src/config/load.ts +++ b/packages/backend/src/config/load.ts @@ -23,7 +23,7 @@ const path = process.env.NODE_ENV === 'test' ? `${dir}/test.yml` : `${dir}/default.yml`; -export default function load(): Config { +export function loadConfig(): Config { const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../../built/meta.json`, 'utf-8')); const clientManifest = JSON.parse(fs.readFileSync(`${_dirname}/../../../../built/_client_dist_/manifest.json`, 'utf-8')); let config = yaml.load(fs.readFileSync(path, 'utf-8')) as Source; diff --git a/packages/backend/src/server/file/index.ts b/packages/backend/src/server/file/index.ts index 4c4707e61..56bf14f9a 100644 --- a/packages/backend/src/server/file/index.ts +++ b/packages/backend/src/server/file/index.ts @@ -8,7 +8,7 @@ import { dirname } from 'node:path'; import Koa from 'koa'; import cors from '@koa/cors'; import Router from '@koa/router'; -import sendDriveFile from './send-drive-file.js'; +import { sendDriveFile } from './send-drive-file.js'; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/server/file/send-drive-file.ts b/packages/backend/src/server/file/send-drive-file.ts index f5934540a..990dd98fe 100644 --- a/packages/backend/src/server/file/send-drive-file.ts +++ b/packages/backend/src/server/file/send-drive-file.ts @@ -27,8 +27,7 @@ const commonReadableHandlerGenerator = (ctx: Koa.Context) => (e: Error): void => ctx.set('Cache-Control', 'max-age=300'); }; -// eslint-disable-next-line import/no-default-export -export default async function(ctx: Koa.Context) { +export async function sendDriveFile(ctx: Koa.Context) { const key = ctx.params.key; // Fetch drive file diff --git a/packages/backend/src/server/web/feed.ts b/packages/backend/src/server/web/feed.ts index b83ccf188..497d677c6 100644 --- a/packages/backend/src/server/web/feed.ts +++ b/packages/backend/src/server/web/feed.ts @@ -4,7 +4,7 @@ import config from '@/config/index.js'; import { User } from '@/models/entities/user.js'; import { Notes, DriveFiles, UserProfiles, Users } from '@/models/index.js'; -export default async function(user: User) { +export async function packFeed(user: User) { const author = { link: `${config.url}/@${user.username}`, name: user.name || user.username, diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index 7fe462d43..7c04077d4 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -26,7 +26,7 @@ import { MINUTE, DAY } from '@/const.js'; import { genOpenapiSpec } from '../api/openapi/gen-spec.js'; import { urlPreviewHandler } from './url-preview.js'; import { manifestHandler } from './manifest.js'; -import packFeed from './feed.js'; +import { packFeed } from './feed.js'; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/services/stream.ts b/packages/backend/src/services/stream.ts index 0119d7fdf..87ddee19d 100644 --- a/packages/backend/src/services/stream.ts +++ b/packages/backend/src/services/stream.ts @@ -95,9 +95,7 @@ class Publisher { }; } -const publisher = new Publisher(); - -export default publisher; +export const publisher = new Publisher(); export const publishInternalEvent = publisher.publishInternalEvent; export const publishUserEvent = publisher.publishUserEvent;