♻️ Move nanoid to utils package (#1430)

This commit is contained in:
Luke Vella 2024-11-08 17:50:07 +00:00 committed by GitHub
parent d55131c2ab
commit 0fc7d0a0c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 371 additions and 439 deletions

View file

@ -28,7 +28,7 @@
"i18next-icu": "^2.3.0",
"intl-messageformat": "^10.3.4",
"lodash": "^4.17.21",
"nanoid": "^4.0.0",
"nanoid": "^5.0.8",
"next-i18next": "^13.0.3",
"next-mdx-remote": "^5.0.0",
"next-seo": "^6.1.0",

View file

@ -65,7 +65,7 @@
"lodash": "^4.17.21",
"lucide-react": "^0.387.0",
"micro": "^10.0.1",
"nanoid": "^4.0.0",
"nanoid": "^5.0.8",
"next-auth": "^4.24.5",
"next-i18next": "^13.0.3",
"php-serialize": "^4.1.1",

View file

@ -1,12 +1,11 @@
import languages from "@rallly/languages";
import { absoluteUrl } from "@rallly/utils/absolute-url";
import { randomid } from "@rallly/utils/nanoid";
import languageParser from "accept-language-parser";
import type { NextRequest, NextResponse } from "next/server";
import type { JWT } from "next-auth/jwt";
import { encode } from "next-auth/jwt";
import { randomid } from "@/utils/nanoid";
const supportedLocales = Object.keys(languages);
function getCookieSettings() {

View file

@ -1,5 +1,6 @@
import { prisma } from "@rallly/database";
import { absoluteUrl } from "@rallly/utils/absolute-url";
import { generateOtp, randomid } from "@rallly/utils/nanoid";
import type {
GetServerSidePropsContext,
NextApiRequest,
@ -22,7 +23,6 @@ import { env } from "@/env";
import type { RegistrationTokenPayload } from "@/trpc/types";
import { getEmailClient } from "@/utils/emails";
import { getValueByPath } from "@/utils/get-value-by-path";
import { generateOtp, randomid } from "@/utils/nanoid";
import { decryptToken } from "@/utils/session";
const providers: Provider[] = [

View file

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

View file

@ -1,6 +1,7 @@
import type { PollStatus } from "@rallly/database";
import { prisma } from "@rallly/database";
import { absoluteUrl, shortUrl } from "@rallly/utils/absolute-url";
import { nanoid } from "@rallly/utils/nanoid";
import { TRPCError } from "@trpc/server";
import dayjs from "dayjs";
import * as ics from "ics";
@ -10,7 +11,6 @@ import { posthog } from "@/app/posthog";
import { getEmailClient } from "@/utils/emails";
import { getTimeZoneAbbreviation } from "../../utils/date";
import { nanoid } from "../../utils/nanoid";
import {
possiblyPublicProcedure,
proProcedure,

View file

@ -1,13 +0,0 @@
import { customAlphabet } from "nanoid";
export const nanoid = customAlphabet(
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
12,
);
export const randomid = customAlphabet(
"0123456789abcdefghijklmnopqrstuvwxyz",
12,
);
export const generateOtp = customAlphabet("0123456789", 6);