Skip to content

Commit

Permalink
refactor: rename more packages
Browse files Browse the repository at this point in the history
- `graphql-server` -> `core-graphql-server`
- `logger` -> `core-logger`
- `ui` -> `core-ui`
- `tmdb` -> `feautre-tmdb`
- `type-utils` -> `util-types`

Related to #83
  • Loading branch information
JoosepAlviste committed Feb 5, 2024
1 parent 4c16d7c commit f9c695f
Show file tree
Hide file tree
Showing 189 changed files with 515 additions and 514 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ are split into features. The `src` folders contain some general, "global" files,
while the `src/features` folders contain feature-specific code.


#### Packages

These are the types of packages in the [`packages`](packages) folder:

- `core-`: Packages that provide reusable logic to be used in all other packages
- `feature-`: Packages containing business logic
- `util-`: Utilities and pure functions that don't usually have any
framework-specific code


### Generating a new package

A new package can be generated with:
Expand Down
8 changes: 4 additions & 4 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"@sentry/node": "^7.56.0",
"@sentry/tracing": "^7.56.0",
"@serieslist/core-db": "workspace:*",
"@serieslist/graphql-server": "workspace:*",
"@serieslist/logger": "workspace:*",
"@serieslist/tmdb": "workspace:*",
"@serieslist/core-graphql-server": "workspace:*",
"@serieslist/core-logger": "workspace:*",
"@serieslist/feature-tmdb": "workspace:*",
"bcryptjs": "^2.4.3",
"bullmq": "^4.1.0",
"dataloader": "^2.2.2",
Expand Down Expand Up @@ -76,8 +76,8 @@
"@serieslist/core-esbuild": "workspace:*",
"@serieslist/eslint-config-base": "workspace:*",
"@serieslist/prettier-config": "workspace:*",
"@serieslist/type-utils": "workspace:*",
"@serieslist/typescript-config-base": "workspace:*",
"@serieslist/util-types": "workspace:*",
"@types/bcryptjs": "^2.4.2",
"@types/jsonwebtoken": "^9.0.1",
"@types/node": "^18.15.3",
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/auth/auth.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UnauthorizedError, builder } from '@serieslist/graphql-server'
import { UnauthorizedError, builder } from '@serieslist/core-graphql-server'
import { ZodError } from 'zod'

import { UserRef } from '#/features/users'
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/auth/auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { randomBytes } from 'crypto'

import type { Context } from '@serieslist/graphql-server'
import type { Context } from '@serieslist/core-graphql-server'
import bcrypt from 'bcryptjs'
import jwt from 'jsonwebtoken'
import { ZodError } from 'zod'
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/auth/session.repository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { InsertSession } from '@serieslist/core-db'
import { session } from '@serieslist/core-db'
import type { DBContext } from '@serieslist/graphql-server'
import type { DBContext } from '@serieslist/core-graphql-server'
import { eq } from 'drizzle-orm'

import { head } from '#/utils/array'
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/features/series/__tests__/series.schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
mockTMDBDetailsRequest,
mockTMDBSearchRequest,
mockTMDBSeasonRequest,
} from '@serieslist/tmdb/test'
import type { NotWorthIt } from '@serieslist/type-utils'
} from '@serieslist/feature-tmdb/test'
import type { NotWorthIt } from '@serieslist/util-types'
import { subDays } from 'date-fns'
import { and, eq } from 'drizzle-orm'
import { nanoid } from 'nanoid'
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/features/series/__tests__/series.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
tmdbSeasonFactory,
mockTMDBDetailsRequest,
mockTMDBSeasonRequest,
} from '@serieslist/tmdb/test'
import type { LiterallyAnything } from '@serieslist/type-utils'
} from '@serieslist/feature-tmdb/test'
import type { LiterallyAnything } from '@serieslist/util-types'
import { subDays } from 'date-fns'
import { and, eq } from 'drizzle-orm'

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/series/episode.repository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { InsertEpisode } from '@serieslist/core-db'
import { episode, season, seenEpisode } from '@serieslist/core-db'
import type { DBContext } from '@serieslist/graphql-server'
import type { DBContext } from '@serieslist/core-graphql-server'
import {
and,
asc,
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/series/episodes.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Episode } from '@serieslist/core-db'
import type { DBContext, Context } from '@serieslist/graphql-server'
import type { DBContext, Context } from '@serieslist/core-graphql-server'
import index from 'just-index'

