From 774ddbc9af752be972e1f10154032bf748010992 Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Wed, 17 Jul 2024 16:32:38 +0300 Subject: [PATCH 1/3] fix: Failed build due to duplicate identifier of GeneratedTypes --- apps/roboshield/payload-types.ts | 72 +++++++++++++------------------ apps/roboshield/payload.config.ts | 8 ++++ 2 files changed, 38 insertions(+), 42 deletions(-) diff --git a/apps/roboshield/payload-types.ts b/apps/roboshield/payload-types.ts index 6928f0159..18b4b04eb 100644 --- a/apps/roboshield/payload-types.ts +++ b/apps/roboshield/payload-types.ts @@ -11,11 +11,11 @@ export interface Config { media: Media; pages: Page; users: User; - "payload-preferences": PayloadPreference; - "payload-migrations": PayloadMigration; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; }; globals: { - "settings-site": SettingsSite; + 'settings-site': SettingsSite; }; } /** @@ -53,7 +53,7 @@ export interface Page { subtitle: string; id?: string | null; blockName?: string | null; - blockType: "page-header"; + blockType: 'page-header'; } | SiteHero | { @@ -65,30 +65,30 @@ export interface Page { }[]; id?: string | null; blockName?: string | null; - blockType: "richtext"; + blockType: 'richtext'; } | { image: string | Media; id?: string | null; blockName?: string | null; - blockType: "mediaBlock"; + blockType: 'mediaBlock'; } | { externalEmbedFields?: { - embedType?: ("url" | "code") | null; + embedType?: ('url' | 'code') | null; url?: string | null; caption?: string | null; code?: string | null; }; id?: string | null; blockName?: string | null; - blockType: "externalEmbed"; + blockType: 'externalEmbed'; } )[] | null; id?: string | null; blockName?: string | null; - blockType: "content"; + blockType: 'content'; } | { title: string; @@ -105,7 +105,7 @@ export interface Page { | null; id?: string | null; blockName?: string | null; - blockType: "statistics"; + blockType: 'statistics'; } | { steps?: @@ -124,7 +124,7 @@ export interface Page { fetch: string; id?: string | null; blockName?: string | null; - blockType: "existing-robots-txt"; + blockType: 'existing-robots-txt'; } | { title: string; @@ -147,7 +147,7 @@ export interface Page { }; id?: string | null; blockName?: string | null; - blockType: "delays"; + blockType: 'delays'; } | { title: string; @@ -170,7 +170,7 @@ export interface Page { }; id?: string | null; blockName?: string | null; - blockType: "paths"; + blockType: 'paths'; } | { title: string; @@ -189,7 +189,7 @@ export interface Page { }; id?: string | null; blockName?: string | null; - blockType: "block-bots"; + blockType: 'block-bots'; } | { title: string; @@ -201,7 +201,7 @@ export interface Page { placeholder: string; id?: string | null; blockName?: string | null; - blockType: "site-maps"; + blockType: 'site-maps'; } | { title: string; @@ -213,7 +213,7 @@ export interface Page { placeholder: string; id?: string | null; blockName?: string | null; - blockType: "finish"; + blockType: 'finish'; } )[] | null; @@ -227,7 +227,7 @@ export interface Page { }; id?: string | null; blockName?: string | null; - blockType: "robots-txt-generator"; + blockType: 'robots-txt-generator'; } )[] | null; @@ -247,7 +247,7 @@ export interface Page { | null; updatedAt: string; createdAt: string; - _status?: ("draft" | "published") | null; + _status?: ('draft' | 'published') | null; } /** * This interface was referenced by `Config`'s JSON-Schema @@ -256,7 +256,7 @@ export interface Page { export interface SiteHero { heroHeaders?: | { - headingType?: ("largeHeading" | "subHeading" | "rotatingText") | null; + headingType?: ('largeHeading' | 'subHeading' | 'rotatingText') | null; title?: string | null; id?: string | null; }[] @@ -267,7 +267,7 @@ export interface SiteHero { heroCallToAction?: string | null; id?: string | null; blockName?: string | null; - blockType: "page-hero"; + blockType: 'page-hero'; } /** * This interface was referenced by `Config`'s JSON-Schema @@ -277,7 +277,7 @@ export interface User { id: string; firstName: string; lastName: string; - roles: ("admin" | "editor")[]; + roles: ('admin' | 'editor')[]; updatedAt: string; createdAt: string; email: string; @@ -298,7 +298,7 @@ export interface User { export interface PayloadPreference { id: string; user: { - relationTo: "users"; + relationTo: 'users'; value: string | User; }; key?: string | null; @@ -341,9 +341,9 @@ export interface SettingsSite { menus?: | { label: string; - linkType?: ("custom" | "internal") | null; + linkType?: ('custom' | 'internal') | null; doc?: { - relationTo: "pages"; + relationTo: 'pages'; value: string | Page; } | null; url?: string | null; @@ -351,17 +351,15 @@ export interface SettingsSite { id?: string | null; }[] | null; - connect?: - | ("Facebook" | "Twitter" | "Instagram" | "Linkedin" | "Github" | "Slack") - | null; + connect?: ('Facebook' | 'Twitter' | 'Instagram' | 'Linkedin' | 'Github' | 'Slack') | null; }; secondaryNavigation?: { menus?: | { label: string; - linkType?: ("custom" | "internal") | null; + linkType?: ('custom' | 'internal') | null; doc?: { - relationTo: "pages"; + relationTo: 'pages'; value: string | Page; } | null; url?: string | null; @@ -374,13 +372,7 @@ export interface SettingsSite { title: string; links?: | { - platform: - | "Facebook" - | "Twitter" - | "Instagram" - | "Linkedin" - | "Github" - | "Slack"; + platform: 'Facebook' | 'Twitter' | 'Instagram' | 'Linkedin' | 'Github' | 'Slack'; url: string; id?: string | null; }[] @@ -400,9 +392,9 @@ export interface SettingsSite { name: string; logo: string | Media; label: string; - linkType?: ("custom" | "internal") | null; + linkType?: ('custom' | 'internal') | null; doc?: { - relationTo: "pages"; + relationTo: 'pages'; value: string | Page; } | null; url?: string | null; @@ -414,7 +406,3 @@ export interface SettingsSite { updatedAt?: string | null; createdAt?: string | null; } - -declare module "payload" { - export interface GeneratedTypes extends Config {} -} diff --git a/apps/roboshield/payload.config.ts b/apps/roboshield/payload.config.ts index ed46ab712..487f2b6da 100644 --- a/apps/roboshield/payload.config.ts +++ b/apps/roboshield/payload.config.ts @@ -13,6 +13,7 @@ import { s3Adapter } from "@payloadcms/plugin-cloud-storage/s3"; import Users from "./src/payload/collections/Users"; import { defaultLocale, locales } from "./src/payload/utils/locales"; import { loadEnvConfig } from "@next/env"; +import { Config } from "./payload-types"; const projectDir = process.cwd(); loadEnvConfig(projectDir); @@ -122,4 +123,11 @@ export default buildConfig({ }), ] as any[], telemetry: process?.env?.NODE_ENV !== "production", + typescript: { + declare: false, // defaults to true if not set + }, }); + +declare module "payload" { + export interface PayloadGeneratedTypes extends Config {} +} From 2aed4645f80615d1159a5fb010d944e79836eb0e Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Wed, 17 Jul 2024 16:33:14 +0300 Subject: [PATCH 2/3] fix: Fix linting issues --- apps/roboshield/payload-types.ts | 68 ++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/apps/roboshield/payload-types.ts b/apps/roboshield/payload-types.ts index 18b4b04eb..9ca401cb1 100644 --- a/apps/roboshield/payload-types.ts +++ b/apps/roboshield/payload-types.ts @@ -11,11 +11,11 @@ export interface Config { media: Media; pages: Page; users: User; - 'payload-preferences': PayloadPreference; - 'payload-migrations': PayloadMigration; + "payload-preferences": PayloadPreference; + "payload-migrations": PayloadMigration; }; globals: { - 'settings-site': SettingsSite; + "settings-site": SettingsSite; }; } /** @@ -53,7 +53,7 @@ export interface Page { subtitle: string; id?: string | null; blockName?: string | null; - blockType: 'page-header'; + blockType: "page-header"; } | SiteHero | { @@ -65,30 +65,30 @@ export interface Page { }[]; id?: string | null; blockName?: string | null; - blockType: 'richtext'; + blockType: "richtext"; } | { image: string | Media; id?: string | null; blockName?: string | null; - blockType: 'mediaBlock'; + blockType: "mediaBlock"; } | { externalEmbedFields?: { - embedType?: ('url' | 'code') | null; + embedType?: ("url" | "code") | null; url?: string | null; caption?: string | null; code?: string | null; }; id?: string | null; blockName?: string | null; - blockType: 'externalEmbed'; + blockType: "externalEmbed"; } )[] | null; id?: string | null; blockName?: string | null; - blockType: 'content'; + blockType: "content"; } | { title: string; @@ -105,7 +105,7 @@ export interface Page { | null; id?: string | null; blockName?: string | null; - blockType: 'statistics'; + blockType: "statistics"; } | { steps?: @@ -124,7 +124,7 @@ export interface Page { fetch: string; id?: string | null; blockName?: string | null; - blockType: 'existing-robots-txt'; + blockType: "existing-robots-txt"; } | { title: string; @@ -147,7 +147,7 @@ export interface Page { }; id?: string | null; blockName?: string | null; - blockType: 'delays'; + blockType: "delays"; } | { title: string; @@ -170,7 +170,7 @@ export interface Page { }; id?: string | null; blockName?: string | null; - blockType: 'paths'; + blockType: "paths"; } | { title: string; @@ -189,7 +189,7 @@ export interface Page { }; id?: string | null; blockName?: string | null; - blockType: 'block-bots'; + blockType: "block-bots"; } | { title: string; @@ -201,7 +201,7 @@ export interface Page { placeholder: string; id?: string | null; blockName?: string | null; - blockType: 'site-maps'; + blockType: "site-maps"; } | { title: string; @@ -213,7 +213,7 @@ export interface Page { placeholder: string; id?: string | null; blockName?: string | null; - blockType: 'finish'; + blockType: "finish"; } )[] | null; @@ -227,7 +227,7 @@ export interface Page { }; id?: string | null; blockName?: string | null; - blockType: 'robots-txt-generator'; + blockType: "robots-txt-generator"; } )[] | null; @@ -247,7 +247,7 @@ export interface Page { | null; updatedAt: string; createdAt: string; - _status?: ('draft' | 'published') | null; + _status?: ("draft" | "published") | null; } /** * This interface was referenced by `Config`'s JSON-Schema @@ -256,7 +256,7 @@ export interface Page { export interface SiteHero { heroHeaders?: | { - headingType?: ('largeHeading' | 'subHeading' | 'rotatingText') | null; + headingType?: ("largeHeading" | "subHeading" | "rotatingText") | null; title?: string | null; id?: string | null; }[] @@ -267,7 +267,7 @@ export interface SiteHero { heroCallToAction?: string | null; id?: string | null; blockName?: string | null; - blockType: 'page-hero'; + blockType: "page-hero"; } /** * This interface was referenced by `Config`'s JSON-Schema @@ -277,7 +277,7 @@ export interface User { id: string; firstName: string; lastName: string; - roles: ('admin' | 'editor')[]; + roles: ("admin" | "editor")[]; updatedAt: string; createdAt: string; email: string; @@ -298,7 +298,7 @@ export interface User { export interface PayloadPreference { id: string; user: { - relationTo: 'users'; + relationTo: "users"; value: string | User; }; key?: string | null; @@ -341,9 +341,9 @@ export interface SettingsSite { menus?: | { label: string; - linkType?: ('custom' | 'internal') | null; + linkType?: ("custom" | "internal") | null; doc?: { - relationTo: 'pages'; + relationTo: "pages"; value: string | Page; } | null; url?: string | null; @@ -351,15 +351,17 @@ export interface SettingsSite { id?: string | null; }[] | null; - connect?: ('Facebook' | 'Twitter' | 'Instagram' | 'Linkedin' | 'Github' | 'Slack') | null; + connect?: + | ("Facebook" | "Twitter" | "Instagram" | "Linkedin" | "Github" | "Slack") + | null; }; secondaryNavigation?: { menus?: | { label: string; - linkType?: ('custom' | 'internal') | null; + linkType?: ("custom" | "internal") | null; doc?: { - relationTo: 'pages'; + relationTo: "pages"; value: string | Page; } | null; url?: string | null; @@ -372,7 +374,13 @@ export interface SettingsSite { title: string; links?: | { - platform: 'Facebook' | 'Twitter' | 'Instagram' | 'Linkedin' | 'Github' | 'Slack'; + platform: + | "Facebook" + | "Twitter" + | "Instagram" + | "Linkedin" + | "Github" + | "Slack"; url: string; id?: string | null; }[] @@ -392,9 +400,9 @@ export interface SettingsSite { name: string; logo: string | Media; label: string; - linkType?: ('custom' | 'internal') | null; + linkType?: ("custom" | "internal") | null; doc?: { - relationTo: 'pages'; + relationTo: "pages"; value: string | Page; } | null; url?: string | null; From 4327827d2e16adab848524e70d7853730ef54337 Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Thu, 18 Jul 2024 13:43:10 +0300 Subject: [PATCH 3/3] chore: Bump Roboshield version to 0.1.6 --- apps/roboshield/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/roboshield/package.json b/apps/roboshield/package.json index 043bccbb6..06327db69 100644 --- a/apps/roboshield/package.json +++ b/apps/roboshield/package.json @@ -1,6 +1,6 @@ { "name": "roboshield", - "version": "0.1.5", + "version": "0.1.6", "private": true, "scripts": { "build-server": "tsc --project tsconfig.server.json",