Benjamin
Benjamin
TTCTheo's Typesafe Cult
Created by Benjamin on 12/29/2023 in #questions
Global variable `Astro` type is `any` when migrating from v3 to v4
No description
6 replies
TTCTheo's Typesafe Cult
Created by Benjamin on 9/12/2023 in #questions
shadcn/ui DropdownMenu component not working with Astro
I followed exactly the instructions from this page to use shadcn/ui with Astro, even using their template from scratch, when I add the Dropdown Menu component and use it (again, following exactly the example), I always get the following error: DropdownMenuTrigger must be used within DropdownMenu Any idea what could be wrong given the fact that I tried on a totally empty project following the instructions? It's useless for me to share you the code, it's exactly as the link above. 😅
6 replies
TTCTheo's Typesafe Cult
Created by Benjamin on 9/6/2023 in #questions
Lint MDX files in Astro project
Does anyone has an example of how to configure ESLint for MDX files in an Astro project? It's driving me crazy when I add React components in a MDX file. Also, in VS Code, the TS syntax part is not highlighted, despite having the MDX extension installed. 🤔
2 replies
TTCTheo's Typesafe Cult
Created by Benjamin on 8/9/2023 in #questions
Why the infered type of this function is `string | undefined`?
24 replies
TTCTheo's Typesafe Cult
Created by Benjamin on 8/6/2023 in #questions
Vercel logic of deployment
I'm using Vercel for the first time and I try to grasp the logic of deployment. So far, my deployment workflow was as follow (before Vercel): - I have a GitHub workflow triggering staging deployment after a release was created (from main); - I have a manual GitHub workflow that deploys the release to production. This way, I could test a release in a staging environment linked to a specific version before manually deploying it with a single click. I would have 2 domains, one for staging, one for production. With Vercel, I understand that by default any push to any branch will trigger a build in preview mode, unless it's on main, in that case it's automatically push to production. Firstly, does it mean the release process is totally irrelevant? Such as having version in package.json, a version tag and a release? Secondly, isn't it overkill to have a deployment everytime a push is made? I would rather only deploy when a PR is open on main (that's when the feature should be tested in a production-like environment) and for every push on main. Therefore, here is my approach: - I set the "Ignore Build Step" option to "Don't build anything" ; - I have two GH workflows: - One that build a preview version on PR on main or pushes on main - One that build a production version on manual trigger. Now the deployments are closer to what I want: having an up to date staging environment (preview mode) and a manually updated production. But I feel like I'm doing it wrong and there is something I don't get. I get Vercel — Canceled by Ignored Build Step in the CI checks result everywhere (because it still triggers a deployment that is cancelled) and I cannot have a domain pointing to the staging environment: it either has to be pointing to a specific build or to production. What am I missing? thinkies
3 replies
TTCTheo's Typesafe Cult
Created by Benjamin on 8/5/2023 in #questions
How do you monitor tech news?
Like any field, it's always important to keep up with the latest news in the tech world. How do you get the most valuable information in a convenient and productive way? What tools (news aggregator, etc.)? What media? What sources (beside Theo of course 😁 )?
8 replies
TTCTheo's Typesafe Cult
Created by Benjamin on 8/3/2023 in #questions
tRPC failing on static pages (app router) build on Vercel
When deploying my Next.js app on Vercel (using v13 app router), I come across an error I struggle with during the build phase, when tRPC attempts to retrieve the first data. I assume the error comes from the API endpoint that exists but fails to execute (else I have another error when NEXT_PUBLIC_VERCEL_URL is wrong, when I try to log the request, nothing shows). I added logs (lines starting with ###...) and can notice that the URL is good. It works well on my machine if I set NEXT_PUBLIC_VERCEL_URL to localhost, I can only reproduce on Vercel. Any idea why on Vercel my API endpoint doesn't work well during static pages generation?
- info Collecting page data...
- info Generating static pages (0/4)
- info Generating static pages (1/4)
###################### URL https://***.vercel.app/api/trpc
###################### URL https://***.vercel.app/api/trpc
- info Generating static pages (2/4)
- info Generating static pages (3/4)
<< query #1 travel.getCurrentTravel {
input: undefined,
result: TRPCClientError: Unexpected token < in JSON at position 0
at TRPCClientError.from (/vercel/path0/.next/server/chunks/41.js:26142:16)
at /vercel/path0/.next/server/chunks/41.js:26293:36 {
meta: { response: [Response] },
shape: undefined,
data: undefined,
[cause]: SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at parseJSONFromBytes (node:internal/deps/undici/undici:6571:19)
at successSteps (node:internal/deps/undici/undici:6545:27)
at node:internal/deps/undici/undici:1211:60
at node:internal/process/task_queues:140:7
at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
},
elapsedMs: 562
}
- info Collecting page data...
- info Generating static pages (0/4)
- info Generating static pages (1/4)
###################### URL https://***.vercel.app/api/trpc
###################### URL https://***.vercel.app/api/trpc
- info Generating static pages (2/4)
- info Generating static pages (3/4)
<< query #1 travel.getCurrentTravel {
input: undefined,
result: TRPCClientError: Unexpected token < in JSON at position 0
at TRPCClientError.from (/vercel/path0/.next/server/chunks/41.js:26142:16)
at /vercel/path0/.next/server/chunks/41.js:26293:36 {
meta: { response: [Response] },
shape: undefined,
data: undefined,
[cause]: SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at parseJSONFromBytes (node:internal/deps/undici/undici:6571:19)
at successSteps (node:internal/deps/undici/undici:6545:27)
at node:internal/deps/undici/undici:1211:60
at node:internal/process/task_queues:140:7
at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
},
elapsedMs: 562
}
3 replies
TTCTheo's Typesafe Cult
Created by Benjamin on 7/21/2023 in #questions
How do you deal with dynamic classes ?
I found out that using dynamic classes requires you to add the given class to the safe list as Tailwind is only loading classes statically present in the className attribute. As this is obviously heavy for maintenance (if you want to keep the size optimised, stripped from unused CSS), how do you deal with this ? Here is an example, how would you make classes static ?
const Button = ({variant}: {variant: 'green' | 'blue'}) => {
return <button className={`bg-${variant}-500`}>Click me</button>
}
const Button = ({variant}: {variant: 'green' | 'blue'}) => {
return <button className={`bg-${variant}-500`}>Click me</button>
}
11 replies
TTCTheo's Typesafe Cult
Created by Benjamin on 7/16/2023 in #questions
Suggestions for a minimalist neovim settings?
I am starting to use neovim and I would like some suggestions about the basic plugins and settings I should have (let's say to code on a T3 stack). I just want what I will be using and nothing more: as simple as possible but with what brings the most value for productivity and DX. Thanks! 😁
12 replies
TTCTheo's Typesafe Cult
Created by Benjamin on 7/13/2023 in #questions
I am confused about Prisma and CUID (deprecated v1 vs v2). Does anyone understand?
I started using Prisma and checked how the T3 stack generates IDs. I see that the schema uses cuid() and Prisma documentation doesn't say anything about the version used. Is it v1 or v2? I've found a thread but it's not much helping (https://github.com/prisma/prisma/issues/17102). So, is Prisma using v1 or v2? If v1, isn't anyone concerned about using a deprecated version for security reasons ?! (https://github.com/paralleldrive/cuid#status-deprecated-due-to-security-use-cuid2-instead) Also, why the T3 app is not using the middleware solution proposed in the thread in that case? This seems quite important.
10 replies
TTCTheo's Typesafe Cult
Created by Benjamin on 7/9/2023 in #questions
What about Panda CSS?
Hey there! I can't find any talk about using Panda CSS over Tailwind on this Discord. I would like to have different opinions (especially from people with CSS skills) about it, I just started using it on a personal project with Next.js and I find its integration with TS awesome. Theo's recent video about Tailwind is not talking about this kind of solution. https://panda-css.com
27 replies