Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions apps/landing/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,32 @@ import react from "@astrojs/react";
import sitemap from "@astrojs/sitemap";
import starlight from "@astrojs/starlight";
import { agentMarkdown } from "@onequery/astro-agent-markdown/astro";
import { defineConfig, fontProviders } from "astro/config";
import { defineConfig, envField, fontProviders } from "astro/config";
import { visualizer } from "rollup-plugin-visualizer";

import {
DEFAULT_DEV_PORT,
DEV_SERVER_HOST,
REPOSITORY_URL,
} from "./src/landing/config/landing-config";
} from "./src/shared/config/site";

const BUNDLE_REPORT_TEMPLATES = ["markdown", "list", "raw-data"] as const;
const BUNDLE_REPORT_TEMPLATE_SET = new Set<string>(BUNDLE_REPORT_TEMPLATES);
const REPOSITORY_ROOT = fileURLToPath(new URL("../../", import.meta.url));

type BundleReportTemplate = (typeof BUNDLE_REPORT_TEMPLATES)[number];

function isBundleReportTemplate(
template: string
): template is BundleReportTemplate {
return BUNDLE_REPORT_TEMPLATE_SET.has(template);
}

function getBundleReportTemplate(): BundleReportTemplate {
const template = process.env.ONEQUERY_BUNDLE_REPORT_TEMPLATE ?? "markdown";

if (BUNDLE_REPORT_TEMPLATES.includes(template as BundleReportTemplate)) {
return template as BundleReportTemplate;
if (isBundleReportTemplate(template)) {
return template;
}

throw new Error(
Expand Down Expand Up @@ -53,7 +60,7 @@ function createBundleReportPlugin() {
gzipSize: true,
projectRoot: REPOSITORY_ROOT,
template,
}) as never;
});
}

export default defineConfig({
Expand All @@ -76,6 +83,15 @@ export default defineConfig({
weights: ["400 700"],
},
],
env: {
schema: {
LANDING_SLACK_WEBHOOK_URL: envField.string({
access: "secret",
context: "server",
optional: true,
}),
},
},
integrations: [
partytown({
config: {
Expand Down Expand Up @@ -174,6 +190,9 @@ export default defineConfig({
: []),
],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
dedupe: ["react", "react-dom"],
},
server: {
Expand Down
11 changes: 0 additions & 11 deletions apps/landing/src/actions/contact-action-state.ts

This file was deleted.

39 changes: 18 additions & 21 deletions apps/landing/src/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import { ActionError, defineAction } from "astro:actions";
import { env } from "cloudflare:workers";

import { submitContactLead } from "../server/landing-api";
import { ContactRequestSchema } from "../server/landing-schemas";
import { LandingNotificationConfigurationError } from "../server/landing/landing-notifications";
import type { LandingNotificationError } from "../server/landing/landing-notifications";
import { SENT_CONTACT_ACTION_STATE } from "./contact-action-state";
import type { ContactActionState } from "./contact-action-state";

function readLandingWorkerBindings() {
return {
LANDING_SLACK_WEBHOOK_URL:
typeof env.LANDING_SLACK_WEBHOOK_URL === "string"
? env.LANDING_SLACK_WEBHOOK_URL
: undefined,
};
}
import { LANDING_SLACK_WEBHOOK_URL } from "astro:env/server";

import { submitContactLead } from "@/server/api";
import { NotificationConfigurationError } from "@/server/notifications";
import type { NotificationError } from "@/server/notifications";
import { ContactRequestSchema } from "@/server/schemas";

type ContactActionState = {
status: "sent";
};

const SENT_CONTACT_ACTION_STATE = {
status: "sent",
} satisfies ContactActionState;

function createLandingActionError(error: LandingNotificationError) {
const message = LandingNotificationConfigurationError.is(error)
function createActionError(error: NotificationError) {
const message = NotificationConfigurationError.is(error)
? error.message
: "Failed to deliver notification";

Expand All @@ -34,12 +31,12 @@ export const server = {
input: ContactRequestSchema,
handler: async (input, { request }): Promise<ContactActionState> => {
const result = await submitContactLead(input, {
bindings: readLandingWorkerBindings(),
request,
slackWebhookUrl: LANDING_SLACK_WEBHOOK_URL,
});

if (result.isErr()) {
throw createLandingActionError(result.error);
throw createActionError(result.error);
}

return SENT_CONTACT_ACTION_STATE;
Expand Down
70 changes: 0 additions & 70 deletions apps/landing/src/components/blog/BlogIndex.astro

This file was deleted.

26 changes: 0 additions & 26 deletions apps/landing/src/components/blog/BlogThumbnail.astro

This file was deleted.

24 changes: 0 additions & 24 deletions apps/landing/src/components/blog/LinkedText.astro

This file was deleted.

41 changes: 0 additions & 41 deletions apps/landing/src/components/blog/OptimizedBlogImage.astro

This file was deleted.

7 changes: 0 additions & 7 deletions apps/landing/src/components/blog/blog-image-presets.ts

This file was deleted.

19 changes: 0 additions & 19 deletions apps/landing/src/components/landing/GoogleTag.astro

This file was deleted.

2 changes: 1 addition & 1 deletion apps/landing/src/content.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { docsSchema } from "@astrojs/starlight/schema";
import { glob } from "astro/loaders";
import { defineCollection } from "astro:content";

import { createBlogPostContentSchema } from "./landing/blog/blog-content-schema";
import { createBlogPostContentSchema } from "@/features/blog/schema";

const blog = defineCollection({
loader: glob({
Expand Down
29 changes: 0 additions & 29 deletions apps/landing/src/data/connectors.test.ts

This file was deleted.

Loading
Loading