Update Supabase clients and refactor codebase

Refactored several Supabase client functions and updated them to use generics. Also, the '@kit/supabase-config' package was removed from the project and all references were replaced accordingly. The project's dependencies were updated as well, including the Supabase package which was upgraded to the latest version.
This commit is contained in:
giancarlo
2024-04-11 12:31:08 +08:00
parent 1c344d0d7f
commit 48f1ee90c4
29 changed files with 1337 additions and 96 deletions

View File

@@ -7,7 +7,6 @@ import { z } from 'zod';
import { getProductPlanPair } from '@kit/billing';
import { getBillingGatewayProvider } from '@kit/billing-gateway';
import { getLogger } from '@kit/shared/logger';
import { Database } from '@kit/supabase/database';
import { requireUser } from '@kit/supabase/require-user';
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
@@ -15,6 +14,7 @@ import { PersonalAccountCheckoutSchema } from '~/(dashboard)/home/(user)/billing
import appConfig from '~/config/app.config';
import billingConfig from '~/config/billing.config';
import pathsConfig from '~/config/paths.config';
import { Database } from '~/lib/database.types';
export class UserBillingService {
private readonly namespace = 'billing.personal-account';

View File

@@ -7,13 +7,13 @@ import { z } from 'zod';
import { LineItemSchema } from '@kit/billing';
import { getBillingGatewayProvider } from '@kit/billing-gateway';
import { getLogger } from '@kit/shared/logger';
import { Database } from '@kit/supabase/database';
import { requireUser } from '@kit/supabase/require-user';
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
import appConfig from '~/config/app.config';
import billingConfig from '~/config/billing.config';
import pathsConfig from '~/config/paths.config';
import { Database } from '~/lib/database.types';
import { TeamCheckoutSchema } from '../../_lib/schema/team-billing.schema';
@@ -314,7 +314,7 @@ async function getBillingPermissionsForAccountId(
* customer ID for the provided account ID
*/
async function getCustomerIdFromAccountId(
client: ReturnType<typeof getSupabaseServerActionClient>,
client: ReturnType<typeof getSupabaseServerActionClient<Database>>,
accountId: string,
) {
const { data, error } = await client

View File

@@ -2,7 +2,6 @@ import { SupabaseClient } from '@supabase/supabase-js';
import { PlusCircle } from 'lucide-react';
import { Database } from '@kit/supabase/database';
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
import {
AccountInvitationsTable,
@@ -21,6 +20,7 @@ import { If } from '@kit/ui/if';
import { PageBody, PageHeader } from '@kit/ui/page';
import { Trans } from '@kit/ui/trans';
import { Database } from '~/lib/database.types';
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
import { withI18n } from '~/lib/i18n/with-i18n';

View File

@@ -2,6 +2,8 @@ import { cache } from 'react';
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
import { Database } from '~/lib/database.types';
export const loadUserWorkspace = cache(async () => {
const client = getSupabaseServerComponentClient();
@@ -15,7 +17,7 @@ export const loadUserWorkspace = cache(async () => {
});
async function loadUserAccounts(
client: ReturnType<typeof getSupabaseServerComponentClient>,
client: ReturnType<typeof getSupabaseServerComponentClient<Database>>,
) {
const { data: accounts, error } = await client
.from('user_accounts')

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,17 @@
"format": "prettier --check \"**/*.{js,cjs,mjs,ts,tsx,md,json}\"",
"start": "pnpm with-env next start",
"typecheck": "tsc --noEmit",
"with-env": "dotenv -e ./.env.local --"
"with-env": "dotenv -e ./.env.local --",
"supabase:dev": "supabase status || supabase start",
"supabase:stop": "supabase stop",
"supabase:reset": "supabase db reset || supabase start",
"supabase:status": "supabase status",
"supabase:test": "supabase db test",
"supabase:db:lint": "supabase db lint",
"supabase:deploy": "supabase link --project-ref $SUPABASE_PROJECT_REF && supabase db push",
"supabase:typegen": "pnpm run supabase:typegen:packages && pnpm run supabase:typegen:app",
"supabase:typegen:packages": "supabase gen types typescript --local > ../../packages/supabase/src/database.types.ts",
"supabase:typegen:app": "supabase gen types typescript --local > ./lib/database.types.ts"
},
"dependencies": {
"@epic-web/invariant": "^1.0.0",
@@ -38,7 +48,6 @@
"@makerkit/data-loader-supabase-nextjs": "^0.0.9",
"@marsidev/react-turnstile": "^0.5.4",
"@radix-ui/react-icons": "^1.3.0",
"@supabase/ssr": "^0.3.0",
"@supabase/supabase-js": "^2.42.0",
"@tanstack/react-query": "5.28.6",
"@tanstack/react-query-next-experimental": "^5.29.0",
@@ -73,6 +82,7 @@
"dotenv-cli": "^7.4.1",
"eslint": "^8.57.0",
"prettier": "^3.2.5",
"supabase": "^1.153.4",
"tailwindcss": "3.4.1",
"typescript": "^5.4.3"
},
@@ -81,7 +91,8 @@
"extends": [
"@kit/eslint-config/base",
"@kit/eslint-config/nextjs",
"@kit/eslint-config/react"
"@kit/eslint-config/react",
"@kit/eslint-config/apps"
]
},
"prettier": "@kit/prettier-config"

View File

@@ -4,6 +4,10 @@
"engines": {
"node": ">=v18.17.1"
},
"author": {
"url": "https://makerkit.dev",
"name": "MakerKit"
},
"scripts": {
"build": "turbo build",
"clean": "git clean -xdf node_modules dist .next",
@@ -15,20 +19,14 @@
"lint": "turbo lint --continue -- --cache --cache-location 'node_modules/.cache/.eslintcache' && manypkg check",
"lint:fix": "turbo lint --continue -- --fix --cache --cache-location 'node_modules/.cache/.eslintcache' && manypkg fix",
"typecheck": "turbo typecheck",
"stripe:listen": "pnpm --filter '@kit/stripe' start",
"supabase:start": "turbo dev --filter @kit/supabase-config",
"supabase:stop": "pnpm --filter '@kit/supabase-config' stop",
"supabase:reset": "pnpm --filter '@kit/supabase-config' reset",
"supabase:lint": "pnpm --filter '@kit/supabase-config' lint",
"supabase:typegen": "pnpm --filter '@kit/supabase-config' typegen"
"stripe:listen": "pnpm --filter '@kit/stripe' start"
},
"prettier": "@kit/prettier-config",
"packageManager": "pnpm@8.15.5",
"workspaces": [
"apps/*",
"packages/**",
"tooling/*",
"supabase"
"tooling/*"
],
"dependencies": {
"@manypkg/cli": "^0.21.3",

View File

@@ -1,5 +1,6 @@
import 'server-only';
import { Database } from '@kit/supabase/database';
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
import { BillingGatewayService } from './billing-gateway.service';
@@ -18,7 +19,7 @@ export async function getBillingGatewayProvider(
}
async function getBillingProvider(
client: ReturnType<typeof getSupabaseServerActionClient>,
client: ReturnType<typeof getSupabaseServerActionClient<Database>>,
) {
const { data, error } = await client
.from('config')

View File

@@ -1,24 +1,18 @@
import { SupabaseClient } from '@supabase/supabase-js';
import { invariant } from '@epic-web/invariant';
import { createBrowserClient } from '@supabase/ssr';
import { Database } from '../database.types';
let client: SupabaseClient<Database>;
export function getSupabaseBrowserClient() {
/**
* @name getSupabaseBrowserClient
* @description Get a Supabase client for use in the Browser
*/
export function getSupabaseBrowserClient<GenericSchema = Database>() {
const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL;
const SUPABASE_ANON_KEY = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
invariant(SUPABASE_URL, `Supabase URL was not provided`);
invariant(SUPABASE_ANON_KEY, `Supabase Anon key was not provided`);
if (client) {
return client;
}
client = createBrowserClient<Database>(SUPABASE_URL, SUPABASE_ANON_KEY);
return client;
return createBrowserClient<GenericSchema>(SUPABASE_URL, SUPABASE_ANON_KEY);
}

View File

@@ -7,15 +7,17 @@ import { createServerClient } from '@supabase/ssr';
import { Database } from '../database.types';
import { getSupabaseClientKeys } from '../get-supabase-client-keys';
const createServerSupabaseClient = () => {
function createServerSupabaseClient() {
const keys = getSupabaseClientKeys();
return createServerClient<Database>(keys.url, keys.anonKey, {
cookies: getCookiesStrategy(),
});
};
}
export const getSupabaseServerActionClient = (params?: { admin: boolean }) => {
export function getSupabaseServerActionClient<
GenericSchema = Database,
>(params?: { admin: boolean }) {
const keys = getSupabaseClientKeys();
const admin = params?.admin ?? false;
@@ -32,7 +34,7 @@ export const getSupabaseServerActionClient = (params?: { admin: boolean }) => {
throw new Error('Supabase Service Role Key not provided');
}
return createServerClient<Database>(keys.url, serviceRoleKey, {
return createServerClient<GenericSchema>(keys.url, serviceRoleKey, {
auth: {
persistSession: false,
},
@@ -41,7 +43,7 @@ export const getSupabaseServerActionClient = (params?: { admin: boolean }) => {
}
return createServerSupabaseClient();
};
}
function getCookiesStrategy() {
const cookieStore = cookies();

View File

@@ -11,11 +11,11 @@ import { getSupabaseClientKeys } from '../get-supabase-client-keys';
* @name getSupabaseServerComponentClient
* @description Get a Supabase client for use in the Server Components
*/
export const getSupabaseServerComponentClient = (
export function getSupabaseServerComponentClient<GenericSchema = Database>(
params = {
admin: false,
},
) => {
) {
const keys = getSupabaseClientKeys();
if (params.admin) {
@@ -31,7 +31,7 @@ export const getSupabaseServerComponentClient = (
throw new Error('Supabase Service Role Key not provided');
}
return createServerClient<Database>(keys.url, serviceRoleKey, {
return createServerClient<GenericSchema>(keys.url, serviceRoleKey, {
auth: {
persistSession: false,
},
@@ -39,10 +39,10 @@ export const getSupabaseServerComponentClient = (
});
}
return createServerClient<Database>(keys.url, keys.anonKey, {
return createServerClient<GenericSchema>(keys.url, keys.anonKey, {
cookies: getCookiesStrategy(),
});
};
}
function getCookiesStrategy() {
const cookieStore = cookies();

59
pnpm-lock.yaml generated
View File

@@ -101,9 +101,6 @@ importers:
'@radix-ui/react-icons':
specifier: ^1.3.0
version: 1.3.0(react@18.2.0)
'@supabase/ssr':
specifier: ^0.3.0
version: 0.3.0(@supabase/supabase-js@2.42.0)
'@supabase/supabase-js':
specifier: ^2.42.0
version: 2.42.0
@@ -201,6 +198,9 @@ importers:
prettier:
specifier: ^3.2.5
version: 3.2.5
supabase:
specifier: ^1.153.4
version: 1.153.4
tailwindcss:
specifier: 3.4.1
version: 3.4.1
@@ -1173,12 +1173,6 @@ importers:
specifier: ^3.22.4
version: 3.22.4
supabase:
dependencies:
supabase:
specifier: ^1.151.1
version: 1.151.1
tooling/eslint:
dependencies:
'@next/eslint-plugin-next':
@@ -6455,6 +6449,7 @@ packages:
'@supabase/supabase-js': 2.42.0
cookie: 0.5.0
ramda: 0.29.1
dev: true
/@supabase/storage-js@2.5.5:
resolution: {integrity: sha512-OpLoDRjFwClwc2cjTJZG8XviTiQH4Ik8sCiMK5v7et0MDu2QlXjCAW3ljxJB5+z/KazdMOTnySi+hysxWUPu3w==}
@@ -7388,7 +7383,6 @@ packages:
debug: 4.3.4
transitivePeerDependencies:
- supports-color
dev: false
/aggregate-error@3.1.0:
resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==}
@@ -7686,7 +7680,7 @@ packages:
npm-normalize-package-bin: 3.0.1
read-cmd-shim: 4.0.0
write-file-atomic: 5.0.1
dev: false
dev: true
/binary-extensions@2.3.0:
resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
@@ -7911,7 +7905,7 @@ packages:
/chownr@2.0.0:
resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==}
engines: {node: '>=10'}
dev: false
dev: true
/chrome-trace-event@1.0.3:
resolution: {integrity: sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==}
@@ -7985,7 +7979,7 @@ packages:
/cmd-shim@6.0.2:
resolution: {integrity: sha512-+FFYbB0YLaAkhkcrjkyNLYDiOsFSfRjwjY19LXk/psmMx1z00xlCv7hhQoTGXXIKi+YXHL/iiFo8NqMVQX9nOw==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
dev: false
dev: true
/cmdk@1.0.0(@types/react-dom@18.2.24)(@types/react@18.2.75)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-gDzVf0a09TvoJ5jnuPvygTB77+XdOSwEmJ88L6XPFPlv7T3RxbP9jgenfylrAMD0+Le1aO0nVjQUzl2g+vjz5Q==}
@@ -8231,7 +8225,7 @@ packages:
/data-uri-to-buffer@4.0.1:
resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==}
engines: {node: '>= 12'}
dev: false
dev: true
/data-uri-to-buffer@6.0.2:
resolution: {integrity: sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==}
@@ -9163,7 +9157,7 @@ packages:
dependencies:
node-domexception: 1.0.0
web-streams-polyfill: 3.3.3
dev: false
dev: true
/figures@3.2.0:
resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==}
@@ -9262,7 +9256,7 @@ packages:
engines: {node: '>=12.20.0'}
dependencies:
fetch-blob: 3.2.0
dev: false
dev: true
/fraction.js@4.3.7:
resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==}
@@ -9317,7 +9311,7 @@ packages:
engines: {node: '>= 8'}
dependencies:
minipass: 3.3.6
dev: false
dev: true
/fs.realpath@1.0.0:
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
@@ -9702,7 +9696,6 @@ packages:
debug: 4.3.4
transitivePeerDependencies:
- supports-color
dev: false
/human-signals@2.1.0:
resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
@@ -11096,12 +11089,12 @@ packages:
engines: {node: '>=8'}
dependencies:
yallist: 4.0.0
dev: false
dev: true
/minipass@5.0.0:
resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==}
engines: {node: '>=8'}
dev: false
dev: true
/minipass@7.0.4:
resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==}
@@ -11113,7 +11106,7 @@ packages:
dependencies:
minipass: 3.3.6
yallist: 4.0.0
dev: false
dev: true
/mkdirp@0.5.6:
resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==}
@@ -11126,7 +11119,7 @@ packages:
resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}
engines: {node: '>=10'}
hasBin: true
dev: false
dev: true
/module-details-from-path@1.0.3:
resolution: {integrity: sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A==}
@@ -11335,7 +11328,7 @@ packages:
/node-domexception@1.0.0:
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
engines: {node: '>=10.5.0'}
dev: false
dev: true
/node-fetch@2.7.0:
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
@@ -11356,7 +11349,7 @@ packages:
data-uri-to-buffer: 4.0.1
fetch-blob: 3.2.0
formdata-polyfill: 4.0.10
dev: false
dev: true
/node-plop@0.26.3:
resolution: {integrity: sha512-Cov028YhBZ5aB7MdMWJEmwyBig43aGL5WT4vdoB28Oitau1zZAcHUn8Sgfk9HM33TqhtLJ9PlM/O0Mv+QpV/4Q==}
@@ -11407,7 +11400,7 @@ packages:
/npm-normalize-package-bin@3.0.1:
resolution: {integrity: sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
dev: false
dev: true
/npm-run-path@4.0.1:
resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}
@@ -12110,6 +12103,7 @@ packages:
/ramda@0.29.1:
resolution: {integrity: sha512-OfxIeWzd4xdUNxlWhgFazxsA/nl3mS4/jGZI5n00uWOoSSFRhC1b6gl6xvmzUamgmqELraWp0J/qqVlXYPDPyA==}
dev: true
/randombytes@2.1.0:
resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
@@ -12342,7 +12336,7 @@ packages:
/read-cmd-shim@4.0.0:
resolution: {integrity: sha512-yILWifhaSEEytfXI76kB9xEEiG1AiozaCJZ83A87ytjRiN+jVibXjedjCRNjoZviinhG+4UkalO3mWTd8u5O0Q==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
dev: false
dev: true
/read-yaml-file@1.1.0:
resolution: {integrity: sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA==}
@@ -13115,8 +13109,8 @@ packages:
pirates: 4.0.6
ts-interface-checker: 0.1.13
/supabase@1.151.1:
resolution: {integrity: sha512-fl4h9mgG3z+bQ7UntymT30yqvOPJ4AfiCDKvDCFAdpkDhiozSfQqh1LwytEQSqMpgt6PEAcDJdYEbvholqPKOQ==}
/supabase@1.153.4:
resolution: {integrity: sha512-dok/T9lu7ndDd7pzJOmnwlgr8mDyXNmdHBXx3Axhb1Dwy8igSHVwfLket6cp9zCAVNRhzrw+exjHxsIrPairPg==}
engines: {npm: '>=8'}
hasBin: true
requiresBuild: true
@@ -13127,7 +13121,7 @@ packages:
tar: 6.2.1
transitivePeerDependencies:
- supports-color
dev: false
dev: true
/supports-color@5.5.0:
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
@@ -13268,7 +13262,7 @@ packages:
minizlib: 2.1.2
mkdirp: 1.0.4
yallist: 4.0.0
dev: false
dev: true
/terser-webpack-plugin@5.3.10(@swc/core@1.3.101)(esbuild@0.19.11)(webpack@5.91.0):
resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==}
@@ -13823,7 +13817,7 @@ packages:
/web-streams-polyfill@3.3.3:
resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}
engines: {node: '>= 8'}
dev: false
dev: true
/webidl-conversions@3.0.1:
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
@@ -14013,7 +14007,7 @@ packages:
dependencies:
imurmurhash: 0.1.4
signal-exit: 4.1.0
dev: false
dev: true
/ws@7.5.9:
resolution: {integrity: sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==}
@@ -14109,7 +14103,6 @@ packages:
/yallist@4.0.0:
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
dev: false
/yaml@1.10.2:
resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==}

View File

@@ -2,4 +2,3 @@ packages:
- apps/*
- packages/**
- tooling/*
- supabase

View File

@@ -1,18 +0,0 @@
{
"name": "@kit/supabase-config",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "supabase status || supabase start",
"stop": "supabase stop",
"reset": "supabase db reset || supabase start",
"status": "supabase status",
"test": "supabase db test",
"db:lint": "supabase db lint",
"deploy": "supabase link --project-ref $SUPABASE_PROJECT_REF && supabase db push",
"typegen": "supabase gen types typescript --local > ../packages/supabase/src/database.types.ts"
},
"dependencies": {
"supabase": "^1.151.1"
}
}

29
tooling/eslint/apps.js Normal file
View File

@@ -0,0 +1,29 @@
/** @type {import("eslint").Linter.Config} */
const config = {
env: {
es2022: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
},
plugins: ['@typescript-eslint', 'import'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@kit/supabase/database',
importNames: ['Database'],
message:
'Please use the application types from your app "~/lib/database.types" instead',
},
],
},
],
},
};
module.exports = config;

View File

@@ -32,6 +32,18 @@ const config = {
2,
{ checksVoidReturn: { attributes: false } },
],
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'react-i18next',
importNames: ['Trans'],
message: 'Please use `@kit/ui/trans` instead',
},
],
},
],
},
ignorePatterns: [
'**/.eslintrc.cjs',

View File

@@ -4,9 +4,7 @@
"private": true,
"license": "MIT",
"files": [
"./base.js",
"./nextjs.js",
"./react.js"
"./apps.js"
],
"scripts": {
"clean": "rm -rf .turbo node_modules",
@@ -35,7 +33,7 @@
"eslintConfig": {
"root": true,
"extends": [
"./base.js"
"./apps.js"
]
},
"prettier": "@kit/prettier-config"