From f5beb28046d1dc2196011b98cd589d3a8f8609a7 Mon Sep 17 00:00:00 2001 From: Dijana Pavlovic Date: Tue, 25 Feb 2025 18:43:50 +0100 Subject: [PATCH] Fix diff create pkg issues --- packages/create/README.md | 4 +- .../recipes/_base/template/eslint.config.mjs | 4 +- packages/create/src/recipes/nextjs/index.ts | 2 - .../recipes/nextjs/template/js/jsconfig.json | 6 +- .../recipes/nextjs/template/js/next-env.d.ts | 5 - .../js/src/app/globals.__app.__tw.css | 12 +- .../template/js/src/app/page.__app.__auth.jsx | 2 +- .../js/src/app/page.__app.__tw.__auth.jsx | 11 +- .../src/pages.__pages/index.__tw.__auth.jsx | 144 +++++++++++++++++ .../{index.__tw.tsx => index.__tw.jsx} | 0 .../js/src/styles.__pages/globals.__tw.css | 12 +- .../template/js/tailwind.config.__tw.js | 18 --- .../ts/src/app/globals.__app.__tw.css | 12 +- .../template/ts/src/app/page.__app.__auth.tsx | 2 +- .../ts/src/app/page.__app.__tw.__auth.tsx | 4 +- .../src/pages.__pages/index.__tw.__auth.tsx | 147 ++++++++++++++++++ .../ts/src/styles.__pages/globals.__tw.css | 12 +- .../template/ts/tailwind.config.__tw.ts | 20 --- .../template/app/routes/_index.__auth.tsx | 2 +- 19 files changed, 343 insertions(+), 76 deletions(-) delete mode 100644 packages/create/src/recipes/nextjs/template/js/next-env.d.ts create mode 100644 packages/create/src/recipes/nextjs/template/js/src/pages.__pages/index.__tw.__auth.jsx rename packages/create/src/recipes/nextjs/template/js/src/pages.__pages/{index.__tw.tsx => index.__tw.jsx} (100%) delete mode 100644 packages/create/src/recipes/nextjs/template/js/tailwind.config.__tw.js create mode 100644 packages/create/src/recipes/nextjs/template/ts/src/pages.__pages/index.__tw.__auth.tsx delete mode 100644 packages/create/src/recipes/nextjs/template/ts/tailwind.config.__tw.ts diff --git a/packages/create/README.md b/packages/create/README.md index 357970777..9b8e6d1fc 100644 --- a/packages/create/README.md +++ b/packages/create/README.md @@ -1,10 +1,10 @@ # `@gel/create`: Project scaffolding for Gel-backed applications -The `@gel/create` package provides a starting point for various frameworks with everything you need to start building an Gel-backed application. We aim to follow the same conventions as the original "create-app" templates, but with Gel as the database. There are a few different templates to choose from, including: Next.js, Remix, Express, Node HTTP Server. +The `@gel/create` package provides a starting point for various frameworks with everything you need to start building a Gel-backed application. We aim to follow the same conventions as the original "create-app" templates, but with Gel as the database. There are a few different templates to choose from, including: Next.js, Remix, SvelteKit, Express, Node HTTP Server. Important points to note: -- **Upstream changes:** We try to actively monitor and incorporate significant changes from the original "create-app" templates to to ensure developers have access to the latest features and best practices. +- **Upstream changes:** We try to actively monitor and incorporate significant changes from the original "create-app" templates to ensure developers have access to the latest features and best practices. - **Support for major options:** While we strive to support the major options offered by the upstream "create-apps", we might not cover every possible configuration or permutation due to the vast scope of possibilities. - **Gel CLI installation:** For users who do not have the Gel CLI installed, we automatically install it using our typical installation procedure. diff --git a/packages/create/src/recipes/_base/template/eslint.config.mjs b/packages/create/src/recipes/_base/template/eslint.config.mjs index 16595294f..c45f0c5b5 100644 --- a/packages/create/src/recipes/_base/template/eslint.config.mjs +++ b/packages/create/src/recipes/_base/template/eslint.config.mjs @@ -1,7 +1,7 @@ // @ts-check -import eslint from '@eslint/js'; -import tseslint from 'typescript-eslint'; +import eslint from "@eslint/js"; +import tseslint from "typescript-eslint"; export default tseslint.config( eslint.configs.recommended, diff --git a/packages/create/src/recipes/nextjs/index.ts b/packages/create/src/recipes/nextjs/index.ts index e78239c79..b0ac93a56 100644 --- a/packages/create/src/recipes/nextjs/index.ts +++ b/packages/create/src/recipes/nextjs/index.ts @@ -77,8 +77,6 @@ const recipe: Recipe = { files: [ "tsconfig.json", "jsconfig.json", - "tailwind.config.ts", - "tailwind.config.js", "src/app/page.tsx", "src/app/page.jsx", "src/pages/index.tsx", diff --git a/packages/create/src/recipes/nextjs/template/js/jsconfig.json b/packages/create/src/recipes/nextjs/template/js/jsconfig.json index 187552ff7..f35ef4d6a 100644 --- a/packages/create/src/recipes/nextjs/template/js/jsconfig.json +++ b/packages/create/src/recipes/nextjs/template/js/jsconfig.json @@ -1,9 +1,7 @@ { "compilerOptions": { "paths": { - "@/*": [ - "./{{{srcDir}}}*" - ] + "@/*": ["./{{{srcDir}}}*"] } } -} \ No newline at end of file +} diff --git a/packages/create/src/recipes/nextjs/template/js/next-env.d.ts b/packages/create/src/recipes/nextjs/template/js/next-env.d.ts deleted file mode 100644 index 4f11a03dc..000000000 --- a/packages/create/src/recipes/nextjs/template/js/next-env.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -/// - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/packages/create/src/recipes/nextjs/template/js/src/app/globals.__app.__tw.css b/packages/create/src/recipes/nextjs/template/js/src/app/globals.__app.__tw.css index fd81e8858..7a60c2add 100644 --- a/packages/create/src/recipes/nextjs/template/js/src/app/globals.__app.__tw.css +++ b/packages/create/src/recipes/nextjs/template/js/src/app/globals.__app.__tw.css @@ -1,6 +1,12 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; +@import "tailwindcss"; + +@theme { + --background-image-gradient-radial: radial-gradient(var(--tw-gradient-stops)); + --background-image-gradient-conic: conic-gradient( + from 180deg at 50% 50%, + var(--tw-gradient-stops) + ); +} :root { --foreground-rgb: 0, 0, 0; diff --git a/packages/create/src/recipes/nextjs/template/js/src/app/page.__app.__auth.jsx b/packages/create/src/recipes/nextjs/template/js/src/app/page.__app.__auth.jsx index 7394912bf..35bd256b2 100644 --- a/packages/create/src/recipes/nextjs/template/js/src/app/page.__app.__auth.jsx +++ b/packages/create/src/recipes/nextjs/template/js/src/app/page.__app.__auth.jsx @@ -4,7 +4,7 @@ import styles from "./page.module.css"; import { auth } from "@/gel"; export default async function Home() { - const session = auth.getSession(); + const session = await auth.getSession(); const signedIn = await session.isSignedIn(); diff --git a/packages/create/src/recipes/nextjs/template/js/src/app/page.__app.__tw.__auth.jsx b/packages/create/src/recipes/nextjs/template/js/src/app/page.__app.__tw.__auth.jsx index 33673abfc..a88653bf8 100644 --- a/packages/create/src/recipes/nextjs/template/js/src/app/page.__app.__tw.__auth.jsx +++ b/packages/create/src/recipes/nextjs/template/js/src/app/page.__app.__tw.__auth.jsx @@ -3,7 +3,7 @@ import Image from "next/image"; import { auth } from "@/gel"; export default async function Home() { - const session = auth.getSession(); + const session = await auth.getSession(); const signedIn = await session.isSignedIn(); @@ -20,11 +20,10 @@ export default async function Home() { You are signed in. Sign Out

) : ( -

- You are not signed in. -
- Sign In with Builtin UI -

+

+ You are not signed in. + Sign In with Builtin UI +

)}
diff --git a/packages/create/src/recipes/nextjs/template/js/src/pages.__pages/index.__tw.__auth.jsx b/packages/create/src/recipes/nextjs/template/js/src/pages.__pages/index.__tw.__auth.jsx new file mode 100644 index 000000000..81503c831 --- /dev/null +++ b/packages/create/src/recipes/nextjs/template/js/src/pages.__pages/index.__tw.__auth.jsx @@ -0,0 +1,144 @@ +import Image from "next/image"; +import { Inter } from "next/font/google"; + +import { auth } from "@/gel"; +import { auth as clientAuth } from "@/gel.client"; + + +const inter = Inter({ subsets: ["latin"] }); + +export const getServerSideProps = (async ({ req }) => { + const session = auth.getSession(req); + + return { + props: { signedIn: await session.isSignedIn() }, + }; +}); + +export default function Home({ signedIn }) { + return ( +
+
+

+ Get started by editing  + {{{srcDir}}}pages/index.jsx +

+ + {signedIn ? ( +

+ You are signed in.{" "} + Sign Out +

+ ) : ( +

+ You are not signed in. +
+ Sign In with Builtin UI +

+ )} + + +
+ +
+ Next.js Logo +
+ + +
+ ); +} diff --git a/packages/create/src/recipes/nextjs/template/js/src/pages.__pages/index.__tw.tsx b/packages/create/src/recipes/nextjs/template/js/src/pages.__pages/index.__tw.jsx similarity index 100% rename from packages/create/src/recipes/nextjs/template/js/src/pages.__pages/index.__tw.tsx rename to packages/create/src/recipes/nextjs/template/js/src/pages.__pages/index.__tw.jsx diff --git a/packages/create/src/recipes/nextjs/template/js/src/styles.__pages/globals.__tw.css b/packages/create/src/recipes/nextjs/template/js/src/styles.__pages/globals.__tw.css index fd81e8858..7a60c2add 100644 --- a/packages/create/src/recipes/nextjs/template/js/src/styles.__pages/globals.__tw.css +++ b/packages/create/src/recipes/nextjs/template/js/src/styles.__pages/globals.__tw.css @@ -1,6 +1,12 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; +@import "tailwindcss"; + +@theme { + --background-image-gradient-radial: radial-gradient(var(--tw-gradient-stops)); + --background-image-gradient-conic: conic-gradient( + from 180deg at 50% 50%, + var(--tw-gradient-stops) + ); +} :root { --foreground-rgb: 0, 0, 0; diff --git a/packages/create/src/recipes/nextjs/template/js/tailwind.config.__tw.js b/packages/create/src/recipes/nextjs/template/js/tailwind.config.__tw.js deleted file mode 100644 index 0df2b4659..000000000 --- a/packages/create/src/recipes/nextjs/template/js/tailwind.config.__tw.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: [ - "./{{{srcDir}}}pages/**/*.{js,ts,jsx,tsx,mdx}", - "./{{{srcDir}}}components/**/*.{js,ts,jsx,tsx,mdx}", - "./{{{srcDir}}}app/**/*.{js,ts,jsx,tsx,mdx}", - ], - theme: { - extend: { - backgroundImage: { - "gradient-radial": "radial-gradient(var(--tw-gradient-stops))", - "gradient-conic": - "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))", - }, - }, - }, - plugins: [], -}; diff --git a/packages/create/src/recipes/nextjs/template/ts/src/app/globals.__app.__tw.css b/packages/create/src/recipes/nextjs/template/ts/src/app/globals.__app.__tw.css index fd81e8858..7a60c2add 100644 --- a/packages/create/src/recipes/nextjs/template/ts/src/app/globals.__app.__tw.css +++ b/packages/create/src/recipes/nextjs/template/ts/src/app/globals.__app.__tw.css @@ -1,6 +1,12 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; +@import "tailwindcss"; + +@theme { + --background-image-gradient-radial: radial-gradient(var(--tw-gradient-stops)); + --background-image-gradient-conic: conic-gradient( + from 180deg at 50% 50%, + var(--tw-gradient-stops) + ); +} :root { --foreground-rgb: 0, 0, 0; diff --git a/packages/create/src/recipes/nextjs/template/ts/src/app/page.__app.__auth.tsx b/packages/create/src/recipes/nextjs/template/ts/src/app/page.__app.__auth.tsx index 71be16d7b..75ec6d84a 100644 --- a/packages/create/src/recipes/nextjs/template/ts/src/app/page.__app.__auth.tsx +++ b/packages/create/src/recipes/nextjs/template/ts/src/app/page.__app.__auth.tsx @@ -4,7 +4,7 @@ import styles from "./page.module.css"; import { auth } from "@/gel"; export default async function Home() { - const session = auth.getSession(); + const session = await auth.getSession(); const signedIn = await session.isSignedIn(); diff --git a/packages/create/src/recipes/nextjs/template/ts/src/app/page.__app.__tw.__auth.tsx b/packages/create/src/recipes/nextjs/template/ts/src/app/page.__app.__tw.__auth.tsx index 9d7e3c63b..77fd02b90 100644 --- a/packages/create/src/recipes/nextjs/template/ts/src/app/page.__app.__tw.__auth.tsx +++ b/packages/create/src/recipes/nextjs/template/ts/src/app/page.__app.__tw.__auth.tsx @@ -3,7 +3,7 @@ import Image from "next/image"; import { auth } from "@/gel"; export default async function Home() { - const session = auth.getSession(); + const session = await auth.getSession(); const signedIn = await session.isSignedIn(); @@ -20,7 +20,7 @@ export default async function Home() { You are signed in. Sign Out

) : ( -

+

You are not signed in.
Sign In with Builtin UI diff --git a/packages/create/src/recipes/nextjs/template/ts/src/pages.__pages/index.__tw.__auth.tsx b/packages/create/src/recipes/nextjs/template/ts/src/pages.__pages/index.__tw.__auth.tsx new file mode 100644 index 000000000..5d3db3c79 --- /dev/null +++ b/packages/create/src/recipes/nextjs/template/ts/src/pages.__pages/index.__tw.__auth.tsx @@ -0,0 +1,147 @@ +import { GetServerSideProps, InferGetServerSidePropsType } from "next"; +import Image from "next/image"; +import { Inter } from "next/font/google"; + +import { auth } from "@/gel"; +import { auth as clientAuth } from "@/gel.client"; + +const inter = Inter({ subsets: ["latin"] }); + +export const getServerSideProps = (async ({ req }) => { + const session = auth.getSession(req); + + return { + props: { signedIn: await session.isSignedIn() }, + }; +}) satisfies GetServerSideProps<{ + signedIn: boolean; +}>; + +export default function Home({ + signedIn, +}: InferGetServerSidePropsType) { + return ( +

+
+

+ Get started by editing  + {{{srcDir}}}pages/index.tsx +

+ + {signedIn ? ( +

+ You are signed in. Sign Out +

+ ) : ( +

+ You are not signed in. +
+ Sign In with Builtin UI +

+ )} + + +
+ +
+ Next.js Logo +
+ + +
+ ); +} diff --git a/packages/create/src/recipes/nextjs/template/ts/src/styles.__pages/globals.__tw.css b/packages/create/src/recipes/nextjs/template/ts/src/styles.__pages/globals.__tw.css index fd81e8858..7a60c2add 100644 --- a/packages/create/src/recipes/nextjs/template/ts/src/styles.__pages/globals.__tw.css +++ b/packages/create/src/recipes/nextjs/template/ts/src/styles.__pages/globals.__tw.css @@ -1,6 +1,12 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; +@import "tailwindcss"; + +@theme { + --background-image-gradient-radial: radial-gradient(var(--tw-gradient-stops)); + --background-image-gradient-conic: conic-gradient( + from 180deg at 50% 50%, + var(--tw-gradient-stops) + ); +} :root { --foreground-rgb: 0, 0, 0; diff --git a/packages/create/src/recipes/nextjs/template/ts/tailwind.config.__tw.ts b/packages/create/src/recipes/nextjs/template/ts/tailwind.config.__tw.ts deleted file mode 100644 index f9cfeebb6..000000000 --- a/packages/create/src/recipes/nextjs/template/ts/tailwind.config.__tw.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { Config } from "tailwindcss"; - -const config: Config = { - content: [ - "./{{{srcDir}}}pages/**/*.{js,ts,jsx,tsx,mdx}", - "./{{{srcDir}}}components/**/*.{js,ts,jsx,tsx,mdx}", - "./{{{srcDir}}}app/**/*.{js,ts,jsx,tsx,mdx}", - ], - theme: { - extend: { - backgroundImage: { - "gradient-radial": "radial-gradient(var(--tw-gradient-stops))", - "gradient-conic": - "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))", - }, - }, - }, - plugins: [], -}; -export default config; diff --git a/packages/create/src/recipes/remix/template/app/routes/_index.__auth.tsx b/packages/create/src/recipes/remix/template/app/routes/_index.__auth.tsx index ea093cf15..7823d166c 100644 --- a/packages/create/src/recipes/remix/template/app/routes/_index.__auth.tsx +++ b/packages/create/src/recipes/remix/template/app/routes/_index.__auth.tsx @@ -16,7 +16,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { const isSignedIn = await session.isSignedIn(); const builtinUIEnabled = await client.queryRequiredSingle( - `select exists ext::auth::UIConfig` + `select exists ext::auth::UIConfig`, ); return json({