From 8008e3d6ad2debb86d8404279517464f1afc3d5e Mon Sep 17 00:00:00 2001 From: jycouet Date: Wed, 30 Mar 2022 23:59:16 +0200 Subject: [PATCH 01/12] :recycle: REMOVE: app to react folder --- .graphqlrc.yaml | 16 ++++++++++++++++ README.md | 2 +- codegen.yml | 12 ------------ {app => examples/react}/.env.example | 0 {app => examples/react}/.eslintrc.json | 0 {app => examples/react}/.gitignore | 0 {app => examples/react}/README.md | 0 {app => examples/react}/gql/.gitignore | 0 {app => examples/react}/lib/active-link.tsx | 0 {app => examples/react}/lib/comment-item.tsx | 0 {app => examples/react}/lib/container.tsx | 0 {app => examples/react}/lib/feed-item.tsx | 0 {app => examples/react}/lib/footer.tsx | 0 {app => examples/react}/lib/icons.tsx | 0 {app => examples/react}/lib/loading.tsx | 0 {app => examples/react}/lib/main-section.tsx | 0 {app => examples/react}/lib/navigation.tsx | 0 {app => examples/react}/lib/noop-uuid.ts | 0 {app => examples/react}/lib/supabase.tsx | 0 {app => examples/react}/lib/time-ago.ts | 0 {app => examples/react}/lib/urql.tsx | 0 .../react}/lib/use-paginated-query.ts | 0 {app => examples/react}/next-env.d.ts | 0 {app => examples/react}/next.config.js | 0 {app => examples/react}/package.json | 2 +- {app => examples/react}/pages/_app.tsx | 0 {app => examples/react}/pages/about.tsx | 0 {app => examples/react}/pages/account.tsx | 0 {app => examples/react}/pages/api/graphiql.ts | 0 {app => examples/react}/pages/comments.tsx | 0 {app => examples/react}/pages/index.tsx | 0 {app => examples/react}/pages/item/[postId].tsx | 0 {app => examples/react}/pages/login.tsx | 0 {app => examples/react}/pages/logout.tsx | 0 {app => examples/react}/pages/newest.tsx | 0 .../react}/pages/profile/[profileId].tsx | 0 {app => examples/react}/pages/submit.tsx | 0 {app => examples/react}/postcss.config.js | 0 {app => examples/react}/public/favicon.ico | Bin .../react}/public/supabase-logo-icon.png | Bin .../react}/public/supabase-logo-icon.svg | 0 .../public/supabase-logo-wordmark--dark.png | Bin .../public/supabase-logo-wordmark--dark.svg | 0 .../public/supabase-logo-wordmark--light.png | Bin .../public/supabase-logo-wordmark--light.svg | 0 .../react}/public/the-guild-full-dark.svg | 0 {app => examples/react}/public/vercel.svg | 0 {app => examples/react}/styles/globals.css | 0 {app => examples/react}/tailwind.config.js | 0 {app => examples/react}/tsconfig.json | 0 graphql.config.json | 4 ---- package.json | 4 ++-- 52 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 .graphqlrc.yaml delete mode 100644 codegen.yml rename {app => examples/react}/.env.example (100%) rename {app => examples/react}/.eslintrc.json (100%) rename {app => examples/react}/.gitignore (100%) rename {app => examples/react}/README.md (100%) rename {app => examples/react}/gql/.gitignore (100%) rename {app => examples/react}/lib/active-link.tsx (100%) rename {app => examples/react}/lib/comment-item.tsx (100%) rename {app => examples/react}/lib/container.tsx (100%) rename {app => examples/react}/lib/feed-item.tsx (100%) rename {app => examples/react}/lib/footer.tsx (100%) rename {app => examples/react}/lib/icons.tsx (100%) rename {app => examples/react}/lib/loading.tsx (100%) rename {app => examples/react}/lib/main-section.tsx (100%) rename {app => examples/react}/lib/navigation.tsx (100%) rename {app => examples/react}/lib/noop-uuid.ts (100%) rename {app => examples/react}/lib/supabase.tsx (100%) rename {app => examples/react}/lib/time-ago.ts (100%) rename {app => examples/react}/lib/urql.tsx (100%) rename {app => examples/react}/lib/use-paginated-query.ts (100%) rename {app => examples/react}/next-env.d.ts (100%) rename {app => examples/react}/next.config.js (100%) rename {app => examples/react}/package.json (97%) rename {app => examples/react}/pages/_app.tsx (100%) rename {app => examples/react}/pages/about.tsx (100%) rename {app => examples/react}/pages/account.tsx (100%) rename {app => examples/react}/pages/api/graphiql.ts (100%) rename {app => examples/react}/pages/comments.tsx (100%) rename {app => examples/react}/pages/index.tsx (100%) rename {app => examples/react}/pages/item/[postId].tsx (100%) rename {app => examples/react}/pages/login.tsx (100%) rename {app => examples/react}/pages/logout.tsx (100%) rename {app => examples/react}/pages/newest.tsx (100%) rename {app => examples/react}/pages/profile/[profileId].tsx (100%) rename {app => examples/react}/pages/submit.tsx (100%) rename {app => examples/react}/postcss.config.js (100%) rename {app => examples/react}/public/favicon.ico (100%) rename {app => examples/react}/public/supabase-logo-icon.png (100%) rename {app => examples/react}/public/supabase-logo-icon.svg (100%) rename {app => examples/react}/public/supabase-logo-wordmark--dark.png (100%) rename {app => examples/react}/public/supabase-logo-wordmark--dark.svg (100%) rename {app => examples/react}/public/supabase-logo-wordmark--light.png (100%) rename {app => examples/react}/public/supabase-logo-wordmark--light.svg (100%) rename {app => examples/react}/public/the-guild-full-dark.svg (100%) rename {app => examples/react}/public/vercel.svg (100%) rename {app => examples/react}/styles/globals.css (100%) rename {app => examples/react}/tailwind.config.js (100%) rename {app => examples/react}/tsconfig.json (100%) delete mode 100644 graphql.config.json diff --git a/.graphqlrc.yaml b/.graphqlrc.yaml new file mode 100644 index 0000000..0aee82a --- /dev/null +++ b/.graphqlrc.yaml @@ -0,0 +1,16 @@ +# File for extension: vscode-graphql & CodeGen! +projects: + default: + overwrite: true + schema: "./graphql/schema/schema.graphql" + documents: + - "examples/react/**/*.tsx" + - "!examples/react/gql/**/*" + extensions: + codegen: + generates: + ./examples/react/gql/: + preset: gql-tag-operations-preset + hooks: + afterOneFileWrite: + - prettier --write diff --git a/README.md b/README.md index 64cdb9a..7434911 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ A basic HackerNews-like clone where posts can be submitted with url links and th ```bash yarn yarn codegen -yarn workspace app dev +yarn workspace react dev ``` ### Deploy to Vercel diff --git a/codegen.yml b/codegen.yml deleted file mode 100644 index d0b7ef6..0000000 --- a/codegen.yml +++ /dev/null @@ -1,12 +0,0 @@ -overwrite: true -schema: "./graphql/schema/schema.graphql" -documents: - - "app/**/*.tsx" - - "!app/gql/**/*" -generates: - ./app/gql/: - preset: gql-tag-operations-preset - -hooks: - afterOneFileWrite: - - prettier --write diff --git a/app/.env.example b/examples/react/.env.example similarity index 100% rename from app/.env.example rename to examples/react/.env.example diff --git a/app/.eslintrc.json b/examples/react/.eslintrc.json similarity index 100% rename from app/.eslintrc.json rename to examples/react/.eslintrc.json diff --git a/app/.gitignore b/examples/react/.gitignore similarity index 100% rename from app/.gitignore rename to examples/react/.gitignore diff --git a/app/README.md b/examples/react/README.md similarity index 100% rename from app/README.md rename to examples/react/README.md diff --git a/app/gql/.gitignore b/examples/react/gql/.gitignore similarity index 100% rename from app/gql/.gitignore rename to examples/react/gql/.gitignore diff --git a/app/lib/active-link.tsx b/examples/react/lib/active-link.tsx similarity index 100% rename from app/lib/active-link.tsx rename to examples/react/lib/active-link.tsx diff --git a/app/lib/comment-item.tsx b/examples/react/lib/comment-item.tsx similarity index 100% rename from app/lib/comment-item.tsx rename to examples/react/lib/comment-item.tsx diff --git a/app/lib/container.tsx b/examples/react/lib/container.tsx similarity index 100% rename from app/lib/container.tsx rename to examples/react/lib/container.tsx diff --git a/app/lib/feed-item.tsx b/examples/react/lib/feed-item.tsx similarity index 100% rename from app/lib/feed-item.tsx rename to examples/react/lib/feed-item.tsx diff --git a/app/lib/footer.tsx b/examples/react/lib/footer.tsx similarity index 100% rename from app/lib/footer.tsx rename to examples/react/lib/footer.tsx diff --git a/app/lib/icons.tsx b/examples/react/lib/icons.tsx similarity index 100% rename from app/lib/icons.tsx rename to examples/react/lib/icons.tsx diff --git a/app/lib/loading.tsx b/examples/react/lib/loading.tsx similarity index 100% rename from app/lib/loading.tsx rename to examples/react/lib/loading.tsx diff --git a/app/lib/main-section.tsx b/examples/react/lib/main-section.tsx similarity index 100% rename from app/lib/main-section.tsx rename to examples/react/lib/main-section.tsx diff --git a/app/lib/navigation.tsx b/examples/react/lib/navigation.tsx similarity index 100% rename from app/lib/navigation.tsx rename to examples/react/lib/navigation.tsx diff --git a/app/lib/noop-uuid.ts b/examples/react/lib/noop-uuid.ts similarity index 100% rename from app/lib/noop-uuid.ts rename to examples/react/lib/noop-uuid.ts diff --git a/app/lib/supabase.tsx b/examples/react/lib/supabase.tsx similarity index 100% rename from app/lib/supabase.tsx rename to examples/react/lib/supabase.tsx diff --git a/app/lib/time-ago.ts b/examples/react/lib/time-ago.ts similarity index 100% rename from app/lib/time-ago.ts rename to examples/react/lib/time-ago.ts diff --git a/app/lib/urql.tsx b/examples/react/lib/urql.tsx similarity index 100% rename from app/lib/urql.tsx rename to examples/react/lib/urql.tsx diff --git a/app/lib/use-paginated-query.ts b/examples/react/lib/use-paginated-query.ts similarity index 100% rename from app/lib/use-paginated-query.ts rename to examples/react/lib/use-paginated-query.ts diff --git a/app/next-env.d.ts b/examples/react/next-env.d.ts similarity index 100% rename from app/next-env.d.ts rename to examples/react/next-env.d.ts diff --git a/app/next.config.js b/examples/react/next.config.js similarity index 100% rename from app/next.config.js rename to examples/react/next.config.js diff --git a/app/package.json b/examples/react/package.json similarity index 97% rename from app/package.json rename to examples/react/package.json index a6284ab..993925e 100644 --- a/app/package.json +++ b/examples/react/package.json @@ -1,5 +1,5 @@ { - "name": "app", + "name": "react", "version": "0.1.0", "private": true, "scripts": { diff --git a/app/pages/_app.tsx b/examples/react/pages/_app.tsx similarity index 100% rename from app/pages/_app.tsx rename to examples/react/pages/_app.tsx diff --git a/app/pages/about.tsx b/examples/react/pages/about.tsx similarity index 100% rename from app/pages/about.tsx rename to examples/react/pages/about.tsx diff --git a/app/pages/account.tsx b/examples/react/pages/account.tsx similarity index 100% rename from app/pages/account.tsx rename to examples/react/pages/account.tsx diff --git a/app/pages/api/graphiql.ts b/examples/react/pages/api/graphiql.ts similarity index 100% rename from app/pages/api/graphiql.ts rename to examples/react/pages/api/graphiql.ts diff --git a/app/pages/comments.tsx b/examples/react/pages/comments.tsx similarity index 100% rename from app/pages/comments.tsx rename to examples/react/pages/comments.tsx diff --git a/app/pages/index.tsx b/examples/react/pages/index.tsx similarity index 100% rename from app/pages/index.tsx rename to examples/react/pages/index.tsx diff --git a/app/pages/item/[postId].tsx b/examples/react/pages/item/[postId].tsx similarity index 100% rename from app/pages/item/[postId].tsx rename to examples/react/pages/item/[postId].tsx diff --git a/app/pages/login.tsx b/examples/react/pages/login.tsx similarity index 100% rename from app/pages/login.tsx rename to examples/react/pages/login.tsx diff --git a/app/pages/logout.tsx b/examples/react/pages/logout.tsx similarity index 100% rename from app/pages/logout.tsx rename to examples/react/pages/logout.tsx diff --git a/app/pages/newest.tsx b/examples/react/pages/newest.tsx similarity index 100% rename from app/pages/newest.tsx rename to examples/react/pages/newest.tsx diff --git a/app/pages/profile/[profileId].tsx b/examples/react/pages/profile/[profileId].tsx similarity index 100% rename from app/pages/profile/[profileId].tsx rename to examples/react/pages/profile/[profileId].tsx diff --git a/app/pages/submit.tsx b/examples/react/pages/submit.tsx similarity index 100% rename from app/pages/submit.tsx rename to examples/react/pages/submit.tsx diff --git a/app/postcss.config.js b/examples/react/postcss.config.js similarity index 100% rename from app/postcss.config.js rename to examples/react/postcss.config.js diff --git a/app/public/favicon.ico b/examples/react/public/favicon.ico similarity index 100% rename from app/public/favicon.ico rename to examples/react/public/favicon.ico diff --git a/app/public/supabase-logo-icon.png b/examples/react/public/supabase-logo-icon.png similarity index 100% rename from app/public/supabase-logo-icon.png rename to examples/react/public/supabase-logo-icon.png diff --git a/app/public/supabase-logo-icon.svg b/examples/react/public/supabase-logo-icon.svg similarity index 100% rename from app/public/supabase-logo-icon.svg rename to examples/react/public/supabase-logo-icon.svg diff --git a/app/public/supabase-logo-wordmark--dark.png b/examples/react/public/supabase-logo-wordmark--dark.png similarity index 100% rename from app/public/supabase-logo-wordmark--dark.png rename to examples/react/public/supabase-logo-wordmark--dark.png diff --git a/app/public/supabase-logo-wordmark--dark.svg b/examples/react/public/supabase-logo-wordmark--dark.svg similarity index 100% rename from app/public/supabase-logo-wordmark--dark.svg rename to examples/react/public/supabase-logo-wordmark--dark.svg diff --git a/app/public/supabase-logo-wordmark--light.png b/examples/react/public/supabase-logo-wordmark--light.png similarity index 100% rename from app/public/supabase-logo-wordmark--light.png rename to examples/react/public/supabase-logo-wordmark--light.png diff --git a/app/public/supabase-logo-wordmark--light.svg b/examples/react/public/supabase-logo-wordmark--light.svg similarity index 100% rename from app/public/supabase-logo-wordmark--light.svg rename to examples/react/public/supabase-logo-wordmark--light.svg diff --git a/app/public/the-guild-full-dark.svg b/examples/react/public/the-guild-full-dark.svg similarity index 100% rename from app/public/the-guild-full-dark.svg rename to examples/react/public/the-guild-full-dark.svg diff --git a/app/public/vercel.svg b/examples/react/public/vercel.svg similarity index 100% rename from app/public/vercel.svg rename to examples/react/public/vercel.svg diff --git a/app/styles/globals.css b/examples/react/styles/globals.css similarity index 100% rename from app/styles/globals.css rename to examples/react/styles/globals.css diff --git a/app/tailwind.config.js b/examples/react/tailwind.config.js similarity index 100% rename from app/tailwind.config.js rename to examples/react/tailwind.config.js diff --git a/app/tsconfig.json b/examples/react/tsconfig.json similarity index 100% rename from app/tsconfig.json rename to examples/react/tsconfig.json diff --git a/graphql.config.json b/graphql.config.json deleted file mode 100644 index f31d150..0000000 --- a/graphql.config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "schema": ["./graphql/schema/schema.graphql"], - "documents": ["./app/**/*.{graphql,js,ts,jsx,tsx}"] -} diff --git a/package.json b/package.json index e71ac32..dda2e50 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pg-graphql-example", "workspaces": [ - "app" + "examples/*" ], "private": true, "devDependencies": { @@ -19,7 +19,7 @@ }, "scripts": { "prepare": "husky install", - "codegen": "graphql-codegen --config codegen.yml", + "codegen": "graphql-codegen --config .graphqlrc.yaml", "codegen:fetch": "node --no-warnings scripts/fetchGraphQLSchema ", "codegen:watch": "yarn run codegen -- --watch" } From e4d99d5417e7508c4a5fedb093116ee58fd22158 Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 31 Mar 2022 01:08:47 +0200 Subject: [PATCH 02/12] :recycle: REMOVE: react to nextjs folder --- examples/{react => nextjs}/.env.example | 0 examples/{react => nextjs}/.eslintrc.json | 0 examples/{react => nextjs}/.gitignore | 0 examples/{react => nextjs}/README.md | 0 examples/{react => nextjs}/gql/.gitignore | 0 examples/{react => nextjs}/lib/active-link.tsx | 0 examples/{react => nextjs}/lib/comment-item.tsx | 0 examples/{react => nextjs}/lib/container.tsx | 0 examples/{react => nextjs}/lib/feed-item.tsx | 0 examples/{react => nextjs}/lib/footer.tsx | 0 examples/{react => nextjs}/lib/icons.tsx | 0 examples/{react => nextjs}/lib/loading.tsx | 0 examples/{react => nextjs}/lib/main-section.tsx | 0 examples/{react => nextjs}/lib/navigation.tsx | 0 examples/{react => nextjs}/lib/noop-uuid.ts | 0 examples/{react => nextjs}/lib/supabase.tsx | 0 examples/{react => nextjs}/lib/time-ago.ts | 0 examples/{react => nextjs}/lib/urql.tsx | 0 .../{react => nextjs}/lib/use-paginated-query.ts | 0 examples/{react => nextjs}/next-env.d.ts | 0 examples/{react => nextjs}/next.config.js | 0 examples/{react => nextjs}/package.json | 0 examples/{react => nextjs}/pages/_app.tsx | 0 examples/{react => nextjs}/pages/about.tsx | 0 examples/{react => nextjs}/pages/account.tsx | 0 examples/{react => nextjs}/pages/api/graphiql.ts | 0 examples/{react => nextjs}/pages/comments.tsx | 0 examples/{react => nextjs}/pages/index.tsx | 0 examples/{react => nextjs}/pages/item/[postId].tsx | 0 examples/{react => nextjs}/pages/login.tsx | 0 examples/{react => nextjs}/pages/logout.tsx | 0 examples/{react => nextjs}/pages/newest.tsx | 0 .../{react => nextjs}/pages/profile/[profileId].tsx | 0 examples/{react => nextjs}/pages/submit.tsx | 0 examples/{react => nextjs}/postcss.config.js | 0 examples/{react => nextjs}/public/favicon.ico | Bin .../{react => nextjs}/public/supabase-logo-icon.png | Bin .../{react => nextjs}/public/supabase-logo-icon.svg | 0 .../public/supabase-logo-wordmark--dark.png | Bin .../public/supabase-logo-wordmark--dark.svg | 0 .../public/supabase-logo-wordmark--light.png | Bin .../public/supabase-logo-wordmark--light.svg | 0 .../public/the-guild-full-dark.svg | 0 examples/{react => nextjs}/public/vercel.svg | 0 examples/{react => nextjs}/styles/globals.css | 0 examples/{react => nextjs}/tailwind.config.js | 0 examples/{react => nextjs}/tsconfig.json | 0 47 files changed, 0 insertions(+), 0 deletions(-) rename examples/{react => nextjs}/.env.example (100%) rename examples/{react => nextjs}/.eslintrc.json (100%) rename examples/{react => nextjs}/.gitignore (100%) rename examples/{react => nextjs}/README.md (100%) rename examples/{react => nextjs}/gql/.gitignore (100%) rename examples/{react => nextjs}/lib/active-link.tsx (100%) rename examples/{react => nextjs}/lib/comment-item.tsx (100%) rename examples/{react => nextjs}/lib/container.tsx (100%) rename examples/{react => nextjs}/lib/feed-item.tsx (100%) rename examples/{react => nextjs}/lib/footer.tsx (100%) rename examples/{react => nextjs}/lib/icons.tsx (100%) rename examples/{react => nextjs}/lib/loading.tsx (100%) rename examples/{react => nextjs}/lib/main-section.tsx (100%) rename examples/{react => nextjs}/lib/navigation.tsx (100%) rename examples/{react => nextjs}/lib/noop-uuid.ts (100%) rename examples/{react => nextjs}/lib/supabase.tsx (100%) rename examples/{react => nextjs}/lib/time-ago.ts (100%) rename examples/{react => nextjs}/lib/urql.tsx (100%) rename examples/{react => nextjs}/lib/use-paginated-query.ts (100%) rename examples/{react => nextjs}/next-env.d.ts (100%) rename examples/{react => nextjs}/next.config.js (100%) rename examples/{react => nextjs}/package.json (100%) rename examples/{react => nextjs}/pages/_app.tsx (100%) rename examples/{react => nextjs}/pages/about.tsx (100%) rename examples/{react => nextjs}/pages/account.tsx (100%) rename examples/{react => nextjs}/pages/api/graphiql.ts (100%) rename examples/{react => nextjs}/pages/comments.tsx (100%) rename examples/{react => nextjs}/pages/index.tsx (100%) rename examples/{react => nextjs}/pages/item/[postId].tsx (100%) rename examples/{react => nextjs}/pages/login.tsx (100%) rename examples/{react => nextjs}/pages/logout.tsx (100%) rename examples/{react => nextjs}/pages/newest.tsx (100%) rename examples/{react => nextjs}/pages/profile/[profileId].tsx (100%) rename examples/{react => nextjs}/pages/submit.tsx (100%) rename examples/{react => nextjs}/postcss.config.js (100%) rename examples/{react => nextjs}/public/favicon.ico (100%) rename examples/{react => nextjs}/public/supabase-logo-icon.png (100%) rename examples/{react => nextjs}/public/supabase-logo-icon.svg (100%) rename examples/{react => nextjs}/public/supabase-logo-wordmark--dark.png (100%) rename examples/{react => nextjs}/public/supabase-logo-wordmark--dark.svg (100%) rename examples/{react => nextjs}/public/supabase-logo-wordmark--light.png (100%) rename examples/{react => nextjs}/public/supabase-logo-wordmark--light.svg (100%) rename examples/{react => nextjs}/public/the-guild-full-dark.svg (100%) rename examples/{react => nextjs}/public/vercel.svg (100%) rename examples/{react => nextjs}/styles/globals.css (100%) rename examples/{react => nextjs}/tailwind.config.js (100%) rename examples/{react => nextjs}/tsconfig.json (100%) diff --git a/examples/react/.env.example b/examples/nextjs/.env.example similarity index 100% rename from examples/react/.env.example rename to examples/nextjs/.env.example diff --git a/examples/react/.eslintrc.json b/examples/nextjs/.eslintrc.json similarity index 100% rename from examples/react/.eslintrc.json rename to examples/nextjs/.eslintrc.json diff --git a/examples/react/.gitignore b/examples/nextjs/.gitignore similarity index 100% rename from examples/react/.gitignore rename to examples/nextjs/.gitignore diff --git a/examples/react/README.md b/examples/nextjs/README.md similarity index 100% rename from examples/react/README.md rename to examples/nextjs/README.md diff --git a/examples/react/gql/.gitignore b/examples/nextjs/gql/.gitignore similarity index 100% rename from examples/react/gql/.gitignore rename to examples/nextjs/gql/.gitignore diff --git a/examples/react/lib/active-link.tsx b/examples/nextjs/lib/active-link.tsx similarity index 100% rename from examples/react/lib/active-link.tsx rename to examples/nextjs/lib/active-link.tsx diff --git a/examples/react/lib/comment-item.tsx b/examples/nextjs/lib/comment-item.tsx similarity index 100% rename from examples/react/lib/comment-item.tsx rename to examples/nextjs/lib/comment-item.tsx diff --git a/examples/react/lib/container.tsx b/examples/nextjs/lib/container.tsx similarity index 100% rename from examples/react/lib/container.tsx rename to examples/nextjs/lib/container.tsx diff --git a/examples/react/lib/feed-item.tsx b/examples/nextjs/lib/feed-item.tsx similarity index 100% rename from examples/react/lib/feed-item.tsx rename to examples/nextjs/lib/feed-item.tsx diff --git a/examples/react/lib/footer.tsx b/examples/nextjs/lib/footer.tsx similarity index 100% rename from examples/react/lib/footer.tsx rename to examples/nextjs/lib/footer.tsx diff --git a/examples/react/lib/icons.tsx b/examples/nextjs/lib/icons.tsx similarity index 100% rename from examples/react/lib/icons.tsx rename to examples/nextjs/lib/icons.tsx diff --git a/examples/react/lib/loading.tsx b/examples/nextjs/lib/loading.tsx similarity index 100% rename from examples/react/lib/loading.tsx rename to examples/nextjs/lib/loading.tsx diff --git a/examples/react/lib/main-section.tsx b/examples/nextjs/lib/main-section.tsx similarity index 100% rename from examples/react/lib/main-section.tsx rename to examples/nextjs/lib/main-section.tsx diff --git a/examples/react/lib/navigation.tsx b/examples/nextjs/lib/navigation.tsx similarity index 100% rename from examples/react/lib/navigation.tsx rename to examples/nextjs/lib/navigation.tsx diff --git a/examples/react/lib/noop-uuid.ts b/examples/nextjs/lib/noop-uuid.ts similarity index 100% rename from examples/react/lib/noop-uuid.ts rename to examples/nextjs/lib/noop-uuid.ts diff --git a/examples/react/lib/supabase.tsx b/examples/nextjs/lib/supabase.tsx similarity index 100% rename from examples/react/lib/supabase.tsx rename to examples/nextjs/lib/supabase.tsx diff --git a/examples/react/lib/time-ago.ts b/examples/nextjs/lib/time-ago.ts similarity index 100% rename from examples/react/lib/time-ago.ts rename to examples/nextjs/lib/time-ago.ts diff --git a/examples/react/lib/urql.tsx b/examples/nextjs/lib/urql.tsx similarity index 100% rename from examples/react/lib/urql.tsx rename to examples/nextjs/lib/urql.tsx diff --git a/examples/react/lib/use-paginated-query.ts b/examples/nextjs/lib/use-paginated-query.ts similarity index 100% rename from examples/react/lib/use-paginated-query.ts rename to examples/nextjs/lib/use-paginated-query.ts diff --git a/examples/react/next-env.d.ts b/examples/nextjs/next-env.d.ts similarity index 100% rename from examples/react/next-env.d.ts rename to examples/nextjs/next-env.d.ts diff --git a/examples/react/next.config.js b/examples/nextjs/next.config.js similarity index 100% rename from examples/react/next.config.js rename to examples/nextjs/next.config.js diff --git a/examples/react/package.json b/examples/nextjs/package.json similarity index 100% rename from examples/react/package.json rename to examples/nextjs/package.json diff --git a/examples/react/pages/_app.tsx b/examples/nextjs/pages/_app.tsx similarity index 100% rename from examples/react/pages/_app.tsx rename to examples/nextjs/pages/_app.tsx diff --git a/examples/react/pages/about.tsx b/examples/nextjs/pages/about.tsx similarity index 100% rename from examples/react/pages/about.tsx rename to examples/nextjs/pages/about.tsx diff --git a/examples/react/pages/account.tsx b/examples/nextjs/pages/account.tsx similarity index 100% rename from examples/react/pages/account.tsx rename to examples/nextjs/pages/account.tsx diff --git a/examples/react/pages/api/graphiql.ts b/examples/nextjs/pages/api/graphiql.ts similarity index 100% rename from examples/react/pages/api/graphiql.ts rename to examples/nextjs/pages/api/graphiql.ts diff --git a/examples/react/pages/comments.tsx b/examples/nextjs/pages/comments.tsx similarity index 100% rename from examples/react/pages/comments.tsx rename to examples/nextjs/pages/comments.tsx diff --git a/examples/react/pages/index.tsx b/examples/nextjs/pages/index.tsx similarity index 100% rename from examples/react/pages/index.tsx rename to examples/nextjs/pages/index.tsx diff --git a/examples/react/pages/item/[postId].tsx b/examples/nextjs/pages/item/[postId].tsx similarity index 100% rename from examples/react/pages/item/[postId].tsx rename to examples/nextjs/pages/item/[postId].tsx diff --git a/examples/react/pages/login.tsx b/examples/nextjs/pages/login.tsx similarity index 100% rename from examples/react/pages/login.tsx rename to examples/nextjs/pages/login.tsx diff --git a/examples/react/pages/logout.tsx b/examples/nextjs/pages/logout.tsx similarity index 100% rename from examples/react/pages/logout.tsx rename to examples/nextjs/pages/logout.tsx diff --git a/examples/react/pages/newest.tsx b/examples/nextjs/pages/newest.tsx similarity index 100% rename from examples/react/pages/newest.tsx rename to examples/nextjs/pages/newest.tsx diff --git a/examples/react/pages/profile/[profileId].tsx b/examples/nextjs/pages/profile/[profileId].tsx similarity index 100% rename from examples/react/pages/profile/[profileId].tsx rename to examples/nextjs/pages/profile/[profileId].tsx diff --git a/examples/react/pages/submit.tsx b/examples/nextjs/pages/submit.tsx similarity index 100% rename from examples/react/pages/submit.tsx rename to examples/nextjs/pages/submit.tsx diff --git a/examples/react/postcss.config.js b/examples/nextjs/postcss.config.js similarity index 100% rename from examples/react/postcss.config.js rename to examples/nextjs/postcss.config.js diff --git a/examples/react/public/favicon.ico b/examples/nextjs/public/favicon.ico similarity index 100% rename from examples/react/public/favicon.ico rename to examples/nextjs/public/favicon.ico diff --git a/examples/react/public/supabase-logo-icon.png b/examples/nextjs/public/supabase-logo-icon.png similarity index 100% rename from examples/react/public/supabase-logo-icon.png rename to examples/nextjs/public/supabase-logo-icon.png diff --git a/examples/react/public/supabase-logo-icon.svg b/examples/nextjs/public/supabase-logo-icon.svg similarity index 100% rename from examples/react/public/supabase-logo-icon.svg rename to examples/nextjs/public/supabase-logo-icon.svg diff --git a/examples/react/public/supabase-logo-wordmark--dark.png b/examples/nextjs/public/supabase-logo-wordmark--dark.png similarity index 100% rename from examples/react/public/supabase-logo-wordmark--dark.png rename to examples/nextjs/public/supabase-logo-wordmark--dark.png diff --git a/examples/react/public/supabase-logo-wordmark--dark.svg b/examples/nextjs/public/supabase-logo-wordmark--dark.svg similarity index 100% rename from examples/react/public/supabase-logo-wordmark--dark.svg rename to examples/nextjs/public/supabase-logo-wordmark--dark.svg diff --git a/examples/react/public/supabase-logo-wordmark--light.png b/examples/nextjs/public/supabase-logo-wordmark--light.png similarity index 100% rename from examples/react/public/supabase-logo-wordmark--light.png rename to examples/nextjs/public/supabase-logo-wordmark--light.png diff --git a/examples/react/public/supabase-logo-wordmark--light.svg b/examples/nextjs/public/supabase-logo-wordmark--light.svg similarity index 100% rename from examples/react/public/supabase-logo-wordmark--light.svg rename to examples/nextjs/public/supabase-logo-wordmark--light.svg diff --git a/examples/react/public/the-guild-full-dark.svg b/examples/nextjs/public/the-guild-full-dark.svg similarity index 100% rename from examples/react/public/the-guild-full-dark.svg rename to examples/nextjs/public/the-guild-full-dark.svg diff --git a/examples/react/public/vercel.svg b/examples/nextjs/public/vercel.svg similarity index 100% rename from examples/react/public/vercel.svg rename to examples/nextjs/public/vercel.svg diff --git a/examples/react/styles/globals.css b/examples/nextjs/styles/globals.css similarity index 100% rename from examples/react/styles/globals.css rename to examples/nextjs/styles/globals.css diff --git a/examples/react/tailwind.config.js b/examples/nextjs/tailwind.config.js similarity index 100% rename from examples/react/tailwind.config.js rename to examples/nextjs/tailwind.config.js diff --git a/examples/react/tsconfig.json b/examples/nextjs/tsconfig.json similarity index 100% rename from examples/react/tsconfig.json rename to examples/nextjs/tsconfig.json From c2fc986b747425de53089d073979e77780d4187c Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 31 Mar 2022 01:11:19 +0200 Subject: [PATCH 03/12] :tada: NEW: example sveltekit (layout, feed, about) --- .graphqlrc.yaml | 29 +- examples/sveltekit/.env.exemple | 2 + examples/sveltekit/.eslintrc.cjs | 20 + examples/sveltekit/.gitignore | 8 + examples/sveltekit/.npmrc | 1 + examples/sveltekit/.prettierrc | 6 + examples/sveltekit/README.md | 3 + examples/sveltekit/package.json | 45 + examples/sveltekit/postcss.config.cjs | 13 + examples/sveltekit/src/app.css | 4 + examples/sveltekit/src/app.d.ts | 14 + examples/sveltekit/src/app.html | 14 + examples/sveltekit/src/lib/Container.svelte | 3 + .../src/lib/DeleteButton_PostFragment.gql | 3 + examples/sveltekit/src/lib/FeedItem.svelte | 277 ++++ .../src/lib/FeedItem_PostFragment.gql | 17 + examples/sveltekit/src/lib/Footer.svelte | 57 + examples/sveltekit/src/lib/Icons.svelte | 186 +++ examples/sveltekit/src/lib/Loading.svelte | 8 + examples/sveltekit/src/lib/MainSection.svelte | 3 + examples/sveltekit/src/lib/Navigation.svelte | 61 + .../src/lib/VoteButtons_PostFragment.gql | 13 + .../sveltekit/src/lib/graphql/kitQLClient.ts | 11 + examples/sveltekit/src/lib/noop-uuid.ts | 4 + examples/sveltekit/src/lib/time-ago.ts | 6 + .../sveltekit/src/routes/IndexRouteQuery.gql | 15 + examples/sveltekit/src/routes/__layout.svelte | 18 + examples/sveltekit/src/routes/about.svelte | 208 +++ examples/sveltekit/src/routes/account.svelte | 3 + examples/sveltekit/src/routes/api/graphiql.ts | 39 + examples/sveltekit/src/routes/comment.svelte | 3 + examples/sveltekit/src/routes/comments.svelte | 3 + examples/sveltekit/src/routes/index.svelte | 47 + examples/sveltekit/src/routes/login.svelte | 3 + examples/sveltekit/src/routes/logout.svelte | 0 examples/sveltekit/src/routes/newest.svelte | 3 + examples/sveltekit/src/routes/submit.svelte | 3 + examples/sveltekit/static/favicon.ico | Bin 0 -> 1329 bytes .../sveltekit/static/supabase-logo-icon.png | Bin 0 -> 48650 bytes .../sveltekit/static/supabase-logo-icon.svg | 15 + .../static/supabase-logo-wordmark--dark.png | Bin 0 -> 80014 bytes .../static/supabase-logo-wordmark--dark.svg | 23 + .../static/supabase-logo-wordmark--light.png | Bin 0 -> 83296 bytes .../static/supabase-logo-wordmark--light.svg | 23 + .../sveltekit/static/the-guild-full-dark.svg | 11 + examples/sveltekit/static/vercel.svg | 4 + examples/sveltekit/svelte.config.js | 49 + examples/sveltekit/tailwind.config.cjs | 11 + examples/sveltekit/tsconfig.json | 3 + package.json | 4 +- yarn.lock | 1257 ++++++++++++++++- 51 files changed, 2501 insertions(+), 52 deletions(-) create mode 100644 examples/sveltekit/.env.exemple create mode 100644 examples/sveltekit/.eslintrc.cjs create mode 100644 examples/sveltekit/.gitignore create mode 100644 examples/sveltekit/.npmrc create mode 100644 examples/sveltekit/.prettierrc create mode 100644 examples/sveltekit/README.md create mode 100644 examples/sveltekit/package.json create mode 100644 examples/sveltekit/postcss.config.cjs create mode 100644 examples/sveltekit/src/app.css create mode 100644 examples/sveltekit/src/app.d.ts create mode 100644 examples/sveltekit/src/app.html create mode 100644 examples/sveltekit/src/lib/Container.svelte create mode 100644 examples/sveltekit/src/lib/DeleteButton_PostFragment.gql create mode 100644 examples/sveltekit/src/lib/FeedItem.svelte create mode 100644 examples/sveltekit/src/lib/FeedItem_PostFragment.gql create mode 100644 examples/sveltekit/src/lib/Footer.svelte create mode 100644 examples/sveltekit/src/lib/Icons.svelte create mode 100644 examples/sveltekit/src/lib/Loading.svelte create mode 100644 examples/sveltekit/src/lib/MainSection.svelte create mode 100644 examples/sveltekit/src/lib/Navigation.svelte create mode 100644 examples/sveltekit/src/lib/VoteButtons_PostFragment.gql create mode 100644 examples/sveltekit/src/lib/graphql/kitQLClient.ts create mode 100644 examples/sveltekit/src/lib/noop-uuid.ts create mode 100644 examples/sveltekit/src/lib/time-ago.ts create mode 100644 examples/sveltekit/src/routes/IndexRouteQuery.gql create mode 100644 examples/sveltekit/src/routes/__layout.svelte create mode 100644 examples/sveltekit/src/routes/about.svelte create mode 100644 examples/sveltekit/src/routes/account.svelte create mode 100644 examples/sveltekit/src/routes/api/graphiql.ts create mode 100644 examples/sveltekit/src/routes/comment.svelte create mode 100644 examples/sveltekit/src/routes/comments.svelte create mode 100644 examples/sveltekit/src/routes/index.svelte create mode 100644 examples/sveltekit/src/routes/login.svelte create mode 100644 examples/sveltekit/src/routes/logout.svelte create mode 100644 examples/sveltekit/src/routes/newest.svelte create mode 100644 examples/sveltekit/src/routes/submit.svelte create mode 100644 examples/sveltekit/static/favicon.ico create mode 100644 examples/sveltekit/static/supabase-logo-icon.png create mode 100644 examples/sveltekit/static/supabase-logo-icon.svg create mode 100644 examples/sveltekit/static/supabase-logo-wordmark--dark.png create mode 100644 examples/sveltekit/static/supabase-logo-wordmark--dark.svg create mode 100644 examples/sveltekit/static/supabase-logo-wordmark--light.png create mode 100644 examples/sveltekit/static/supabase-logo-wordmark--light.svg create mode 100644 examples/sveltekit/static/the-guild-full-dark.svg create mode 100644 examples/sveltekit/static/vercel.svg create mode 100644 examples/sveltekit/svelte.config.js create mode 100644 examples/sveltekit/tailwind.config.cjs create mode 100644 examples/sveltekit/tsconfig.json diff --git a/.graphqlrc.yaml b/.graphqlrc.yaml index 0aee82a..07e5295 100644 --- a/.graphqlrc.yaml +++ b/.graphqlrc.yaml @@ -1,16 +1,37 @@ # File for extension: vscode-graphql & CodeGen! projects: - default: + nextjs: overwrite: true schema: "./graphql/schema/schema.graphql" documents: - - "examples/react/**/*.tsx" - - "!examples/react/gql/**/*" + - "examples/nextjs/**/*.tsx" + - "!examples/nextjs/gql/**/*" extensions: codegen: generates: - ./examples/react/gql/: + ./examples/nextjs/gql/: preset: gql-tag-operations-preset hooks: afterOneFileWrite: - prettier --write + + sveltekit: + schema: "./graphql/schema/schema.graphql" + documents: + - "examples/sveltekit/**/*.gql" + extensions: + codegen: + generates: + ./examples/sveltekit/src/lib/graphql/_kitql/graphqlTypes.ts: + plugins: + - typescript + - typescript-operations + - typed-document-node + - typescript-document-nodes + ./examples/sveltekit/src/lib/graphql/_kitql/graphqlStores.ts: + plugins: + - "@kitql/graphql-codegen" + config: + importBaseTypesFrom: $lib/graphql/_kitql/graphqlTypes + config: + useTypeImports: true diff --git a/examples/sveltekit/.env.exemple b/examples/sveltekit/.env.exemple new file mode 100644 index 0000000..fcd436a --- /dev/null +++ b/examples/sveltekit/.env.exemple @@ -0,0 +1,2 @@ +VITE_PUBLIC_SUPABASE_URL= +VITE_PUBLIC_SUPABASE_ANON_KEY= \ No newline at end of file diff --git a/examples/sveltekit/.eslintrc.cjs b/examples/sveltekit/.eslintrc.cjs new file mode 100644 index 0000000..3ccf435 --- /dev/null +++ b/examples/sveltekit/.eslintrc.cjs @@ -0,0 +1,20 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], + plugins: ['svelte3', '@typescript-eslint'], + ignorePatterns: ['*.cjs'], + overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], + settings: { + 'svelte3/typescript': () => require('typescript') + }, + parserOptions: { + sourceType: 'module', + ecmaVersion: 2020 + }, + env: { + browser: true, + es2017: true, + node: true + } +}; diff --git a/examples/sveltekit/.gitignore b/examples/sveltekit/.gitignore new file mode 100644 index 0000000..1d6d7a1 --- /dev/null +++ b/examples/sveltekit/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +node_modules +/build +/.svelte-kit +/package +.env +!.env.example +_kitql \ No newline at end of file diff --git a/examples/sveltekit/.npmrc b/examples/sveltekit/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/examples/sveltekit/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/examples/sveltekit/.prettierrc b/examples/sveltekit/.prettierrc new file mode 100644 index 0000000..ff2677e --- /dev/null +++ b/examples/sveltekit/.prettierrc @@ -0,0 +1,6 @@ +{ + "useTabs": true, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100 +} diff --git a/examples/sveltekit/README.md b/examples/sveltekit/README.md new file mode 100644 index 0000000..202829a --- /dev/null +++ b/examples/sveltekit/README.md @@ -0,0 +1,3 @@ +# pg-graphql-example & sveltekit + +Using [KitQL](https://github.com/jycouet/kitql) A set of tools, helping you building efficient apps in a fast way. >> SvelteKit & GraphQL << diff --git a/examples/sveltekit/package.json b/examples/sveltekit/package.json new file mode 100644 index 0000000..8e5c8a9 --- /dev/null +++ b/examples/sveltekit/package.json @@ -0,0 +1,45 @@ +{ + "name": "sveltekit", + "version": "0.0.1", + "scripts": { + "dev": "env-cmd svelte-kit dev --port 3001", + "build": "svelte-kit build", + "package": "svelte-kit package", + "preview": "env-cmd svelte-kit preview", + "prepare": "svelte-kit sync", + "check": "svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .", + "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ." + }, + "devDependencies": { + "@sveltejs/adapter-auto": "next", + "@sveltejs/kit": "next", + "@typescript-eslint/eslint-plugin": "^5.10.1", + "@typescript-eslint/parser": "^5.10.1", + "autoprefixer": "^10.4.2", + "eslint": "^7.32.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-svelte3": "^3.2.1", + "postcss": "^8.4.5", + "postcss-load-config": "^3.1.1", + "prettier": "^2.5.1", + "prettier-plugin-svelte": "^2.5.0", + "svelte": "^3.44.0", + "svelte-check": "^2.2.6", + "svelte-preprocess": "^4.10.1", + "tailwindcss": "^3.0.12", + "tslib": "^2.3.1", + "typescript": "~4.6.2" + }, + "type": "module", + "dependencies": { + "@graphql-yoga/common": "2.0.0", + "@iconify/json": "2.1.22", + "@kitql/all-in": "0.6.2", + "@svitejs/svelte-preprocess-svg": "1.0.2", + "env-cmd": "10.1.0", + "javascript-time-ago": "2.3.13", + "unplugin-icons": "0.14.1" + } +} diff --git a/examples/sveltekit/postcss.config.cjs b/examples/sveltekit/postcss.config.cjs new file mode 100644 index 0000000..fe10e55 --- /dev/null +++ b/examples/sveltekit/postcss.config.cjs @@ -0,0 +1,13 @@ +const tailwindcss = require('tailwindcss'); +const autoprefixer = require('autoprefixer'); + +const config = { + plugins: [ + //Some plugins, like tailwindcss/nesting, need to run before Tailwind, + tailwindcss(), + //But others, like autoprefixer, need to run after, + autoprefixer + ] +}; + +module.exports = config; diff --git a/examples/sveltekit/src/app.css b/examples/sveltekit/src/app.css new file mode 100644 index 0000000..1a7b7cf --- /dev/null +++ b/examples/sveltekit/src/app.css @@ -0,0 +1,4 @@ +/* Write your global styles here, in PostCSS syntax */ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/examples/sveltekit/src/app.d.ts b/examples/sveltekit/src/app.d.ts new file mode 100644 index 0000000..baca09d --- /dev/null +++ b/examples/sveltekit/src/app.d.ts @@ -0,0 +1,14 @@ +/// + +// See https://kit.svelte.dev/docs/types#the-app-namespace +// for information about these interfaces +declare namespace App { + // interface Locals {} + // interface Platform {} + // interface Session {} + // interface Stuff {} +} + +declare module '~icons/*' { + export { SvelteComponentDev as default } from 'svelte/internal'; +} diff --git a/examples/sveltekit/src/app.html b/examples/sveltekit/src/app.html new file mode 100644 index 0000000..94cf1a1 --- /dev/null +++ b/examples/sveltekit/src/app.html @@ -0,0 +1,14 @@ + + + + + + + + + %svelte.head% + + +
%svelte.body%
+ + diff --git a/examples/sveltekit/src/lib/Container.svelte b/examples/sveltekit/src/lib/Container.svelte new file mode 100644 index 0000000..2a8f981 --- /dev/null +++ b/examples/sveltekit/src/lib/Container.svelte @@ -0,0 +1,3 @@ +
+ +
diff --git a/examples/sveltekit/src/lib/DeleteButton_PostFragment.gql b/examples/sveltekit/src/lib/DeleteButton_PostFragment.gql new file mode 100644 index 0000000..4041ca6 --- /dev/null +++ b/examples/sveltekit/src/lib/DeleteButton_PostFragment.gql @@ -0,0 +1,3 @@ +fragment DeleteButton_PostFragment on Post { + id +} diff --git a/examples/sveltekit/src/lib/FeedItem.svelte b/examples/sveltekit/src/lib/FeedItem.svelte new file mode 100644 index 0000000..ee8935c --- /dev/null +++ b/examples/sveltekit/src/lib/FeedItem.svelte @@ -0,0 +1,277 @@ + + + + + diff --git a/examples/sveltekit/src/lib/FeedItem_PostFragment.gql b/examples/sveltekit/src/lib/FeedItem_PostFragment.gql new file mode 100644 index 0000000..e3e6745 --- /dev/null +++ b/examples/sveltekit/src/lib/FeedItem_PostFragment.gql @@ -0,0 +1,17 @@ +fragment FeedItem_PostFragment on Post { + id + title + url + voteTotal + createdAt + commentCollection { + totalCount + } + profile { + id + username + avatarUrl + } + ...VoteButtons_PostFragment + ...DeleteButton_PostFragment +} diff --git a/examples/sveltekit/src/lib/Footer.svelte b/examples/sveltekit/src/lib/Footer.svelte new file mode 100644 index 0000000..2a1659f --- /dev/null +++ b/examples/sveltekit/src/lib/Footer.svelte @@ -0,0 +1,57 @@ + + + diff --git a/examples/sveltekit/src/lib/Icons.svelte b/examples/sveltekit/src/lib/Icons.svelte new file mode 100644 index 0000000..7b1a6f5 --- /dev/null +++ b/examples/sveltekit/src/lib/Icons.svelte @@ -0,0 +1,186 @@ + + +{#if name === 'SupabaseIcon'} + + + + + + + + + + + + + + + +{:else if name === 'KitQL'} + + + + +{:else if name === 'CalendarIcon'} + + + + +{:else if name === 'TrashIcon'} + + + +{:else if name === 'CommentIcon'} + + + +{:else if name === 'PointIcon'} + + + +{:else if name === 'UserIcon'} + + + + +{:else if name === 'ChevronUpIcon'} + + + +{:else if name === 'ChevronDownIcon'} + + + +{:else if name === 'CodeIcon'} + +{:else if name === 'CogIcon'} + +{:else if name === 'CollectionIcon'} + +{:else if name === 'ColorSwatchIcon'} + +{:else if name === 'DatabaseIcon'} + +{:else if name === 'GlobeAltIcon'} + +{:else if name === 'LightningBoltIcon'} + +{:else if name === 'ShieldCheckIcon'} + +{:else if name === 'TemplateIcon'} + +{:else if name === 'GitHub'} + +{:else if name === 'Twitter'} + +{:else} + NOT FOUND +{/if} diff --git a/examples/sveltekit/src/lib/Loading.svelte b/examples/sveltekit/src/lib/Loading.svelte new file mode 100644 index 0000000..bcd8ae6 --- /dev/null +++ b/examples/sveltekit/src/lib/Loading.svelte @@ -0,0 +1,8 @@ + + +
+
+ +
diff --git a/examples/sveltekit/src/lib/MainSection.svelte b/examples/sveltekit/src/lib/MainSection.svelte new file mode 100644 index 0000000..9bab2ef --- /dev/null +++ b/examples/sveltekit/src/lib/MainSection.svelte @@ -0,0 +1,3 @@ +
+ +
diff --git a/examples/sveltekit/src/lib/Navigation.svelte b/examples/sveltekit/src/lib/Navigation.svelte new file mode 100644 index 0000000..ea77082 --- /dev/null +++ b/examples/sveltekit/src/lib/Navigation.svelte @@ -0,0 +1,61 @@ + + +
+
+ + + supanews + + + + {#if user === null} + + login + + {:else} + + account + + + logout + + {/if} +
+
diff --git a/examples/sveltekit/src/lib/VoteButtons_PostFragment.gql b/examples/sveltekit/src/lib/VoteButtons_PostFragment.gql new file mode 100644 index 0000000..757dbc8 --- /dev/null +++ b/examples/sveltekit/src/lib/VoteButtons_PostFragment.gql @@ -0,0 +1,13 @@ +fragment VoteButtons_PostFragment on Post { + id + upVoteByViewer: voteCollection( + filter: { profileId: { eq: $profileId }, direction: { eq: "UP" } } + ) { + totalCount + } + downVoteByViewer: voteCollection( + filter: { profileId: { eq: $profileId }, direction: { eq: "DOWN" } } + ) { + totalCount + } +} diff --git a/examples/sveltekit/src/lib/graphql/kitQLClient.ts b/examples/sveltekit/src/lib/graphql/kitQLClient.ts new file mode 100644 index 0000000..2d6ba9e --- /dev/null +++ b/examples/sveltekit/src/lib/graphql/kitQLClient.ts @@ -0,0 +1,11 @@ +import { KitQLClient } from '@kitql/client'; + +export const kitQLClient = new KitQLClient({ + url: `${import.meta.env.VITE_PUBLIC_SUPABASE_URL}/graphql/v1`, + credentials: 'omit', + headersContentType: 'application/json', + headers: { + apikey: `${import.meta.env.VITE_PUBLIC_SUPABASE_ANON_KEY}` + }, + logType: ['server', 'client', 'operationAndvariables'] +}); diff --git a/examples/sveltekit/src/lib/noop-uuid.ts b/examples/sveltekit/src/lib/noop-uuid.ts new file mode 100644 index 0000000..999cc23 --- /dev/null +++ b/examples/sveltekit/src/lib/noop-uuid.ts @@ -0,0 +1,4 @@ +/** + * Noop UUID for GraphQL operations that require an UUID + */ +export const noopUUID = '00000000-0000-0000-0000-000000000000'; diff --git a/examples/sveltekit/src/lib/time-ago.ts b/examples/sveltekit/src/lib/time-ago.ts new file mode 100644 index 0000000..6e44cea --- /dev/null +++ b/examples/sveltekit/src/lib/time-ago.ts @@ -0,0 +1,6 @@ +import TimeAgo from 'javascript-time-ago'; +import en from 'javascript-time-ago/locale/en.json'; + +TimeAgo.addDefaultLocale(en); + +export const timeAgo = new TimeAgo('en-US'); diff --git a/examples/sveltekit/src/routes/IndexRouteQuery.gql b/examples/sveltekit/src/routes/IndexRouteQuery.gql new file mode 100644 index 0000000..e494b83 --- /dev/null +++ b/examples/sveltekit/src/routes/IndexRouteQuery.gql @@ -0,0 +1,15 @@ +query IndexRouteQuery($profileId: UUID!, $after: Cursor) { + feed: postCollection(orderBy: [{ voteRank: AscNullsFirst }], first: 15, after: $after) { + pageInfo { + hasNextPage + endCursor + } + edges { + cursor + node { + id + ...FeedItem_PostFragment + } + } + } +} diff --git a/examples/sveltekit/src/routes/__layout.svelte b/examples/sveltekit/src/routes/__layout.svelte new file mode 100644 index 0000000..91434c3 --- /dev/null +++ b/examples/sveltekit/src/routes/__layout.svelte @@ -0,0 +1,18 @@ + + + + supanews + + + + + + +