♻️ 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", "i18next-icu": "^2.3.0",
"intl-messageformat": "^10.3.4", "intl-messageformat": "^10.3.4",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"nanoid": "^4.0.0", "nanoid": "^5.0.8",
"next-i18next": "^13.0.3", "next-i18next": "^13.0.3",
"next-mdx-remote": "^5.0.0", "next-mdx-remote": "^5.0.0",
"next-seo": "^6.1.0", "next-seo": "^6.1.0",

View file

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

View file

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

View file

@ -1,5 +1,6 @@
import { prisma } from "@rallly/database"; import { prisma } from "@rallly/database";
import { absoluteUrl } from "@rallly/utils/absolute-url"; import { absoluteUrl } from "@rallly/utils/absolute-url";
import { generateOtp, randomid } from "@rallly/utils/nanoid";
import type { import type {
GetServerSidePropsContext, GetServerSidePropsContext,
NextApiRequest, NextApiRequest,
@ -22,7 +23,6 @@ import { env } from "@/env";
import type { RegistrationTokenPayload } from "@/trpc/types"; import type { RegistrationTokenPayload } from "@/trpc/types";
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"; import { decryptToken } from "@/utils/session";
const providers: Provider[] = [ const providers: Provider[] = [

View file

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

View file

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

20
packages/eslint-config/react.js vendored Normal file
View file

@ -0,0 +1,20 @@
const preset = require("./preset");
/** @return {import("eslint").Linter.Config} */
module.exports = function (workspaceDirPath) {
const baseConfig = preset(workspaceDirPath);
return {
...baseConfig,
extends: [
...baseConfig.extends,
"plugin:react/recommended",
"plugin:react-hooks/recommended",
],
settings: {
react: {
version: "detect",
},
},
};
};

View file

@ -3,10 +3,13 @@
"display": "Default", "display": "Default",
"extends": "@tsconfig/strictest/tsconfig.json", "extends": "@tsconfig/strictest/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"module": "ESNext",
"moduleResolution": "Bundler",
"noPropertyAccessFromIndexSignature": false, "noPropertyAccessFromIndexSignature": false,
"exactOptionalPropertyTypes": false, "exactOptionalPropertyTypes": false,
"noUncheckedIndexedAccess": false, "noUncheckedIndexedAccess": false,
"noImplicitReturns": false, "noImplicitReturns": false,
"verbatimModuleSyntax": true "verbatimModuleSyntax": true,
"skipLibCheck": true
} }
} }

View file

@ -1,5 +1,6 @@
{ {
"name": "@rallly/utils", "name": "@rallly/utils",
"type": "module",
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -8,6 +9,9 @@
"exports": { "exports": {
"./*": "./src/*.ts" "./*": "./src/*.ts"
}, },
"dependencies": {
"nanoid": "^5.0.8"
},
"devDependencies": { "devDependencies": {
"vitest": "^2.1.1" "vitest": "^2.1.1"
} }

View file

@ -2,6 +2,6 @@
"compilerOptions": { "compilerOptions": {
"types": ["vitest/globals"], "types": ["vitest/globals"],
}, },
"extends": "@rallly/tsconfig/react.json", "extends": "@rallly/tsconfig/base.json",
"include": ["**/*.ts", "**/*.tsx"], "include": ["**/*.ts", "**/*.tsx"],
} }

766
yarn.lock

File diff suppressed because it is too large Load diff