import { groupEntitiesByKeyToNestedArray } from '#/utils/groupEntitiesByKeyToNestedArray'
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/series/season.repository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { season } from '@serieslist/core-db'
import type { InsertSeason } from '@serieslist/core-db'
import type { DBContext, Context } from '@serieslist/graphql-server'
import type { DBContext, Context } from '@serieslist/core-graphql-server'
import { and, eq, inArray } from 'drizzle-orm'

export const findOne = async ({
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/series/season.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DBContext, Context } from '@serieslist/graphql-server'
import type { DBContext, Context } from '@serieslist/core-graphql-server'

import { groupEntitiesByKeyToNestedArray } from '#/utils/groupEntitiesByKeyToNestedArray'

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/series/series.repository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { episode, season, series, userSeriesStatus } from '@serieslist/core-db'
import type { InsertSeries, UserSeriesStatusStatus } from '@serieslist/core-db'
import type { DBContext, Context } from '@serieslist/graphql-server'
import type { DBContext, Context } from '@serieslist/core-graphql-server'
import { and, asc, desc, eq, getTableColumns, inArray, lt } from 'drizzle-orm'

import { head } from '#/utils/array'
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/features/series/series.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
NotFoundError,
UnauthorizedError,
builder,
} from '@serieslist/graphql-server'
import type { Context } from '@serieslist/graphql-server'
} from '@serieslist/core-graphql-server'
import type { Context } from '@serieslist/core-graphql-server'
import { ZodError } from 'zod'

import { exposeDate } from '#/utils/exposeDate'
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/features/series/series.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { InsertSeason } from '@serieslist/core-db'
import { UserSeriesStatusStatus } from '@serieslist/core-db'
import { NotFoundError } from '@serieslist/graphql-server'
import { NotFoundError } from '@serieslist/core-graphql-server'
import type {
DBContext,
AuthenticatedContext,
Context,
} from '@serieslist/graphql-server'
import { tmdbService } from '@serieslist/tmdb'
} from '@serieslist/core-graphql-server'
import { tmdbService } from '@serieslist/feature-tmdb'
import { addDays, isFuture, subDays } from 'date-fns'
import index from 'just-index'
import unique from 'just-unique'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { InsertUserSeriesStatus } from '@serieslist/core-db'
import { userSeriesStatus } from '@serieslist/core-db'
import type { DBContext } from '@serieslist/graphql-server'
import type { DBContext } from '@serieslist/core-graphql-server'
import { and, eq, inArray } from 'drizzle-orm'

export const findMany = async ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { InsertSeenEpisode } from '@serieslist/core-db'
import { seenEpisode } from '@serieslist/core-db'
import type { DBContext } from '@serieslist/graphql-server'
import type { DBContext } from '@serieslist/core-graphql-server'
import { and, eq, inArray } from 'drizzle-orm'

import { head } from '#/utils/array'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { InsertSeriesProgress } from '@serieslist/core-db'
import { seriesProgress } from '@serieslist/core-db'
import type { DBContext } from '@serieslist/graphql-server'
import type { DBContext } from '@serieslist/core-graphql-server'
import { and, eq, inArray, isNull } from 'drizzle-orm'

export const findMany = async ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
NotFoundError,
UnauthorizedError,
builder,
} from '@serieslist/graphql-server'
} from '@serieslist/core-graphql-server'

import { EpisodeRef, SeasonRef, SeriesRef } from '#/features/series'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { InsertSeriesProgress } from '@serieslist/core-db'
import { NotFoundError } from '@serieslist/graphql-server'
import { NotFoundError } from '@serieslist/core-graphql-server'
import type {
Context,
AuthenticatedContext,
DBContext,
} from '@serieslist/graphql-server'
import type { NonNullableFields } from '@serieslist/type-utils'
} from '@serieslist/core-graphql-server'
import type { NonNullableFields } from '@serieslist/util-types'
import index from 'just-index'

