From ea8b009f1b21d4a0429ca0b9f2e282530c77eedb Mon Sep 17 00:00:00 2001 From: Brandon Scott Date: Mon, 10 Apr 2023 13:15:33 -0400 Subject: [PATCH 01/58] chore: add jest config for ui package, convert Button tests to ts and fix existing assertions --- .github/workflows/ui-tests.yml | 30 ++++ package-lock.json | 135 +++++++++++++++++- package.json | 2 +- packages/shared-data/package.json | 4 +- packages/ui/jest.config.ts | 12 ++ packages/ui/package.json | 4 +- .../{Button.test.js => Button.test.tsx} | 48 ++++--- packages/ui/src/components/Button/Button.tsx | 27 ++-- 8 files changed, 221 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/ui-tests.yml create mode 100644 packages/ui/jest.config.ts rename packages/ui/src/components/Button/{Button.test.js => Button.test.tsx} (67%) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml new file mode 100644 index 00000000000..0898d33a8c1 --- /dev/null +++ b/.github/workflows/ui-tests.yml @@ -0,0 +1,30 @@ +name: UI Tests + +on: + pull_request: + branches: [master] + paths: + - 'packages/ui/**' + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install deps + run: npm ci + + - name: Run tests + run: npm run test:ui diff --git a/package-lock.json b/package-lock.json index 60f200cd147..727a93f1ab5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -949,6 +949,12 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/@adobe/css-tools": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.2.0.tgz", + "integrity": "sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==", + "dev": true + }, "node_modules/@algolia/autocomplete-core": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.8.3.tgz", @@ -9698,6 +9704,54 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/@testing-library/jest-dom": { + "version": "5.16.5", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.16.5.tgz", + "integrity": "sha512-N5ixQ2qKpi5OLYfwQmUb/5mSV9LneAcaUfp32pn4yCnpb8r/Yz0pXFPck21dIicKmi+ta5WRAknkZCfA8refMA==", + "dev": true, + "dependencies": { + "@adobe/css-tools": "^4.0.1", + "@babel/runtime": "^7.9.2", + "@types/testing-library__jest-dom": "^5.9.1", + "aria-query": "^5.0.0", + "chalk": "^3.0.0", + "css.escape": "^1.5.1", + "dom-accessibility-api": "^0.5.6", + "lodash": "^4.17.15", + "redent": "^3.0.0" + }, + "engines": { + "node": ">=8", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/@testing-library/jest-dom/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@testing-library/jest-dom/node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@testing-library/react": { "version": "12.1.5", "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-12.1.5.tgz", @@ -10411,6 +10465,15 @@ "integrity": "sha512-ipixuVrh2OdNmauvtT51o3d8z12p6LtFW9in7U79der/kwejjdNchQC5UMn5u/KxNoM7VHHOs/l8KS8uHxhODQ==", "dev": true }, + "node_modules/@types/testing-library__jest-dom": { + "version": "5.14.5", + "resolved": "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.5.tgz", + "integrity": "sha512-SBwbxYoyPIvxHbeHxTZX2Pe/74F/tX2/D3mMvzabdeJ25bBojfW0TyB8BHrbq/9zaaKICJZjLP+8r6AeZMFCuQ==", + "dev": true, + "dependencies": { + "@types/jest": "*" + } + }, "node_modules/@types/uglify-js": { "version": "3.17.1", "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.17.1.tgz", @@ -15105,6 +15168,12 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/css.escape": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==", + "dev": true + }, "node_modules/cssdb": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/cssdb/-/cssdb-4.4.0.tgz", @@ -38942,6 +39011,7 @@ "tailwindcss-radix": "^1.6.0" }, "devDependencies": { + "@testing-library/jest-dom": "^5.16.5", "@types/react": "^17.0.37", "@types/react-dom": "^17.0.11", "sql-formatter": "^12.2.0", @@ -39757,6 +39827,12 @@ } }, "dependencies": { + "@adobe/css-tools": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.2.0.tgz", + "integrity": "sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==", + "dev": true + }, "@algolia/autocomplete-core": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.8.3.tgz", @@ -46095,6 +46171,45 @@ } } }, + "@testing-library/jest-dom": { + "version": "5.16.5", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.16.5.tgz", + "integrity": "sha512-N5ixQ2qKpi5OLYfwQmUb/5mSV9LneAcaUfp32pn4yCnpb8r/Yz0pXFPck21dIicKmi+ta5WRAknkZCfA8refMA==", + "dev": true, + "requires": { + "@adobe/css-tools": "^4.0.1", + "@babel/runtime": "^7.9.2", + "@types/testing-library__jest-dom": "^5.9.1", + "aria-query": "^5.0.0", + "chalk": "^3.0.0", + "css.escape": "^1.5.1", + "dom-accessibility-api": "^0.5.6", + "lodash": "^4.17.15", + "redent": "^3.0.0" + }, + "dependencies": { + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "requires": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + } + } + } + }, "@testing-library/react": { "version": "12.1.5", "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-12.1.5.tgz", @@ -46768,6 +46883,15 @@ "integrity": "sha512-ipixuVrh2OdNmauvtT51o3d8z12p6LtFW9in7U79der/kwejjdNchQC5UMn5u/KxNoM7VHHOs/l8KS8uHxhODQ==", "dev": true }, + "@types/testing-library__jest-dom": { + "version": "5.14.5", + "resolved": "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.5.tgz", + "integrity": "sha512-SBwbxYoyPIvxHbeHxTZX2Pe/74F/tX2/D3mMvzabdeJ25bBojfW0TyB8BHrbq/9zaaKICJZjLP+8r6AeZMFCuQ==", + "dev": true, + "requires": { + "@types/jest": "*" + } + }, "@types/uglify-js": { "version": "3.17.1", "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.17.1.tgz", @@ -50447,6 +50571,12 @@ "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", "dev": true }, + "css.escape": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==", + "dev": true + }, "cssdb": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/cssdb/-/cssdb-4.4.0.tgz", @@ -67615,6 +67745,7 @@ "@supabase/auth-helpers-react": "^0.3.1", "@tailwindcss/forms": "^0.4.0", "@tailwindcss/typography": "^0.5.0", + "@testing-library/jest-dom": "^5.16.5", "@types/react": "^17.0.37", "@types/react-dom": "^17.0.11", "autoprefixer": "^10.4.2", @@ -67632,7 +67763,7 @@ "react-markdown": "^8.0.3", "react-syntax-highlighter": "^15.5.0", "remark-gfm": "^3.0.1", - "sql-formatter": "*", + "sql-formatter": "^12.2.0", "sse.js": "^0.6.1", "tailwind-merge": "^1.10.0", "tailwindcss": "^3.0.15", @@ -69355,7 +69486,7 @@ "framer-motion": "^6.5.1", "globby": "^12.0.2", "gray-matter": "^4.0.2", - "lottie-react": "*", + "lottie-react": "^2.4.0", "markdown-toc": "^1.2.0", "marked": "^4.0.12", "next": "12.3.2", diff --git a/package.json b/package.json index ad51ffaefd2..f3fd871ea46 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "docker:up": "cd docker && docker compose up", "docker:down": "cd docker && docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml down --remove-orphans", "docker:remove": "cd docker && docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml rm -vfs", - "test": "jest", + "test:ui": "turbo run test --filter=ui", "test:studio": "turbo run test --filter=studio", "perf:kong": "ab -t 5 -c 20 -T application/json http://localhost:8000/", "perf:meta": "ab -t 5 -c 20 -T application/json http://localhost:5555/tables", diff --git a/packages/shared-data/package.json b/packages/shared-data/package.json index 0658adfdbda..3a2165ffed7 100644 --- a/packages/shared-data/package.json +++ b/packages/shared-data/package.json @@ -3,9 +3,7 @@ "version": "0.0.0", "description": "Data shared between Supabase apps", "main": "./index.ts", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, + "scripts": {}, "author": "", "license": "MIT" } diff --git a/packages/ui/jest.config.ts b/packages/ui/jest.config.ts new file mode 100644 index 00000000000..1c86c7b4642 --- /dev/null +++ b/packages/ui/jest.config.ts @@ -0,0 +1,12 @@ +import type { Config } from '@jest/types' + +const config: Config.InitialOptions = { + preset: 'ts-jest', + setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'], + testEnvironment: 'jsdom', + // Restricting test file pattern to just tsx files since the js files need a babel preset to run + // and most likely won't pass now anyway - the tests were ported from the UI repo and are out of date + testRegex: '(.*\\.test.tsx$)', +} + +export default config diff --git a/packages/ui/package.json b/packages/ui/package.json index d0e4f7a2fe2..11872838919 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -5,7 +5,8 @@ "types": "./index.tsx", "license": "MIT", "scripts": { - "build:icons": "node --experimental-modules internals/populate-icons.js" + "build:icons": "node --experimental-modules internals/populate-icons.js", + "test": "jest" }, "dependencies": { "@headlessui/react": "^1.0.0", @@ -42,6 +43,7 @@ "tailwindcss-radix": "^1.6.0" }, "devDependencies": { + "@testing-library/jest-dom": "^5.16.5", "@types/react": "^17.0.37", "@types/react-dom": "^17.0.11", "sql-formatter": "^12.2.0", diff --git a/packages/ui/src/components/Button/Button.test.js b/packages/ui/src/components/Button/Button.test.tsx similarity index 67% rename from packages/ui/src/components/Button/Button.test.js rename to packages/ui/src/components/Button/Button.test.tsx index 0b8dd6e4fe7..a05fb6f2c02 100644 --- a/packages/ui/src/components/Button/Button.test.js +++ b/packages/ui/src/components/Button/Button.test.tsx @@ -1,32 +1,40 @@ import React from 'react' import { render, screen, fireEvent } from '@testing-library/react' -import Button from './Button' +import { Button, ButtonSize, ButtonType } from './Button' +import defaultTheme from '../../lib/theme/defaultTheme' -const SIZES = ['tiny', 'small', 'medium', 'large', 'xlarge'] -const TYPES = [ +const SIZES: ButtonSize[] = ['tiny', 'small', 'medium', 'large', 'xlarge'] +const TYPES: ButtonType[] = [ 'primary', 'default', 'secondary', + 'alternative', 'outline', 'dashed', 'link', 'text', + 'danger', + 'warning', ] describe('#Button', () => { it('should render button correctly', () => { const wrapper = render() + expect(wrapper.getByText('Button')).toBeInTheDocument() expect(() => wrapper.unmount()).not.toThrow() }) it('should render different text', () => { const wrapper = render() + expect(screen.getByText('Button')).toBeInTheDocument() + wrapper.rerender() + expect(screen.getByText('按钮')).toBeInTheDocument() }) - + it('should ignore events when disabled', () => { const WrapperButton = () => { const [state, setState] = React.useState('state1') @@ -36,9 +44,12 @@ describe('#Button', () => { ) } + render() expect(screen.getByText('state1')).toBeInTheDocument() + fireEvent.click(screen.getByText('state1')) + expect(screen.getByText('state1')).toBeInTheDocument() expect(screen.queryByText('state2')).not.toBeInTheDocument() }) @@ -57,31 +68,24 @@ describe('#Button', () => { expect(screen.queryByText('state2')).not.toBeInTheDocument() }) - it('should have "w-full" class', async () => { + it('should have "w-full" class when block is true', async () => { render() - expect(screen.queryByRole('button')).toHaveClass( - 'sbui-btn sbui-btn-primary sbui-btn--w-full sbui-btn-container--shadow sbui-btn--tiny' - ) + expect(screen.queryByRole('button')).toHaveClass('w-full') }) - it.each(TYPES)('should have "btn--%s" class', (type) => { + it.each(TYPES)(`should have %p class from theme`, (type) => { + const expected = defaultTheme.button.type[type] + render() - if (type !== 'text' && type !== 'link') { - expect(screen.queryByRole('button')).toHaveClass( - `sbui-btn sbui-btn-${type} sbui-btn-container--shadow sbui-btn--tiny` - ) - } else { - expect(screen.queryByRole('button')).toHaveClass( - `sbui-btn sbui-btn-${type} sbui-btn--tiny` - ) - } + expect(screen.queryByRole('button')).toHaveClass(expected) }) - it.each(SIZES)('should have "btn--%s" class', (size) => { + it.each(SIZES)('should have %p class from theme', (size) => { + const expected = defaultTheme.button.size[size] + render() - expect(screen.queryByRole('button')).toHaveClass( - `sbui-btn sbui-btn-primary sbui-btn-container--shadow sbui-btn--${size}` - ) + + expect(screen.queryByRole('button')).toHaveClass(expected) }) }) diff --git a/packages/ui/src/components/Button/Button.tsx b/packages/ui/src/components/Button/Button.tsx index f6f8108405d..05972794131 100644 --- a/packages/ui/src/components/Button/Button.tsx +++ b/packages/ui/src/components/Button/Button.tsx @@ -15,19 +15,9 @@ export interface ButtonProps extends React.HTMLAttributes { loading?: boolean loadingCentered?: boolean shadow?: boolean - size?: 'tiny' | 'small' | 'medium' | 'large' | 'xlarge' + size?: ButtonSize style?: React.CSSProperties - type?: - | 'primary' - | 'default' - | 'secondary' - | 'alternative' - | 'outline' - | 'dashed' - | 'link' - | 'text' - | 'danger' - | 'warning' + type?: ButtonType danger?: boolean htmlType?: 'button' | 'submit' | 'reset' ref?: any @@ -40,6 +30,19 @@ export interface ButtonProps extends React.HTMLAttributes { form?: string } +export type ButtonSize = 'tiny' | 'small' | 'medium' | 'large' | 'xlarge' +export type ButtonType = + | 'primary' + | 'default' + | 'secondary' + | 'alternative' + | 'outline' + | 'dashed' + | 'link' + | 'text' + | 'danger' + | 'warning' + interface CustomButtonProps extends React.HTMLAttributes {} interface RefHandle { From 55f9a89294e3a1a3cc8447bf0afedaec7da99e65 Mon Sep 17 00:00:00 2001 From: Brandon Scott Date: Wed, 12 Apr 2023 12:18:48 -0400 Subject: [PATCH 02/58] Remove imperative Button ref, add test for ref forwarding + not crashing when wrapped by Link --- .../ui/src/components/Button/Button.test.tsx | 21 +++++++++++++++++++ packages/ui/src/components/Button/Button.tsx | 21 +++---------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/packages/ui/src/components/Button/Button.test.tsx b/packages/ui/src/components/Button/Button.test.tsx index a05fb6f2c02..93e88e8650c 100644 --- a/packages/ui/src/components/Button/Button.test.tsx +++ b/packages/ui/src/components/Button/Button.test.tsx @@ -2,6 +2,7 @@ import React from 'react' import { render, screen, fireEvent } from '@testing-library/react' import { Button, ButtonSize, ButtonType } from './Button' import defaultTheme from '../../lib/theme/defaultTheme' +import Link from 'next/link' const SIZES: ButtonSize[] = ['tiny', 'small', 'medium', 'large', 'xlarge'] const TYPES: ButtonType[] = [ @@ -88,4 +89,24 @@ describe('#Button', () => { expect(screen.queryByRole('button')).toHaveClass(expected) }) + + it("shouldn't crash when wrapped with next/link", () => { + expect(() => + render( + + + + ) + ).not.toThrow() + }) + + it('should forward ref', () => { + const ref: React.MutableRefObject = { + current: null, + } + + render() + + expect(ref.current).toBeInstanceOf(HTMLButtonElement) + }) }) diff --git a/packages/ui/src/components/Button/Button.tsx b/packages/ui/src/components/Button/Button.tsx index 05972794131..145a9333ebb 100644 --- a/packages/ui/src/components/Button/Button.tsx +++ b/packages/ui/src/components/Button/Button.tsx @@ -1,4 +1,4 @@ -import React, { forwardRef, useRef, useImperativeHandle } from 'react' +import React, { forwardRef } from 'react' import { IconContext } from './../Icon/IconContext' import { IconLoader } from './../Icon/icons/IconLoader' @@ -45,12 +45,7 @@ export type ButtonType = interface CustomButtonProps extends React.HTMLAttributes {} -interface RefHandle { - // container: () => HTMLElement | null - button: () => HTMLButtonElement | null -} - -export const Button = forwardRef( +export const Button = forwardRef( ( { block, @@ -78,16 +73,6 @@ export const Button = forwardRef( }: ButtonProps, ref ) => { - // button ref - // const containerRef = useRef(null) - const buttonRef = useRef(null) - - useImperativeHandle(ref, () => ({ - button: () => { - return buttonRef.current - }, - })) - let __styles = styleHandler('button') // styles @@ -153,7 +138,7 @@ export const Button = forwardRef( //
- +
)} diff --git a/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx b/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx index 431cfb6afe9..a4c71cd7f19 100644 --- a/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx +++ b/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx @@ -4,17 +4,22 @@ import { TIER_QUERY_LIMITS } from '.' import Link from 'next/link' import { useRouter } from 'next/router' import { useFlag } from 'hooks' +import { StripeSubscription } from 'components/interfaces/Billing' +import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants' interface Props { show: boolean setShowUpgradePrompt: (value: boolean) => void + subscription: StripeSubscription | undefined } -const UpgradePrompt: React.FC = ({ show, setShowUpgradePrompt }) => { +const UpgradePrompt: React.FC = ({ show, setShowUpgradePrompt, subscription }) => { const router = useRouter() const { ref } = router.query - const teamTierEnabled = useFlag('teamTier') + // Team tier is enabled when the flag is turned on OR the user is already on the team tier (manually assigned by us) + const userIsOnTeamTier = subscription?.tier?.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM + const teamTierEnabled = useFlag('teamTier') || userIsOnTeamTier return ( {
- +
From 440103027d668c3126c711552e51165337cb7604 Mon Sep 17 00:00:00 2001 From: FatumaA <67555014+FatumaA@users.noreply.github.com> Date: Tue, 16 May 2023 15:00:52 +0300 Subject: [PATCH 15/58] docs: add uploadBinary func to flutter docs --- spec/supabase_dart_v1.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/supabase_dart_v1.yml b/spec/supabase_dart_v1.yml index 755d88492cc..c1af9f52256 100644 --- a/spec/supabase_dart_v1.yml +++ b/spec/supabase_dart_v1.yml @@ -1129,6 +1129,17 @@ functions: fileOptions: const FileOptions(cacheControl: '3600', upsert: false), ); ``` + - id: upload-file-on-web + name: Upload file on web + code: | + ```dart + final avatarFile = chosenFile.bytes; + final String path = await supabase.storage.from('avatars').uploadBinary( + 'public/avatar1.png', + avatarFile, + fileOptions: const FileOptions(cacheControl: '3600', upsert: false), + ); + ``` - id: from-update description: | From 9808c288522ad41e9ced44861f2aac0e3f86fd6c Mon Sep 17 00:00:00 2001 From: Andy Kenward <4893048+andykenward@users.noreply.github.com> Date: Tue, 16 May 2023 12:44:12 +0000 Subject: [PATCH 16/58] fix: warning using meta in _document --- apps/docs/pages/_document.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/docs/pages/_document.tsx b/apps/docs/pages/_document.tsx index 67f89450efd..4b0eeb64eef 100644 --- a/apps/docs/pages/_document.tsx +++ b/apps/docs/pages/_document.tsx @@ -3,9 +3,7 @@ import { Html, Head, Main, NextScript } from 'next/document' export default function Document() { return ( - - - +
From 08bcd7d2db9fde836c9f6876e2937378258d4bb4 Mon Sep 17 00:00:00 2001 From: Andy Kenward <4893048+andykenward@users.noreply.github.com> Date: Tue, 16 May 2023 13:22:49 +0000 Subject: [PATCH 17/58] fix: react svg attribute warnings --- apps/docs/components/DocsCoverLogo.tsx | 250 ++++++++++----------- apps/docs/components/Navigation/Footer.tsx | 16 +- 2 files changed, 133 insertions(+), 133 deletions(-) diff --git a/apps/docs/components/DocsCoverLogo.tsx b/apps/docs/components/DocsCoverLogo.tsx index 0634f188f18..b7065feb555 100644 --- a/apps/docs/components/DocsCoverLogo.tsx +++ b/apps/docs/components/DocsCoverLogo.tsx @@ -37,8 +37,8 @@ const DocsCoverLogo = () => { transition={pathMotionConfig.transition as any} d="M124.951 5.03906V224.602" stroke="url(#paint0_radial_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" + strokeOpacity="0.5" + strokeWidth="0.7" /> { transition={pathMotionConfig.transition as any} d="M125.25 191.383C167.828 191.383 202.344 156.867 202.344 114.289C202.344 71.7115 167.828 37.1953 125.25 37.1953C82.6724 37.1953 48.1562 71.7115 48.1562 114.289C48.1562 156.867 82.6724 191.383 125.25 191.383Z" stroke="var(--colors-scale11)" - stroke-opacity="0.1" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.1" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M33.7782 58.8377C48.6666 58.8377 60.7361 46.7682 60.7361 31.8798C60.7361 16.9913 48.6666 4.92188 33.7782 4.92188C18.8898 4.92188 6.82031 16.9913 6.82031 31.8798C6.82031 46.7682 18.8898 58.8377 33.7782 58.8377Z" stroke="url(#paint1_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M33.7782 223.664C48.6666 223.664 60.7361 211.594 60.7361 196.706C60.7361 181.817 48.6666 169.748 33.7782 169.748C18.8898 169.748 6.82031 181.817 6.82031 196.706C6.82031 211.594 18.8898 223.664 33.7782 223.664Z" stroke="url(#paint2_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M216.724 58.8377C231.612 58.8377 243.681 46.7682 243.681 31.8798C243.681 16.9913 231.612 4.92188 216.724 4.92188C201.835 4.92188 189.766 16.9913 189.766 31.8798C189.766 46.7682 201.835 58.8377 216.724 58.8377Z" stroke="url(#paint3_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M216.724 223.664C231.612 223.664 243.681 211.594 243.681 196.706C243.681 181.817 231.612 169.748 216.724 169.748C201.835 169.748 189.766 181.817 189.766 196.706C189.766 211.594 201.835 223.664 216.724 223.664Z" stroke="url(#paint4_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M60.7578 30.9199V197.027" stroke="url(#paint7_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M125.252 5.01953V223.562" stroke="url(#paint8_radial_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M149.809 4.83984L13.5996 178.866" stroke="url(#paint9_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M239.679 46.457L99.5703 223.643" stroke="url(#paint10_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M189.766 30.9199V197.027" stroke="url(#paint11_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M218.024 58.7344H32.498" stroke="url(#paint12_radial_0_1)" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M6.76172 95.4141H243.743" stroke="url(#paint13_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M6.76172 131.869H243.743" stroke="url(#paint14_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M218.024 169.846H32.498" stroke="var(--colors-scale11)" - stroke-opacity="0.1" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.1" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={pathMotionConfig.transition as any} d="M126.559 4.6867L126.559 224.254" stroke="url(#paint15_linear_0_1)" - stroke-opacity="0.5" - stroke-width="0.7" - stroke-miterlimit="10" - stroke-linejoin="bevel" + strokeOpacity="0.5" + strokeWidth="0.7" + strokeMiterlimit="10" + strokeLinejoin="bevel" /> { transition={logoMotionConfig.transition as any} d="M125.751 174.003C125.833 179.464 134.091 181.807 137.49 177.53L188.786 112.985C194.84 105.367 189.41 94.1317 179.674 94.1317H126.964L127.046 52.5389C126.964 47.078 119.027 44.7344 115.628 49.0116L65.5801 113.556C59.5255 121.175 64.9558 132.41 74.6925 132.41H125.161L125.751 174.003Z" fill="url(#paint16_linear_0_1)" - fill-opacity="0.79" - shape-rendering="crispEdges" + fillOpacity="0.79" + shapeRendering="crispEdges" /> { transition={pathMotionConfig.transition as any} d="M126.964 94.6797L126.416 94.1306L126.498 52.5425C126.459 50.117 124.68 48.3327 122.422 47.6478C120.162 46.9621 117.586 47.432 116.059 49.3499C116.059 49.3508 116.058 49.3516 116.057 49.3525L66.0131 113.892L66.0091 113.897C60.2405 121.156 65.4135 131.862 74.6925 131.862H125.161L125.709 132.402L126.299 173.995L126.299 173.995M126.964 94.6797L125.751 174.003L126.299 173.995M126.964 94.6797H179.674C188.953 94.6797 194.126 105.386 188.357 112.644L137.061 177.189C135.539 179.104 132.883 179.583 130.531 178.892C128.18 178.202 126.336 176.41 126.299 173.995M126.964 94.6797L126.299 173.995" stroke="url(#paint17_linear_0_1)" - stroke-width="1.09591" - stroke-miterlimit="10" - stroke-linejoin="bevel" - shape-rendering="crispEdges" + strokeWidth="1.09591" + strokeMiterlimit="10" + strokeLinejoin="bevel" + shapeRendering="crispEdges" /> @@ -260,9 +260,9 @@ const DocsCoverLogo = () => { width="137.062" height="141.703" filterUnits="userSpaceOnUse" - color-interpolation-filters="sRGB" + colorInterpolationFilters="sRGB" > - + { gradientUnits="userSpaceOnUse" gradientTransform="translate(125.451 114.82) rotate(90) scale(109.781 0.5)" > - - + + { y2="11.9994" gradientUnits="userSpaceOnUse" > - - + + { y2="204.984" gradientUnits="userSpaceOnUse" > - - + + { y2="13.9993" gradientUnits="userSpaceOnUse" > - - + + { y2="204.984" gradientUnits="userSpaceOnUse" > - - + + { y2="-7.94661" gradientUnits="userSpaceOnUse" > - - - + + + { y2="-3.99932" gradientUnits="userSpaceOnUse" > - - - + + + { y2="199.061" gradientUnits="userSpaceOnUse" > - - - + + + { gradientUnits="userSpaceOnUse" gradientTransform="translate(125.752 114.291) rotate(90) scale(109.271 0.5)" > - - + + { y2="6.31757" gradientUnits="userSpaceOnUse" > - - + + { y2="200" gradientUnits="userSpaceOnUse" > - - + + { y2="199.061" gradientUnits="userSpaceOnUse" > - - - + + + { gradientUnits="userSpaceOnUse" gradientTransform="translate(125.261 59.2344) rotate(90) scale(0.5 263.749)" > - - + + { y2="94.9749" gradientUnits="userSpaceOnUse" > - - - + + + { y2="131.43" gradientUnits="userSpaceOnUse" > - - - + + + { y2="1.99785" gradientUnits="userSpaceOnUse" > - - - + + + { y2="206.049" gradientUnits="userSpaceOnUse" > - - + + { y2="175.889" gradientUnits="userSpaceOnUse" > - - - + + + diff --git a/apps/docs/components/Navigation/Footer.tsx b/apps/docs/components/Navigation/Footer.tsx index c58c7c94f93..e14892a8f39 100644 --- a/apps/docs/components/Navigation/Footer.tsx +++ b/apps/docs/components/Navigation/Footer.tsx @@ -1,5 +1,5 @@ import Link from 'next/link' -import { Button } from '~/../../packages/ui' +import { Button } from 'ui' import { primaryLinks, secondaryLinks } from '~/data/footer' import { LayoutMainContent } from '../../layouts/DefaultLayout' @@ -21,8 +21,8 @@ const Footer = () => ( d={icon} stroke="var(--colors-scale9)" strokeWidth={0.7} - stroke-linecap="round" - stroke-linejoin="round" + strokeLinecap="round" + strokeLinejoin="round" /> )} @@ -71,8 +71,8 @@ const Footer = () => ( xmlns="http://www.w3.org/2000/svg" > @@ -135,10 +135,10 @@ const Footer = () => ( fill="none" xmlns="http://www.w3.org/2000/svg" > - + From 659208ad1c95d030cdfe74fa379bad481f757b7e Mon Sep 17 00:00:00 2001 From: Andy Kenward <4893048+andykenward@users.noreply.github.com> Date: Tue, 16 May 2023 13:23:30 +0000 Subject: [PATCH 18/58] fix: mdxRs unsupported with current setup --- apps/docs/next.config.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs index 47fe88b4ffa..d33090df77e 100644 --- a/apps/docs/next.config.mjs +++ b/apps/docs/next.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import nextMdx from '@next/mdx' import remarkGfm from 'remark-gfm' import rehypeSlug from 'rehype-slug' @@ -64,7 +65,8 @@ const nextConfig = { ], }, experimental: { - mdxRs: true, + // TODO: @next/mdx ^13.0.2 only supports experimental mdxRs flag. next ^13.0.2 will stop warning about this being unsupported. + // mdxRs: true, modularizeImports: { lodash: { transform: 'lodash/{{member}}', From 8d4e64c7c3f79fa653dfd75c4d87bffbed7f713d Mon Sep 17 00:00:00 2001 From: Andy Kenward <4893048+andykenward@users.noreply.github.com> Date: Tue, 16 May 2023 13:24:08 +0000 Subject: [PATCH 19/58] fix: use anchor instead of Link for external href --- apps/docs/layouts/guides/index.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/docs/layouts/guides/index.tsx b/apps/docs/layouts/guides/index.tsx index d952b6b50be..ee025a2b358 100644 --- a/apps/docs/layouts/guides/index.tsx +++ b/apps/docs/layouts/guides/index.tsx @@ -137,14 +137,12 @@ const Layout: FC = (props) => { ) : (
- - - Edit this page on GitHub - - + Edit this page on GitHub +
)} From 218db9a043b1d8cdf69b91e746808412beea384f Mon Sep 17 00:00:00 2001 From: Andy Kenward <4893048+andykenward@users.noreply.github.com> Date: Tue, 16 May 2023 13:27:28 +0000 Subject: [PATCH 20/58] fix(docs): invalid mdx video element attributes --- apps/docs/pages/guides/api/creating-routes.mdx | 12 +++--------- apps/docs/pages/guides/api/quickstart.mdx | 4 +--- .../pages/guides/api/rest/auto-generated-docs.mdx | 4 +--- apps/docs/pages/guides/auth.mdx | 12 +++--------- apps/docs/pages/guides/auth/auth-helpers/auth-ui.mdx | 9 ++------- apps/docs/pages/guides/database.mdx | 8 +------- .../pages/guides/database/connecting-to-postgres.mdx | 12 +++--------- apps/docs/pages/guides/database/overview.mdx | 8 +------- apps/docs/pages/guides/database/replication.mdx | 4 +--- apps/docs/pages/guides/database/tables.mdx | 4 +--- apps/docs/pages/guides/integrations/flutterflow.mdx | 8 -------- apps/docs/pages/guides/integrations/plasmic.mdx | 12 +++--------- 12 files changed, 20 insertions(+), 77 deletions(-) diff --git a/apps/docs/pages/guides/api/creating-routes.mdx b/apps/docs/pages/guides/api/creating-routes.mdx index c48442f12d1..15c52ee156c 100644 --- a/apps/docs/pages/guides/api/creating-routes.mdx +++ b/apps/docs/pages/guides/api/creating-routes.mdx @@ -28,12 +28,10 @@ This creates a corresponding route `todos` which can accept `GET`, `POST`, `PATC 1. Click **New Column** and create a column with the name `task` and type `text`. 1. Click **Save**. -