Skip to content

Commit

Permalink
Merge pull request #472 from psteinroe/update-supabase
Browse files Browse the repository at this point in the history
migrate to vitest and update supabase
  • Loading branch information
psteinroe authored Jul 12, 2024
2 parents 359234f + 30dcc08 commit a679278
Show file tree
Hide file tree
Showing 163 changed files with 2,083 additions and 3,517 deletions.
23 changes: 3 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,81 +24,64 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: pnpm

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- uses: supabase/setup-cli@v1
with:
version: 1.77.4

- name: Start Supabase
uses: nick-fields/retry@v3
with:
max_attempts: 3
timeout_minutes: 5
retry_on: error
command: supabase start -x edge-runtime,logflare,vector,studio,imgproxy,pgadmin-schema-diff,migra,postgres-meta --ignore-health-check
command: pnpm supabase start -x edge-runtime,logflare,vector,studio,imgproxy,pgadmin-schema-diff,migra,postgres-meta

- name: 🦺 Check Format and Lint
id: static
run: pnpm run check
continue-on-error: true

- name: 📦 Build Packages
id: build
run: pnpm run build:packages
continue-on-error: true

- name: 🚧 Test
id: test
run: pnpm run test
continue-on-error: true
run: pnpm turbo run test --concurrency=1

- name: Upload postgrest-core coverage
uses: codecov/codecov-action@v4
with:
files: ./packages/postgrest-core/coverage/coverage-final.json
flags: postgrest-core
fail_ci_if_error: false

- name: Upload postgrest-react-query coverage
uses: codecov/codecov-action@v4
with:
files: ./packages/postgrest-react-query/coverage/coverage-final.json
flags: postgrest-react-query
fail_ci_if_error: false

- name: Upload postgrest-swr coverage
uses: codecov/codecov-action@v4
with:
files: ./packages/postgrest-swr/coverage/coverage-final.json
flags: postgrest-swr
fail_ci_if_error: false

- name: Upload storage-core coverage
uses: codecov/codecov-action@v4
with:
files: ./packages/storage-core/coverage/coverage-final.json
flags: storage-core
fail_ci_if_error: false

- name: Upload storage-swr coverage
uses: codecov/codecov-action@v4
with:
files: ./packages/storage-swr/coverage/coverage-final.json
flags: storage-swr
fail_ci_if_error: false

- name: Upload storage-react-query coverage
uses: codecov/codecov-action@v4
with:
files: ./packages/storage-react-query/coverage/coverage-final.json
flags: storage-react-query
fail_ci_if_error: false

- name: Check for error
if: steps.static.outcome != 'success' || steps.build.outcome != 'success' || steps.test.outcome != 'success'
run: exit 1
2 changes: 1 addition & 1 deletion .github/workflows/release-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: pnpm

- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: pnpm