// TODO: Importing these from #/features/series causes a circular import error
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/features/tmdb/tmdbSeriesDetails.factory.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Series, Episode } from '@serieslist/core-db'
import type { TMDBEpisode, TMDBSeries } from '@serieslist/tmdb'
import type { TMDBEpisode, TMDBSeries } from '@serieslist/feature-tmdb'
import {
tmdbSeriesDetailsFactory as baseTmdbSeriesDetailsFactory,
tmdbEpisodeFactory as baseTmdbEpisodeFactory,
} from '@serieslist/tmdb/test'
import type { NotWorthIt } from '@serieslist/type-utils'
} from '@serieslist/feature-tmdb/test'
import type { NotWorthIt } from '@serieslist/util-types'
import { Factory } from 'fishery'
import filterObject from 'just-filter-object'

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/users/user.repository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { InsertUser } from '@serieslist/core-db'
import { user } from '@serieslist/core-db'
import type { DBContext } from '@serieslist/graphql-server'
import type { DBContext } from '@serieslist/core-graphql-server'
import { and, eq } from 'drizzle-orm'

import { head } from '#/utils/array'
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/users/users.schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { User } from '@serieslist/core-db'
import { builder } from '@serieslist/graphql-server'
import { builder } from '@serieslist/core-graphql-server'

export const UserRef = builder.objectRef<User>('User')

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/features/users/users.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { InsertUser } from '@serieslist/core-db'
import type { Context } from '@serieslist/graphql-server'
import type { Context } from '@serieslist/core-graphql-server'

import * as usersRepository from './user.repository'

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/lib/fastify.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import cookie, { type FastifyCookieOptions } from '@fastify/cookie'
import cors from '@fastify/cors'
import rateLimit from '@fastify/rate-limit'
import { getLoggerByEnvironment } from '@serieslist/logger'
import { getLoggerByEnvironment } from '@serieslist/core-logger'
import fastify from 'fastify'

import { config } from '#/config'
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/lib/logger.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { createLogger } from '@serieslist/logger'
import { createLogger } from '@serieslist/core-logger'

export const log = createLogger({ name: 'api' })
2 changes: 1 addition & 1 deletion apps/api/src/schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { builder } from '@serieslist/graphql-server'
import { builder } from '@serieslist/core-graphql-server'

import '#/features/auth/auth.schema'
import '#/features/users/users.schema'
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/schema/errors.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
NotFoundError,
UnauthorizedError,
builder,
} from '@serieslist/graphql-server'
} from '@serieslist/core-graphql-server'
import { ZodError, type ZodFormattedError } from 'zod'

export const ErrorInterfaceRef = builder
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/schema/scalars.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { builder } from '@serieslist/graphql-server'
import { builder } from '@serieslist/core-graphql-server'
import { LocalDateResolver } from 'graphql-scalars'

builder.addScalarType('Date', LocalDateResolver, {})
2 changes: 1 addition & 1 deletion apps/api/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useSentry } from '@envelop/sentry'
import { EnvelopArmorPlugin } from '@escape.tech/graphql-armor'
import type { Context } from '@serieslist/graphql-server'
import type { Context } from '@serieslist/core-graphql-server'
import type { FastifyRequest, FastifyReply } from 'fastify'
import { createYoga } from 'graphql-yoga'

Expand Down
7 changes: 5 additions & 2 deletions apps/api/src/test/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import {
seenEpisodeFactory,
userFactory,
} from '@serieslist/core-db-factories'
import type { AuthenticatedContext, Context } from '@serieslist/graphql-server'
import type { NotWorthIt } from '@serieslist/type-utils'
import type {
AuthenticatedContext,
Context,
} from '@serieslist/core-graphql-server'
import type { NotWorthIt } from '@serieslist/util-types'
import { type ExecutionResult, print } from 'graphql'
import { createYoga, type YogaInitialContext } from 'graphql-yoga'

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/utils/exposeDate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NotWorthIt } from '@serieslist/type-utils'
import type { NotWorthIt } from '@serieslist/util-types'

import { formatDate } from './date'

