From b6a4d0df61f944828d32902d99c2a9c5d09e87bc Mon Sep 17 00:00:00 2001 From: karannakra Date: Wed, 17 May 2023 04:20:35 +0530 Subject: [PATCH] Make title optional as we are expecting it to be optional in the parsedSteps object Use ?? in please of || as suggested by linter Remove conditional chaining as needsEnv will always have a value --- src/content/config.ts | 2 +- src/pages/setup/index.astro | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/content/config.ts b/src/content/config.ts index c040f373..738224ee 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -2,7 +2,7 @@ import { defineCollection,z } from 'astro:content'; const setupCollection = defineCollection({ schema: z.object({ - title: z.string(), + title: z.string().optional(), needsEnv: z.array(z.string()), }), }); diff --git a/src/pages/setup/index.astro b/src/pages/setup/index.astro index 391be17e..51971970 100644 --- a/src/pages/setup/index.astro +++ b/src/pages/setup/index.astro @@ -25,8 +25,8 @@ const parsedSteps: { }[] = []; for (const slug of checksOrder) { const step = await getEntryBySlug('setup', slug); - const havePassed = step.data.needsEnv?.every((x) => { - const value = process.env[x] || import.meta.env[x]; + const havePassed = step.data.needsEnv.every((x) => { + const value = process.env[x] ?? import.meta.env[x]; return value !== undefined && value !== false; }); if (!havePassed && firstFail == '') { @@ -61,7 +61,7 @@ for (const slug of checksOrder) {

{i + 1}. {havePassed ? '✅ ' : ''} - {step.data.title || step.slug} + {step.data.title ?? step.slug}