- name: Install Dependencies
Expand Down
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"devDependencies": {
"autoprefixer": "^10.4.13",
"typescript": "5.4.2",
"@types/node": "^20.0.0",
"@types/react": "18.2.0",
"@types/react-dom": "^18.0.7",
"@types/node": "20.11.19",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"postcss": "^8.4.14",
"tailwindcss": "3.4.0"
}
Expand Down
8 changes: 4 additions & 4 deletions examples/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@supabase/auth-helpers-nextjs": "0.8.7",
"@supabase/auth-helpers-react": "0.4.2",
"@tanstack/react-query": "^5.0.0",
"@supabase/supabase-js": "2.38.5",
"@supabase/supabase-js": "2.44.3",
"@vercel/analytics": "^0.1.11",
"class-variance-authority": "0.7.0",
"clsx": "^1.2.1",
Expand All @@ -63,9 +63,9 @@
"zod": "^3.21.4"
},
"devDependencies": {
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
"@types/node": "20.11.19",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@types/uuid": "^9.0.2",
"autoprefixer": "^10.4.13",
"dotenv": "16.0.1",
Expand Down
8 changes: 4 additions & 4 deletions examples/swr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@supabase-cache-helpers/storage-swr": "workspace:*",
"@supabase/auth-helpers-nextjs": "0.8.7",
"@supabase/auth-helpers-react": "0.4.2",
"@supabase/supabase-js": "2.38.5",
"@supabase/supabase-js": "2.44.3",
"@vercel/analytics": "^0.1.11",
"class-variance-authority": "0.7.0",
"clsx": "^1.2.1",
Expand All @@ -63,9 +63,9 @@
"zod": "^3.21.4"
},
"devDependencies": {
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
"@types/node": "20.11.19",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@types/uuid": "^9.0.2",
"autoprefixer": "^10.4.13",
"dotenv": "16.0.1",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"check": "biome check",
"fix": "biome check --write",
"clean": "turbo run clean && rm -rf node_modules",
"test": "turbo run test --concurrency=1",
"test": "turbo run test --concurrency=1",
"typegen": "supabase gen types typescript --local > packages/postgrest-swr/__tests__/database.types.ts && supabase gen types typescript --local > packages/postgrest-react-query/__tests__/database.types.ts && supabase gen types typescript --local > packages/postgrest-core/__tests__/database.types.ts && supabase gen types typescript --local > examples/swr/types/database.ts && supabase gen types typescript --local > examples/react-query/types/database.ts",
"clear-branches": "git branch --merged | egrep -v \"(^\\*|main)\" | xargs git branch -d",
"merge-main": "git fetch origin main:main && git merge main",
Expand All @@ -25,11 +25,11 @@
"@biomejs/biome": "1.8.3",
"@changesets/cli": "2.27.0",
"supabase": "latest",
"turbo": "1.10.16"
"turbo": "2.0.6"
},
"engines": {
"pnpm": "8",
"node": ">=14.0.0"
"node": ">=20.0.0"
},
"packageManager": "pnpm@8"
"packageManager": "pnpm@8.12.1"
}
19 changes: 0 additions & 19 deletions packages/jest-presets/jest/node/jest-preset.js

This file was deleted.

14 changes: 0 additions & 14 deletions packages/jest-presets/package.json

This file was deleted.

28 changes: 12 additions & 16 deletions packages/postgrest-core/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@supabase-cache-helpers/postgrest-core",
"version": "0.5.2",
"type": "module",
"main": "./dist/index.js",
"source": "./src/index.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./package.json": "./package.json"
},
Expand All @@ -25,35 +26,30 @@
"license": "MIT",
"scripts": {
"build": "tsup",
"clean": "rm -rf .turbo && rm -rf .nyc_output && rm -rf node_modules && rm -rf dist",
"test": "jest --coverage",
"clean": "rm -rf .turbo && rm -rf coverage && rm -rf .nyc_output && rm -rf node_modules && rm -rf dist",
"test": "vitest --coverage",
"typecheck": "tsc --pretty --noEmit"
},
"jest": {
"preset": "@supabase-cache-helpers/jest-presets/jest/node"
},
"peerDependencies": {
"@supabase/postgrest-js": "^1.9.0",
"@supabase/supabase-js": "^2.0.0"
},
"dependencies": {
"fast-equals": "5.0.1",
"merge-anything": "5.1.7",
"flat": "5.0.2",
"merge-anything": "5.1.7",
"xregexp": "5.1.1"
},
"devDependencies": {
"@supabase-cache-helpers/jest-presets": "workspace:*",
"@supabase-cache-helpers/tsconfig": "workspace:*",
"@supabase/postgrest-js": "1.9.0",
"@supabase/supabase-js": "2.38.5",
"@types/jest": "29.5.0",
"@types/lodash": "4.17.0",
"@supabase/postgrest-js": "1.15.8",
"@supabase/supabase-js": "2.44.3",
"@types/flat": "5.0.2",
"@types/lodash": "4.17.0",
"@vitest/coverage-istanbul": "^2.0.2",
"dotenv": "16.4.0",
"jest": "29.7.0",
"ts-jest": "29.1.0",
"tsup": "8.0.0",
"typescript": "5.4.2"
"typescript": "5.4.2",
"vitest": "^2.0.2"
}
}
2 changes: 1 addition & 1 deletion packages/postgrest-core/src/cursor-pagination-fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PostgrestTransformBuilder } from '@supabase/postgrest-js';
import type { GenericSchema } from '@supabase/supabase-js/dist/module/lib/types';
import { GenericSchema } from '@supabase/postgrest-js/dist/cjs/types';