Expand Down
4 changes: 2 additions & 2 deletions apps/tmdbMockServer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"tsc": "tsc --noEmit"
},
"dependencies": {
"@serieslist/logger": "workspace:*",
"@serieslist/tmdb": "workspace:*",
"@serieslist/core-logger": "workspace:*",
"@serieslist/feature-tmdb": "workspace:*",
"fastify": "^4.18.0",
"just-omit": "^2.2.0"
},
Expand Down
4 changes: 2 additions & 2 deletions apps/tmdbMockServer/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import type {
TMDBSeason,
TMDBEpisode,
TMDBSearchResponse,
} from '@serieslist/tmdb'
} from '@serieslist/feature-tmdb'
import {
tmdbEpisodeFactory,
tmdbSeasonFactory,
tmdbSeriesDetailsFactory,
} from '@serieslist/tmdb/test'
} from '@serieslist/feature-tmdb/test'
import fastify from 'fastify'
import omit from 'just-omit'

Expand Down
6 changes: 3 additions & 3 deletions apps/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"@radix-ui/react-toggle": "^1.0.3",
"@radix-ui/react-tooltip": "^1.0.6",
"@sentry/react": "^7.56.0",
"@serieslist/logger": "workspace:*",
"@serieslist/ui": "workspace:*",
"@serieslist/core-logger": "workspace:*",
"@serieslist/core-ui": "workspace:*",
"@vanilla-extract/css": "^1.14.0",
"@vitejs/plugin-react": "^4.2.1",
"classnames": "^2.3.2",
Expand Down Expand Up @@ -67,7 +67,7 @@
"@serieslist/core-esbuild": "workspace:*",
"@serieslist/eslint-config-react": "workspace:*",
"@serieslist/prettier-config": "workspace:*",
"@serieslist/type-utils": "workspace:*",
"@serieslist/util-types": "workspace:*",
"@serieslist/typescript-config-base": "workspace:*",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/react": "^14.0.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import { Button, Icon, Link, Logo } from '@serieslist/ui'
import { Button, Icon, Link, Logo } from '@serieslist/core-ui'
import classNames from 'classnames'
import React, { useState } from 'react'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { iconColorVar } from '@serieslist/ui'
import { iconColorVar } from '@serieslist/core-ui'
import { globalStyle, style } from '@vanilla-extract/css'

import { responsive, vars, zIndex } from '#/styles/theme.css'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as NavigationMenu from '@radix-ui/react-navigation-menu'
import { Icon, Link, Text } from '@serieslist/ui'
import { Icon, Link, Text } from '@serieslist/core-ui'
import React, { useRef } from 'react'
import { CSSTransition } from 'react-transition-group'

Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/components/HomePage/HomePage.css.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVG_COLOR_VAR } from '@serieslist/ui'
import { SVG_COLOR_VAR } from '@serieslist/core-ui'
import { style } from '@vanilla-extract/css'

import { responsive, vars, zIndex } from '#/styles/theme.css'
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/components/HomePage/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Text, Title } from '@serieslist/ui'
import { Text, Title } from '@serieslist/core-ui'
import React from 'react'

import FunArrow from './FunArrow.svg?react'
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/components/NavSidebar/NavSidebar.css.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { iconColorVar } from '@serieslist/ui'
import { iconColorVar } from '@serieslist/core-ui'
import { globalStyle, style } from '@vanilla-extract/css'

import { vars } from '#/styles/theme.css'
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/components/NavSidebar/NavSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as NavigationMenu from '@radix-ui/react-navigation-menu'
import { Icon, Logo, Link, Tooltip } from '@serieslist/ui'
import { Icon, Logo, Link, Tooltip } from '@serieslist/core-ui'
import classNames from 'classnames'
import React from 'react'

Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/components/ThemeToggle/ThemeToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Toggle from '@radix-ui/react-toggle'
import { Tooltip } from '@serieslist/ui'
import { Tooltip } from '@serieslist/core-ui'
import classNames from 'classnames'
import React from 'react'

Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/context/PageContextContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NotWorthIt } from '@serieslist/type-utils'
import type { NotWorthIt } from '@serieslist/util-types'
import { createContext } from 'react'
import type { PageContext } from 'vike/types'

Expand Down
Loading

0 comments on commit f9c695f

Please sign in to comment.