Skip to content

Commit

Permalink
refactor: bulk organize all import
Browse files Browse the repository at this point in the history
  • Loading branch information
vladjerca authored and seferturan committed Nov 14, 2024
1 parent b47e61e commit e264417
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 45 deletions.
6 changes: 3 additions & 3 deletions projects/api/src/contracts/calendars/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { builder } from '../_internal/builder.ts';
import { extendedQuerySchema } from '../_internal/request/extendedQuerySchema.ts';
import type { z } from '../_internal/z.ts';
import { calendarRequestParamsSchema } from './_internal/request/calendarParamsSchema.ts';
import { movieListResponseSchema } from './_internal/response/movieListResponseSchema.ts';
import { showListResponseSchema } from './_internal/response/showListResponseSchema.ts';
import { calendarRequestParamsSchema } from './_internal/request/calendarParamsSchema.ts';
import type { z } from '../_internal/z.ts';
import { extendedQuerySchema } from '../_internal/request/extendedQuerySchema.ts';

export const calendars = builder.router({
shows: {
Expand Down
6 changes: 3 additions & 3 deletions projects/api/src/contracts/oauth/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { builder } from '../_internal/builder.ts';
import { codeResponseSchema } from './_internal/response/codeResponseSchema.ts';
import { z } from '../_internal/z.ts';
import { codeRequestSchema } from './_internal/request/codeRequestSchema.ts';
import { tokenResponseSchema } from './_internal/response/tokenResponseSchema.ts';
import { tokenRequestSchema } from './_internal/request/tokenRequestSchema.ts';
import { z } from '../_internal/z.ts';
import { codeResponseSchema } from './_internal/response/codeResponseSchema.ts';
import { tokenResponseSchema } from './_internal/response/tokenResponseSchema.ts';

const device = builder.router({
code: {
Expand Down
7 changes: 3 additions & 4 deletions projects/api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Environment } from './Environment.ts';
import { initClient } from '@ts-rest/core';
import { traktContract } from './contracts/traktContract.ts';
import { Environment } from './Environment.ts';

export type * from './contracts/oauth/index.ts';
export type * from './contracts/calendars/index.ts';
export type * from './contracts/oauth/index.ts';
export type * from './contracts/users/index.ts';

export { traktContract };
export { Environment };
export { Environment, traktContract };

export type TraktApiOptions = {
/**
Expand Down
4 changes: 2 additions & 2 deletions projects/client/.vite/deno-sveltekit-exit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Plugin } from 'vite';
import { exit } from 'node:process';
import { existsSync } from 'node:fs';
import path from 'node:path';
import { exit } from 'node:process';
import type { Plugin } from 'vite';

export default function close(): Plugin {
return {
Expand Down
4 changes: 2 additions & 2 deletions projects/client/src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Handle } from '@sveltejs/kit';
import { i18n } from '$lib/features/i18n/index.ts';
import { sequence } from '@sveltejs/kit/hooks';
import { handle as handleTheme } from '$lib/features/theme/handle.ts';
import type { Handle } from '@sveltejs/kit';
import { sequence } from '@sveltejs/kit/hooks';

const handleParaglide: Handle = i18n.handle();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { EpisodeIntl } from './EpisodeIntl.ts';
import * as m from '$lib/features/i18n/messages.ts';
import { languageTag } from '$lib/features/i18n/index.ts';
import { toHumanDate } from '$lib/utils/date/toHumanDate.ts';
import * as m from '$lib/features/i18n/messages.ts';
import {
EpisodeFinaleType,
EpisodePremiereType,
} from '$lib/models/EpisodeType.ts';
import { toHumanDate } from '$lib/utils/date/toHumanDate.ts';
import type { EpisodeIntl } from './EpisodeIntl.ts';

export const EpisodeIntlProvider: EpisodeIntl = {
premiereText: ({ type }) => {
Expand Down
4 changes: 2 additions & 2 deletions projects/client/src/lib/features/auth/action.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { RequestEvent } from '@sveltejs/kit';
import { AUTH_COOKIE_NAME } from '$lib/features/auth/constants.ts';
import type { SerializedAuthResponse } from '$lib/features/auth/models/SerializedAuthResponse.ts';
import {
DeviceUnauthorizedError,
verifyDeviceAuth,
} from '$lib/requests/auth/verifyDeviceAuth.ts';
import type { SerializedAuthResponse } from '$lib/features/auth/models/SerializedAuthResponse.ts';
import type { RequestEvent } from '@sveltejs/kit';

export type AuthResponse = { token?: string };

Expand Down
4 changes: 2 additions & 2 deletions projects/client/src/lib/features/image/action.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IS_PROD } from '$lib/utils/env/index.ts';
import type { RequestEvent } from '@sveltejs/kit';
import type { SerializedImageResponse } from './models/SerializedImageResponse.ts';
import { Buffer } from 'node:buffer';
import { IS_PROD } from '$lib/utils/env/index.ts';
import type { SerializedImageResponse } from './models/SerializedImageResponse.ts';

const prodHandler = () => {
const message = [
Expand Down
6 changes: 3 additions & 3 deletions projects/client/src/lib/features/theme/action.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Theme } from './models/Theme.ts';
import type { RequestEvent } from '@sveltejs/kit';
import { coerceTheme } from '$lib/features/theme/utils/coerceTheme.ts';
import {
THEME_COOKIE_NAME,
THEME_FIELD_NAME,
} from '$lib/features/theme/constants.ts';
import { coerceTheme } from '$lib/features/theme/utils/coerceTheme.ts';
import type { RequestEvent } from '@sveltejs/kit';
import { Theme } from './models/Theme.ts';

export type ThemeResponse = { theme: Theme };

Expand Down
2 changes: 1 addition & 1 deletion projects/client/src/lib/features/theme/handle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { coerceTheme } from '$lib/features/theme/utils/coerceTheme.ts';
import { THEME_COOKIE_NAME } from '$lib/features/theme/constants.ts';
import { coerceTheme } from '$lib/features/theme/utils/coerceTheme.ts';
import type { Handle } from '@sveltejs/kit';

const THEME_PLACEHOLDER = '%theme.current%';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { SubmitFunction } from '@sveltejs/kit';
import type { ThemeResponse } from '$lib/features/theme/action.ts';
import type { SubmitFunction } from '@sveltejs/kit';

export type ThemeSubmitFunction = SubmitFunction<ThemeResponse>;
2 changes: 1 addition & 1 deletion projects/client/src/lib/features/theme/store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readonly, writable } from 'svelte/store';
import { Theme } from '$lib/features//theme/models/Theme.ts';
import { coerceTheme } from '$lib/features/theme/utils/coerceTheme.ts';
import { readonly, writable } from 'svelte/store';

export const nextTheme = (browser: boolean) => (theme: Theme) => {
switch (theme) {
Expand Down
2 changes: 1 addition & 1 deletion projects/client/src/lib/requests/_internal/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Environment, traktApi } from '@trakt/api';
import { IS_DEV, IS_PREVIEW } from '$lib/utils/env/index.ts';
import { Environment, traktApi } from '@trakt/api';

export const api = traktApi({
apiKey: TRAKT_CLIENT_ID,
Expand Down
2 changes: 1 addition & 1 deletion projects/client/src/lib/requests/auth/verifyDeviceAuth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { api } from '$lib/requests/_internal/api.ts';
import { env } from '$env/dynamic/private';
import { api } from '$lib/requests/_internal/api.ts';

export type DeviceAuth = {
token: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { api } from '../_internal/api.ts';
import { prependHttps } from '$lib/utils/url/prependHttps.ts';
import {
type EpisodeType,
EpisodeUnknownType,
} from '$lib/models/EpisodeType.ts';
import { prependHttps } from '$lib/utils/url/prependHttps.ts';
import { api } from '../_internal/api.ts';
import { authHeader } from '../_internal/authHeader.ts';

export type CalendarShowsParams = {
Expand Down
2 changes: 1 addition & 1 deletion projects/client/src/lib/utils/date/toHumanDate.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { toHumanDate } from '$lib/utils/date/toHumanDate.ts';
import { describe, expect, it } from 'vitest';

function stripTime(date: Date): Date {
return new Date(date.toDateString());
Expand Down
4 changes: 2 additions & 2 deletions projects/client/src/lib/utils/date/toHumanDate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { formatRelative } from 'date-fns/formatRelative';
import { LOCALE_MAP } from '$lib/utils/date/LOCALE_MAP.ts';
import { format } from 'date-fns/format';
import { formatRelative } from 'date-fns/formatRelative';
import { intervalToDuration } from 'date-fns/intervalToDuration';
import { LOCALE_MAP } from '$lib/utils/date/LOCALE_MAP.ts';

function stripTime(date: Date): Date {
return new Date(date.toDateString());
Expand Down
6 changes: 3 additions & 3 deletions projects/client/src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { THEME_COOKIE_NAME } from '$lib/features/theme/constants.ts';
import { type ServerLoad } from '@sveltejs/kit';
import { coerceTheme } from '$lib/features/theme/utils/coerceTheme.ts';
import { AUTH_COOKIE_NAME } from '$lib/features/auth/constants.ts';
import type { SerializedAuthResponse } from '$lib/features/auth/models/SerializedAuthResponse.ts';
import { THEME_COOKIE_NAME } from '$lib/features/theme/constants.ts';
import { coerceTheme } from '$lib/features/theme/utils/coerceTheme.ts';
import { type ServerLoad } from '@sveltejs/kit';

export const load: ServerLoad = ({ cookies }) => {
const theme = coerceTheme(cookies.get(THEME_COOKIE_NAME));
Expand Down
2 changes: 1 addition & 1 deletion projects/client/src/routes/auth/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Actions } from '@sveltejs/kit';
import { action as resolve } from '$lib/features/auth/action.ts';
import { initiateDeviceAuth } from '$lib/requests/auth/initiateDeviceAuth.ts';
import type { Actions } from '@sveltejs/kit';

export const actions = {
resolve,
Expand Down
4 changes: 2 additions & 2 deletions projects/client/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { paraglide } from '@inlang/paraglide-sveltekit/vite';
import { defineConfig } from 'vitest/config';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
import denoSveltekitExit from './.vite/deno-sveltekit-exit.ts';
import { Environment } from './src/lib/api.ts';

import path from 'node:path';
import fs from 'node:fs';
import path from 'node:path';
import process from 'node:process';

function findGitRoot(dir: string): string {
Expand Down
6 changes: 3 additions & 3 deletions projects/playground/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { TRAKT_CLIENT_ID } from './src/env/TRAKT_CLIENT_ID.ts';
import { TRAKT_CLIENT_SECRET } from './src/env/TRAKT_CLIENT_SECRET.ts';
import { Environment, traktApi } from '@trakt/api';
import { store, StoreKey } from './src/utils/store.ts';
import { createDeviceTokenPoller } from './src/createDeviceTokenPoller.ts';
import { TRAKT_CLIENT_ID } from './src/env/TRAKT_CLIENT_ID.ts';
import { TRAKT_CLIENT_SECRET } from './src/env/TRAKT_CLIENT_SECRET.ts';
import { logger } from './src/utils/logger.ts';
import { store, StoreKey } from './src/utils/store.ts';

const api = traktApi({
environment: Environment.production,
Expand Down
4 changes: 2 additions & 2 deletions projects/swagger/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { generateOpenApi } from '@ts-rest/open-api';
import { swaggerUI } from '@hono/swagger-ui';
import { traktContract } from '@trakt/api';
import { generateOpenApi } from '@ts-rest/open-api';
import { Hono } from 'hono';
import { swaggerUI } from '@hono/swagger-ui';

const swaggerJson = generateOpenApi(traktContract, {
info: {
Expand Down

0 comments on commit e264417

Please sign in to comment.