import type { OrderDefinition } from './lib/query-types';
import type { PostgrestPaginationResponse } from './lib/response-types';
Expand Down
6 changes: 3 additions & 3 deletions packages/postgrest-core/src/delete-fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { PostgrestQueryBuilder } from '@supabase/postgrest-js';
import type { GetResult } from '@supabase/postgrest-js/dist/module/select-query-parser';
import type {
import { GetResult } from '@supabase/postgrest-js/dist/cjs/select-query-parser';
import {
GenericSchema,
GenericTable,
} from '@supabase/postgrest-js/dist/module/types';
} from '@supabase/postgrest-js/dist/cjs/types';

import {
type MutationFetcherResponse,
Expand Down
8 changes: 5 additions & 3 deletions packages/postgrest-core/src/insert-fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { PostgrestQueryBuilder } from '@supabase/postgrest-js';
import type { GetResult } from '@supabase/postgrest-js/dist/module/select-query-parser';
import type { GenericTable } from '@supabase/postgrest-js/dist/module/types';
import type { GenericSchema } from '@supabase/supabase-js/dist/module/lib/types';
import { GetResult } from '@supabase/postgrest-js/dist/cjs/select-query-parser';
import {
GenericSchema,
GenericTable,
} from '@supabase/postgrest-js/dist/cjs/types';

import {
type MutationFetcherResponse,
Expand Down
4 changes: 2 additions & 2 deletions packages/postgrest-core/src/lib/get-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import type {
PostgrestBuilder,
PostgrestQueryBuilder,
} from '@supabase/postgrest-js';
import type {
import {
GenericSchema,
GenericTable,
} from '@supabase/postgrest-js/dist/module/types';
} from '@supabase/postgrest-js/dist/cjs/types';

export const getTable = (
query:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PostgrestTransformBuilder } from '@supabase/postgrest-js';
import type { GenericSchema } from '@supabase/postgrest-js/dist/module/types';
import type { GenericSchema } from '@supabase/postgrest-js/dist/cjs/types';

export const isPostgrestTransformBuilder = <
Schema extends GenericSchema,
Expand Down
2 changes: 1 addition & 1 deletion packages/postgrest-core/src/offset-pagination-fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PostgrestTransformBuilder } from '@supabase/postgrest-js';
import type { GenericSchema } from '@supabase/supabase-js/dist/module/lib/types';
import { GenericSchema } from '@supabase/postgrest-js/dist/cjs/types';

import type {
PostgrestHasMorePaginationResponse,
Expand Down
6 changes: 3 additions & 3 deletions packages/postgrest-core/src/update-fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { PostgrestQueryBuilder } from '@supabase/postgrest-js';
import type { GetResult } from '@supabase/postgrest-js/dist/module/select-query-parser';
import type {
import { GetResult } from '@supabase/postgrest-js/dist/cjs/select-query-parser';
import {
GenericSchema,
GenericTable,
} from '@supabase/postgrest-js/dist/module/types';
} from '@supabase/postgrest-js/dist/cjs/types';

import {
type MutationFetcherResponse,
Expand Down
8 changes: 5 additions & 3 deletions packages/postgrest-core/src/upsert-fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { PostgrestQueryBuilder } from '@supabase/postgrest-js';
import type { GetResult } from '@supabase/postgrest-js/dist/module/select-query-parser';
import type { GenericTable } from '@supabase/postgrest-js/dist/module/types';
import type { GenericSchema } from '@supabase/supabase-js/dist/module/lib/types';
import { GetResult } from '@supabase/postgrest-js/dist/cjs/select-query-parser';
import {
GenericSchema,
GenericTable,
} from '@supabase/postgrest-js/dist/cjs/types';

import {
type MutationFetcherResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`fetcher > should throw on error > column contact.unknown does not exist 1`] = `[PostgrestError: column contact.unknown does not exist]`;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type SupabaseClient, createClient } from '@supabase/supabase-js';
import { beforeAll, describe, expect, it } from 'vitest';

import { createCursorPaginationFetcher } from '../src/cursor-pagination-fetcher';
import type { Database } from './database.types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type SupabaseClient, createClient } from '@supabase/supabase-js';
import { beforeAll, describe, expect, it } from 'vitest';

import { buildDeleteFetcher } from '../src/delete-fetcher';
import type { Database } from './database.types';
Expand Down
Loading

0 comments on commit a679278

Please sign in to comment.