♻️ Remove backend package (#1305)

This commit is contained in:
Luke Vella 2024-09-05 18:27:12 +01:00 committed by GitHub
parent 12af4d9c84
commit d40d4b27e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 29 additions and 102 deletions

View file

@ -19,12 +19,7 @@ const nextConfig = {
i18n: i18n, i18n: i18n,
productionBrowserSourceMaps: true, productionBrowserSourceMaps: true,
output: "standalone", output: "standalone",
transpilePackages: [ transpilePackages: ["@rallly/icons", "@rallly/ui", "@rallly/tailwind-config"],
"@rallly/backend",
"@rallly/icons",
"@rallly/ui",
"@rallly/tailwind-config",
],
webpack(config) { webpack(config) {
config.module.rules.push({ config.module.rules.push({
test: /\.svg$/, test: /\.svg$/,

View file

@ -18,7 +18,6 @@ const nextConfig = {
process.env.NEXT_PUBLIC_SELF_HOSTED === "true" ? "standalone" : undefined, process.env.NEXT_PUBLIC_SELF_HOSTED === "true" ? "standalone" : undefined,
productionBrowserSourceMaps: true, productionBrowserSourceMaps: true,
transpilePackages: [ transpilePackages: [
"@rallly/backend",
"@rallly/database", "@rallly/database",
"@rallly/icons", "@rallly/icons",
"@rallly/ui", "@rallly/ui",

View file

@ -24,14 +24,13 @@
"@next/bundle-analyzer": "^12.3.4", "@next/bundle-analyzer": "^12.3.4",
"@radix-ui/react-slot": "^1.0.1", "@radix-ui/react-slot": "^1.0.1",
"@radix-ui/react-switch": "^1.0.2", "@radix-ui/react-switch": "^1.0.2",
"@rallly/backend": "*",
"@rallly/billing": "*", "@rallly/billing": "*",
"@rallly/database": "*", "@rallly/database": "*",
"@rallly/emails": "*",
"@rallly/icons": "*", "@rallly/icons": "*",
"@rallly/languages": "*", "@rallly/languages": "*",
"@rallly/tailwind-config": "*", "@rallly/tailwind-config": "*",
"@rallly/ui": "*", "@rallly/ui": "*",
"@rallly/emails": "*",
"@sentry/nextjs": "*", "@sentry/nextjs": "*",
"@svgr/webpack": "^6.5.1", "@svgr/webpack": "^6.5.1",
"@t3-oss/env-nextjs": "^0.11.0", "@t3-oss/env-nextjs": "^0.11.0",
@ -40,6 +39,7 @@
"@trpc/client": "^10.13.0", "@trpc/client": "^10.13.0",
"@trpc/next": "^10.13.0", "@trpc/next": "^10.13.0",
"@trpc/react-query": "^10.13.0", "@trpc/react-query": "^10.13.0",
"@trpc/server": "^10.13.0",
"@upstash/ratelimit": "^1.2.1", "@upstash/ratelimit": "^1.2.1",
"@vercel/functions": "^1.0.2", "@vercel/functions": "^1.0.2",
"@vercel/kv": "^2.0.0", "@vercel/kv": "^2.0.0",
@ -51,9 +51,9 @@
"cookie": "^0.6.0", "cookie": "^0.6.0",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"dayjs": "^1.11.10", "dayjs": "^1.11.10",
"i18next": "^22.4.9",
"i18next-icu": "^2.3.0", "i18next-icu": "^2.3.0",
"i18next-resources-to-backend": "^1.1.4", "i18next-resources-to-backend": "^1.1.4",
"i18next": "^22.4.9",
"ics": "^3.1.0", "ics": "^3.1.0",
"intl-messageformat": "^10.3.4", "intl-messageformat": "^10.3.4",
"iron-session": "^6.3.1", "iron-session": "^6.3.1",
@ -71,8 +71,8 @@
"posthog-js": "^1.154.0", "posthog-js": "^1.154.0",
"posthog-node": "^4.0.1", "posthog-node": "^4.0.1",
"react-big-calendar": "^1.8.1", "react-big-calendar": "^1.8.1",
"react-hook-form": "^7.42.1",
"react-hook-form-persist": "^3.0.0", "react-hook-form-persist": "^3.0.0",
"react-hook-form": "^7.42.1",
"react-i18next": "^12.1.4", "react-i18next": "^12.1.4",
"react-remove-scroll": "^2.5.6", "react-remove-scroll": "^2.5.6",
"react-use": "^17.4.0", "react-use": "^17.4.0",

View file

@ -1,8 +1,8 @@
import { randomid } from "@rallly/backend/utils/nanoid";
import { NextRequest, NextResponse } from "next/server"; import { NextRequest, NextResponse } from "next/server";
import { encode, JWT } from "next-auth/jwt"; import { encode, JWT } from "next-auth/jwt";
import { absoluteUrl } from "@/utils/absolute-url"; import { absoluteUrl } from "@/utils/absolute-url";
import { randomid } from "@/utils/nanoid";
function getCookieSettings() { function getCookieSettings() {
const secure = absoluteUrl().startsWith("https://"); const secure = absoluteUrl().startsWith("https://");

View file

@ -1,5 +1,4 @@
"use client"; "use client";
import { AppRouter } from "@rallly/backend/trpc/routers";
import { TooltipProvider } from "@rallly/ui/tooltip"; import { TooltipProvider } from "@rallly/ui/tooltip";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { createTRPCReact } from "@trpc/react-query"; import { createTRPCReact } from "@trpc/react-query";
@ -9,6 +8,7 @@ import { useState } from "react";
import { I18nProvider } from "@/app/i18n/client"; import { I18nProvider } from "@/app/i18n/client";
import { UserProvider } from "@/components/user-provider"; import { UserProvider } from "@/components/user-provider";
import { AppRouter } from "@/trpc/routers";
import { ConnectedDayjsProvider } from "@/utils/dayjs"; import { ConnectedDayjsProvider } from "@/utils/dayjs";
import { trpcConfig } from "@/utils/trpc/config"; import { trpcConfig } from "@/utils/trpc/config";

View file

@ -1,9 +1,9 @@
import { DisableNotificationsPayload } from "@rallly/backend";
import { decryptToken } from "@rallly/backend/session";
import { prisma } from "@rallly/database"; import { prisma } from "@rallly/database";
import { GetServerSideProps } from "next"; import { GetServerSideProps } from "next";
import type { DisableNotificationsPayload } from "@/trpc/types";
import { getServerSession } from "@/utils/auth"; import { getServerSession } from "@/utils/auth";
import { decryptToken } from "@/utils/session";
const Page = () => { const Page = () => {
return null; return null;

View file

@ -1,5 +1,3 @@
import { createTRPCContext } from "@rallly/backend/trpc/context";
import { AppRouter, appRouter } from "@rallly/backend/trpc/routers";
import * as Sentry from "@sentry/nextjs"; import * as Sentry from "@sentry/nextjs";
import { createNextApiHandler } from "@trpc/server/adapters/next"; import { createNextApiHandler } from "@trpc/server/adapters/next";
import { Ratelimit } from "@upstash/ratelimit"; import { Ratelimit } from "@upstash/ratelimit";
@ -7,6 +5,8 @@ import { kv } from "@vercel/kv";
import requestIp from "request-ip"; import requestIp from "request-ip";
import { posthog, posthogApiHandler } from "@/app/posthog"; import { posthog, posthogApiHandler } from "@/app/posthog";
import { createTRPCContext } from "@/trpc/context";
import { AppRouter, appRouter } from "@/trpc/routers";
import { absoluteUrl, shortUrl } from "@/utils/absolute-url"; import { absoluteUrl, shortUrl } from "@/utils/absolute-url";
import { getServerSession, isEmailBlocked } from "@/utils/auth"; import { getServerSession, isEmailBlocked } from "@/utils/auth";
import { isSelfHosted } from "@/utils/constants"; import { isSelfHosted } from "@/utils/constants";

View file

@ -1,8 +1,9 @@
import { prisma } from "@rallly/database"; import { prisma } from "@rallly/database";
import { z } from "zod"; import { z } from "zod";
import { createToken, decryptToken } from "../../session"; import { generateOtp } from "@/utils/nanoid";
import { generateOtp } from "../../utils/nanoid"; import { createToken, decryptToken } from "@/utils/session";
import { publicProcedure, rateLimitMiddleware, router } from "../trpc"; import { publicProcedure, rateLimitMiddleware, router } from "../trpc";
import { RegistrationTokenPayload } from "../types"; import { RegistrationTokenPayload } from "../types";

View file

@ -1,7 +1,8 @@
import { prisma } from "@rallly/database"; import { prisma } from "@rallly/database";
import { z } from "zod"; import { z } from "zod";
import { createToken } from "../../../session"; import { createToken } from "@/utils/session";
import { publicProcedure, router } from "../../trpc"; import { publicProcedure, router } from "../../trpc";
import { DisableNotificationsPayload } from "../../types"; import { DisableNotificationsPayload } from "../../types";

View file

@ -2,7 +2,8 @@ import { prisma } from "@rallly/database";
import { TRPCError } from "@trpc/server"; import { TRPCError } from "@trpc/server";
import { z } from "zod"; import { z } from "zod";
import { createToken } from "../../../session"; import { createToken } from "@/utils/session";
import { publicProcedure, rateLimitMiddleware, router } from "../../trpc"; import { publicProcedure, rateLimitMiddleware, router } from "../../trpc";
import { DisableNotificationsPayload } from "../../types"; import { DisableNotificationsPayload } from "../../types";

View file

@ -1,7 +1,8 @@
import { prisma } from "@rallly/database"; import { prisma } from "@rallly/database";
import { z } from "zod"; import { z } from "zod";
import { getSubscriptionStatus } from "../../utils/auth"; import { getSubscriptionStatus } from "@/utils/subscription";
import { import {
possiblyPublicProcedure, possiblyPublicProcedure,
privateProcedure, privateProcedure,

View file

@ -1,7 +1,8 @@
import { initTRPC, TRPCError } from "@trpc/server"; import { initTRPC, TRPCError } from "@trpc/server";
import superjson from "superjson"; import superjson from "superjson";
import { getSubscriptionStatus } from "../utils/auth"; import { getSubscriptionStatus } from "@/utils/subscription";
import { TRPCContext } from "./context"; import { TRPCContext } from "./context";
const t = initTRPC.context<TRPCContext>().create({ const t = initTRPC.context<TRPCContext>().create({

View file

@ -1,6 +1,3 @@
import { RegistrationTokenPayload } from "@rallly/backend";
import { decryptToken } from "@rallly/backend/session";
import { generateOtp, randomid } from "@rallly/backend/utils/nanoid";
import { prisma } from "@rallly/database"; import { prisma } from "@rallly/database";
import { import {
GetServerSidePropsContext, GetServerSidePropsContext,
@ -19,11 +16,14 @@ import { Provider } from "next-auth/providers/index";
import { posthog } from "@/app/posthog"; import { posthog } from "@/app/posthog";
import { env } from "@/env"; import { env } from "@/env";
import type { RegistrationTokenPayload } from "@/trpc/types";
import { absoluteUrl } from "@/utils/absolute-url"; import { absoluteUrl } from "@/utils/absolute-url";
import { CustomPrismaAdapter } from "@/utils/auth/custom-prisma-adapter"; import { CustomPrismaAdapter } from "@/utils/auth/custom-prisma-adapter";
import { mergeGuestsIntoUser } from "@/utils/auth/merge-user"; import { mergeGuestsIntoUser } from "@/utils/auth/merge-user";
import { getEmailClient } from "@/utils/emails"; import { getEmailClient } from "@/utils/emails";
import { getValueByPath } from "@/utils/get-value-by-path"; import { getValueByPath } from "@/utils/get-value-by-path";
import { generateOtp, randomid } from "@/utils/nanoid";
import { decryptToken } from "@/utils/session";
const providers: Provider[] = [ const providers: Provider[] = [
// When a user registers, we don't want to go through the email verification process // When a user registers, we don't want to go through the email verification process

View file

@ -1,6 +1,6 @@
import { AppRouter } from "@rallly/backend/trpc/routers";
import { createTRPCNext } from "@trpc/next"; import { createTRPCNext } from "@trpc/next";
import type { AppRouter } from "@/trpc/routers";
import { trpcConfig } from "@/utils/trpc/config"; import { trpcConfig } from "@/utils/trpc/config";
export const trpc = createTRPCNext<AppRouter>({ export const trpc = createTRPCNext<AppRouter>({

View file

@ -1,4 +0,0 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
...require("@rallly/eslint-config")(__dirname),
};

View file

@ -1 +0,0 @@
export * from "./trpc/types";

View file

@ -1,11 +0,0 @@
import type { IncomingMessage, ServerResponse } from "http";
import { getIronSession } from "iron-session/edge";
import { sessionConfig } from "../session-config";
export const getSession = async (
req: Request | IncomingMessage,
res: Response | ServerResponse,
) => {
return getIronSession(req, res, sessionConfig);
};

View file

@ -1 +0,0 @@
export * from "./utils";

View file

@ -1,29 +0,0 @@
import { GetServerSideProps } from "next";
export function composeGetServerSideProps(
...fns: GetServerSideProps[]
): GetServerSideProps {
return async (ctx) => {
const res = { props: {} };
for (const getServerSideProps of fns) {
const fnRes = await getServerSideProps(ctx);
if ("notFound" in fnRes) {
return fnRes;
}
if ("redirect" in fnRes) {
return fnRes;
}
if ("props" in fnRes) {
res.props = {
...res.props,
...fnRes.props,
};
}
}
return res;
};
}

View file

@ -1,21 +0,0 @@
{
"name": "@rallly/backend",
"version": "0.0.0",
"private": true,
"scripts": {
"lint": "eslint .",
"type-check": "tsc --pretty --noEmit"
},
"main": "src/index.ts",
"types": "src/index.ts",
"dependencies": {
"@rallly/database": "*",
"@rallly/features": "*",
"@rallly/emails": "*",
"@rallly/utils": "*",
"@trpc/server": "^10.13.0",
"iron-session": "^6.3.1",
"spacetime": "^7.4.7",
"stripe": "^13.2.0"
}
}

View file

@ -1,5 +0,0 @@
{
"extends": "@rallly/tsconfig/next.json",
"include": ["**/*.ts", "**/*.tsx", "**/*.js"],
"exclude": ["node_modules"],
}

View file

@ -4943,9 +4943,9 @@
integrity sha512-pCLZfIgcnneq1AocPLvstALawZYWS/sbhujd4mwUwA3UXFBWC/D31ysPlbz7R1dhjxhhPaIM+C6pz8vmr2ctpw== integrity sha512-pCLZfIgcnneq1AocPLvstALawZYWS/sbhujd4mwUwA3UXFBWC/D31ysPlbz7R1dhjxhhPaIM+C6pz8vmr2ctpw==
"@trpc/server@^10.13.0": "@trpc/server@^10.13.0":
version "10.13.2" version "10.45.2"
resolved "https://registry.npmjs.org/@trpc/server/-/server-10.13.2.tgz" resolved "https://registry.yarnpkg.com/@trpc/server/-/server-10.45.2.tgz#5f2778c4810f93b5dc407146334f8da70a0b51fb"
integrity sha512-/5L09a7EHxRy1D6RIFsIt5fMJ8bBspMp/eDPjAH7T033f9AMyYx0jWU7r5lswoBVSbdUDJgxKyLzwXIrVNVisg== integrity sha512-wOrSThNNE4HUnuhJG6PfDRp4L2009KDVxsd+2VYH8ro6o/7/jwYZ8Uu5j+VaW+mOmc8EHerHzGcdbGNQSAUPgg==
"@trysound/sax@0.2.0": "@trysound/sax@0.2.0":
version "0.2.0" version "0.2.0"