Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt Superflare to work with Wrangler 3 and Remix v2 (vite compiler) #66

Open
wants to merge 130 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
733a4f4
:arrow_up: Upgrade pnpm/wrangler/better-sqlite3
acusti Jul 15, 2024
b8672c9
Remove defunct NO_D1_WARNING env var
acusti Jul 15, 2024
7a4579f
:arrow_up: Upgrade to latest remix v2.x
acusti Jul 16, 2024
88886ee
:arrow_up: Upgrade to latest typescript (v5.x)
acusti Jul 16, 2024
2d834ef
Remove defunct custom pnpm resolutions
acusti Jul 16, 2024
7ca376f
Update remix vite cloudflare-workers dependencies
acusti Jul 16, 2024
c94d3c9
Upgrade to latest tailwind + markdoc
acusti Jul 16, 2024
4d2e0e7
Update docs site to work w/ remix v2 + vite (WIP)
acusti Jul 17, 2024
339afff
Update remix-cms example for remix v2 + vite (WIP)
acusti Jul 17, 2024
85172f0
Update remix template for remix v2 + vite (WIP)
acusti Jul 17, 2024
b13ba42
Make generateTypesFromSqlite take D1Database db
acusti Jul 17, 2024
f832a5b
Fix types via generics + conditional in Button.tsx
acusti Jul 17, 2024
a235049
Handle rename LoaderArgs → LoaderFunctionArgs
acusti Jul 17, 2024
c6b1217
Handle rename ActionArgs → ActionFunctionArgs
acusti Jul 22, 2024
e5b6f65
Make meta functions remix v2 compatible
acusti Jul 17, 2024
9bc6422
Remove deprecated (now default) wrangler CLI flags
acusti Jul 17, 2024
34c6c43
:memo: Update docs site README env var info
acusti Jul 17, 2024
5394636
Regenerate docs site worker types with .dev.vars
acusti Jul 17, 2024
6defafb
Fix types in docs site’s docs.server.ts
acusti Jul 19, 2024
c058dc2
Update docs site’s env var names in .env.example
acusti Jul 19, 2024
7ddc464
Adapt docs site’s loaders to new ctx shape
acusti Jul 19, 2024
a209b26
Remove redundant wrangler dev script arg
acusti Jul 19, 2024
0f9bcab
Restore TS cloudflare worker’s entry file + name
acusti Jul 19, 2024
586f8a8
Remove defunct cloudflare Env type declarations
acusti Jul 19, 2024
4e4fbdb
Restore focus-visible polyfill
acusti Jul 19, 2024
4f9da67
:memo: Fix a typo in superflare/cli/new.ts
acusti Jul 19, 2024
05cf820
Import + use types from @cloudflare/workers-types
acusti Jul 19, 2024
6fbd8bd
Adapt superflare’s loadContext to getPlatformProxy
acusti Jul 20, 2024
ffc5677
Add auth + session to AppLoadContext type
acusti Jul 22, 2024
18738b2
Restore superflare handlers in remix template
acusti Jul 20, 2024
029dd81
:memo: Update docs based on latest APIs
acusti Jul 20, 2024
c12ceaa
Fix package.json types location for TS v.4.7+
acusti Jul 22, 2024
56f6eda
Add typecheck run script to packages/*
acusti Jul 22, 2024
d0c7ea1
Add missing @cloudflare/workers-types devDep
acusti Jul 22, 2024
983ce3e
:arrow_up: Upgrade @cloudflare/workers-types
acusti Jul 22, 2024
5c9e50d
Restore ambient workers types + original filenames
acusti Jul 22, 2024
ada2441
Disambiguate workers Request type (from global)
acusti Jul 22, 2024
3e3564e
Fix superflare build by making redis pkgs external
acusti Jul 22, 2024
1e3dada
:arrow_up: Upgrade latest eslint-plugin-turbo
acusti Jul 22, 2024
0ca86a2
Use createTestDatabase in /d1-types.test.ts
acusti Jul 23, 2024
160950b
Specify latest version for @miniflare/* deps
acusti Jul 23, 2024
0de2d93
Migrate from local /d1js → @miniflare/d1
acusti Jul 23, 2024
b6139c1
Add .dev.vars to .gitignore
acusti Jul 23, 2024
41ce1e7
Remove global process type from examples/remix-cms
acusti Jul 23, 2024
9b1d7d3
Use createD1Database util in migrateHandler
acusti Jul 23, 2024
0c66959
Use .dev.vars to define APP_KEY + regen types
acusti Jul 23, 2024
048a2b2
Simplify secure protocol check for session cookie
acusti Jul 24, 2024
03e4cb1
Fix reference to remix build in remix-cms worker
acusti Jul 24, 2024
f002442
Replace non-existent Auth import → SuperflareAuth
acusti Jul 24, 2024
00917fb
:arrow_up: Upgrade to latest vite (v5.3.4)
acusti Jul 24, 2024
61df979
:arrow_up: Upgrade latest docs site UI libs
acusti Jul 24, 2024
755dca4
Add ssr.noExternal to fix docs site’s build issues
acusti Jul 24, 2024
b800de0
Restore remix-cms DO Channel export to main
acusti Jul 24, 2024
1146c09
:shower: Cleanup unneeded TS config values
acusti Jul 24, 2024
c08b78e
Restore queue + scheduled to remix-cms/worker.ts
acusti Jul 24, 2024
ff17a9e
Fix naming of docs site’s root route’s index route
acusti Jul 24, 2024
7073a76
Filter out "_cf_KV" table when handling D1 models
acusti Jul 24, 2024
2fcd89a
:shower: Remove need for intermediate foo var
acusti Jul 24, 2024
e723ad6
Crane + file cabinet emojis need an extra space
acusti Jul 24, 2024
33fe1fe
Replace better-sqlite3 → @miniflare/d1 in tests
acusti Jul 25, 2024
c6652c7
:shower: Remove direct deps on better-sqlite3
acusti Jul 25, 2024
9889492
:shower: Remove unused generate migration option
acusti Jul 25, 2024
fe766b9
Add getD1Database(dbName) using getPlatformProxy
acusti Jul 25, 2024
22f47d4
Refactor getD1Database from wrangler → miniflare@3
acusti Jul 25, 2024
6beeeb5
Refactor d1 commands from dbPath → dbName
acusti Jul 25, 2024
fd0dbc6
Explicitly exit CLI migrate command
acusti Jul 25, 2024
6f4d861
Update workers compatibility_date to latest
acusti Jul 26, 2024
b044a0e
Remove defunct <LiveReload> component
acusti Jul 26, 2024
23100a8
Remove inapplicable dev:superflare command
acusti Jul 26, 2024
ddf3cd9
Use vite’s built-in CSS handling in docs site
acusti Jul 26, 2024
fbe589c
Use CJS-compatible pluralize import
acusti Jul 26, 2024
f7359b2
Use remix vite:dev for superflare dev command
acusti Jul 26, 2024
dd270fe
Use superflare dev command for dev run script
acusti Jul 26, 2024
0ffe24a
:arrow_up: Upgrade to latest @clack/prompts
acusti Jul 27, 2024
ade2cf4
Remove redundant ellipsis from spinner text
acusti Jul 27, 2024
a35e538
Shorten spinner text to avoid text wrap bug
acusti Jul 27, 2024
f680ba4
Remove defunct --legacy-peer-deps
acusti Jul 27, 2024
bdc3b4c
Tighten up headers whitespace for readability
acusti Jul 27, 2024
b5c94d9
Add snapshot publishing
jplhomer Jul 27, 2024
4f96a9b
No compacting
jplhomer Jul 27, 2024
32986c1
Merge branch 'main' into wrangler3
jplhomer Jul 27, 2024
b5d5d06
Allow `--repo` to be passed to `superflare new`
jplhomer Jul 27, 2024
66bc307
feat: add support for account selection during `superflare new`
jplhomer Jul 29, 2024
fb38d74
Add getLoadContext to @superflare/remix
acusti Aug 6, 2024
b9ecf0d
Add superflareDevProxyVitePlugin for convenience
acusti Aug 6, 2024
edb0467
Cast-to-any as type incompatibility workaround
acusti Aug 6, 2024
031ab99
Use superflareDevProxyVitePlugin in vite.config
acusti Aug 6, 2024
339d246
Remove duplicate local load-context.ts
acusti Aug 6, 2024
88f44da
:shower: Remove unused variable
acusti Aug 6, 2024
40f027c
Add experimentalJsonConfig for wrangler.json
acusti Aug 7, 2024
feae062
Use getLoadContext to instantiate config singleton
acusti Aug 7, 2024
62173ee
Use relative import to work pre-tsconfig
acusti Aug 7, 2024
9de0a9e
Resolve type error by updating config type
acusti Aug 7, 2024
08faf1c
Update types to resolve no implicit any errors
acusti Aug 7, 2024
f5874c0
Add script_name for Channel DO binding
acusti Aug 7, 2024
21dbb19
Clarify comments + use implicit return
acusti Aug 10, 2024
260b23f
Differentiate index.types.ts type exports
acusti Aug 10, 2024
eb6af05
Replace type DefineConfigResult → DefineConfigReturn
acusti Aug 10, 2024
f4d25c7
Fix superflare-remix vite plugin + getLoadContext
acusti Aug 10, 2024
8f10d88
Update vite.configs to not pass superflare.config
acusti Aug 10, 2024
2718c38
Restore ~/ import in superflare.config.ts
acusti Aug 10, 2024
821f402
Use entry.(client|server).tsx from remix example
acusti Aug 12, 2024
a766a7e
:package: Update postcss + autoprefixer deps
acusti Aug 12, 2024
fb31936
Fix tailwind styles in examples/remix-cms
acusti Aug 12, 2024
cf584b6
Fix input width on mobile + add a max width
acusti Aug 12, 2024
864ecfc
Add props.autoComplete to inputs + typeof action
acusti Aug 13, 2024
12c654a
Fix getSessionCookie, consistent superflare import
acusti Aug 13, 2024
b6e556d
Move config init to superflareDevProxyVitePlugin
acusti Aug 13, 2024
f1b8c17
Ensure type-only superflare import + remove unused
acusti Aug 13, 2024
bbd093f
Add commitSession logic to entry.server.tsx
acusti Aug 13, 2024
b2f83ae
Use wrangler’s getPlatformProxy in getD1Database
acusti Aug 14, 2024
c9f5157
Refactor @superflare/remix types to take Env
acusti Aug 14, 2024
43d9e99
Remove defunct "superflare" import
acusti Aug 14, 2024
4574c3c
Fix import TextareaMarkdown for vite
acusti Aug 14, 2024
224fb0e
Fix types for routes/auth/hooks.ts’ useAdmin
acusti Aug 14, 2024
9373f60
Upgrade isbot + eslint-(config|plugin)-turbo
acusti Aug 15, 2024
86be592
:shower: Remove defunct concurrently deps
acusti Aug 15, 2024
55aa977
:package: Upgrade to latest concurrently
acusti Aug 15, 2024
1ac6ade
Use experimental json config for wrangler deploy
acusti Aug 15, 2024
573179a
:shower: Cleanup unused dependencies
acusti Aug 15, 2024
fa224be
Export getLoadContext from @superflare/remix
acusti Aug 15, 2024
6f504e9
Move superflareDevProxyVitePlugin → remix-dev pkg
acusti Aug 15, 2024
5e8b590
Use @superflare/remix-dev in remix-cms + template
acusti Aug 15, 2024
602249d
Update superflare dev to also run wrangler dev
acusti Aug 15, 2024
f944a60
Run build serially (superflare/remix depends on superflare)
acusti Aug 15, 2024
2e7b3b6
Remove unused dependency from apps/site/
acusti Aug 15, 2024
82ccdde
Fix tsconfig’s cloudflare.env.d.ts include path
acusti Aug 21, 2024
0149e1f
Move vite dev plugin to @superflare/remix/dev
acusti Aug 21, 2024
10619af
Use @superflare/remix/dev in examples
acusti Aug 21, 2024
1d12080
Use installed wrangler version (not latest) in CLI
acusti Aug 22, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
- name: Build
run: pnpm build

- run: pnpx pkg-pr-new publish --compact './packages/superflare' './packages/superflare-remix'
- run: pnpx pkg-pr-new publish './packages/superflare' './packages/superflare-remix'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ yarn-error.log*
.env.development.local
.env.test.local
.env.production.local
.dev.vars

# turbo
.turbo
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13.0
20
6 changes: 3 additions & 3 deletions apps/site/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NEXT_PUBLIC_DOCSEARCH_APP_ID=RETR9S9VHS
NEXT_PUBLIC_DOCSEARCH_API_KEY=326c1723a310dfe29004b47608709907
NEXT_PUBLIC_DOCSEARCH_INDEX_NAME=tailwindui-protocol
DOCSEARCH_APP_ID=RETR9S9VHS
DOCSEARCH_API_KEY=326c1723a310dfe29004b47608709907
DOCSEARCH_INDEX_NAME=tailwindui-protocol
8 changes: 4 additions & 4 deletions apps/site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To get started with this template, first install the npm dependencies:

```bash
npm install
cp .env.example .env.local
cp .env.example .dev.vars
```

Next, run the development server:
Expand All @@ -28,9 +28,9 @@ You can start editing this template by modifying the files in the `/src` folder.
By default this template uses [Algolia DocSearch](https://docsearch.algolia.com) for the global search. DocSearch is free for open-source projects, and you can sign up for an account on their website. Once your DocSearch account is ready, update the following [environment variables](https://nextjs.org/docs/basic-features/environment-variables) in your project with the values provided by Algolia:

```
NEXT_PUBLIC_DOCSEARCH_APP_ID=
NEXT_PUBLIC_DOCSEARCH_API_KEY=
NEXT_PUBLIC_DOCSEARCH_INDEX_NAME=
DOCSEARCH_APP_ID=
DOCSEARCH_API_KEY=
DOCSEARCH_INDEX_NAME=
```

## License
Expand Down
18 changes: 12 additions & 6 deletions apps/site/app/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@ const styles = {
"rounded-full bg-slate-800 py-2 px-4 text-sm font-medium text-white hover:bg-slate-700 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white/50 active:text-slate-400",
};

export function Button({
export function Button<Href extends string>({
variant = "primary",
className,
href,
...props
}: {
}: Omit<
React.ComponentProps<Href extends string ? typeof Link : "button">,
"to"
> & {
variant?: keyof typeof styles;
className?: string;
href?: string;
} & React.ComponentProps<"button" | typeof Link>) {
href?: Href;
}) {
className = clsx(styles[variant], className);

return href ? (
<Link to={href} className={className} {...props} />
<Link {...props} to={href} className={className} />
) : (
<button className={className} {...props} />
<button
{...(props as React.ComponentProps<"button">)}
className={className}
/>
);
}
9 changes: 2 additions & 7 deletions apps/site/app/components/Fence.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from "react";
import Highlight, { defaultProps, type Language } from "prism-react-renderer";
import { Highlight, type Language } from "prism-react-renderer";

export function Fence({
children,
Expand All @@ -9,12 +9,7 @@ export function Fence({
language: Language;
}) {
return (
<Highlight
{...defaultProps}
code={children.trimEnd()}
language={language}
theme={undefined}
>
<Highlight code={children.trimEnd()} language={language} theme={undefined}>
{({ className, style, tokens, getTokenProps }) => (
<pre className={className} style={style}>
<code>
Expand Down
3 changes: 1 addition & 2 deletions apps/site/app/components/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Fragment, useState } from "react";
import clsx from "clsx";
import Highlight, { defaultProps } from "prism-react-renderer";
import { Highlight } from "prism-react-renderer";

import { Button } from "~/components/Button";
import { HeroBackground } from "~/components/HeroBackground";
Expand Down Expand Up @@ -153,7 +153,6 @@ export function Hero() {
))}
</div>
<Highlight
{...defaultProps}
code={activeTab.code}
language={codeLanguage}
theme={undefined}
Expand Down
2 changes: 1 addition & 1 deletion apps/site/app/components/QuickLinks.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Link } from "@remix-run/react";

import { Icon } from "~/components/Icon";
import { Icon } from "./Icon";

export function QuickLinks({ children }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/site/app/components/icons/InstallationIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DarkMode, Gradient, LightMode } from "~/components/Icon";
import { DarkMode, Gradient, LightMode } from "../Icon";

export function InstallationIcon({ id, color }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/site/app/components/icons/LightbulbIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DarkMode, Gradient, LightMode } from "~/components/Icon";
import { DarkMode, Gradient, LightMode } from "../Icon";

export function LightbulbIcon({ id, color }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/site/app/components/icons/PluginsIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DarkMode, Gradient, LightMode } from "~/components/Icon";
import { DarkMode, Gradient, LightMode } from "../Icon";

export function PluginsIcon({ id, color }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/site/app/components/icons/PresetsIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DarkMode, Gradient, LightMode } from "~/components/Icon";
import { DarkMode, Gradient, LightMode } from "../Icon";

export function PresetsIcon({ id, color }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/site/app/components/icons/ThemingIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DarkMode, Gradient, LightMode } from "~/components/Icon";
import { DarkMode, Gradient, LightMode } from "../Icon";

export function ThemingIcon({ id, color }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/site/app/components/icons/WarningIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DarkMode, Gradient, LightMode } from "~/components/Icon";
import { DarkMode, Gradient, LightMode } from "../Icon";

export function WarningIcon({ id, color }) {
return (
Expand Down
48 changes: 29 additions & 19 deletions apps/site/app/docs.server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { RenderableTreeNode } from "@markdoc/markdoc";
import type { RenderableTreeNode, Schema, Tag } from "@markdoc/markdoc";
import Markdoc, { nodes as defaultNodes } from "@markdoc/markdoc";
import { slugifyWithCounter } from "@sindresorhus/slugify";
import { TableOfContents } from "./components/Layout";
import yaml from "js-yaml";
import Markdoc, { nodes as defaultNodes } from "@markdoc/markdoc";
import { type TableOfContents } from "./components/Layout";

const DOCS_PORT = 3123;

Expand Down Expand Up @@ -79,7 +79,7 @@ export type Manifest = ManifestEntry[];
export async function getManifest(
gitHubToken: string,
useGitHub: boolean
): Promise<Manifest> {
): Promise<Manifest | null> {
const manifest = useGitHub
? await getDocsForPathFromGitHub("manifest.json", gitHubToken)
: await getDocsForPathFromLocal("manifest.json");
Expand All @@ -88,14 +88,17 @@ export async function getManifest(
return JSON.parse(manifest);
}

function getNodeText(node: RenderableTreeNode) {
function getNodeText(renderableNode: RenderableTreeNode) {
if (typeof renderableNode === "string") return renderableNode;
if (!renderableNode || typeof renderableNode !== "object") return "";
Copy link
Author

@acusti acusti Jul 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jplhomer heads up that this line is a change in behavior. in the previous version of this function, if typeof node === "string", the function returned an empty string, which i thought might be a bug, but if it is in fact desired, i will just lump this check in with the conditions in the next if statement (on line 93) so that it also returns an empty string.

let text = "";
if (typeof node === "string" || !node) return text;
let node = renderableNode as Tag;
for (let child of node.children ?? []) {
if (typeof child === "string") {
text += child;
} else {
text += getNodeText(child);
}
text += getNodeText(child);
}
return text;
}
Expand All @@ -104,27 +107,31 @@ export function collectHeadings(
nodes: RenderableTreeNode[],
slugify = slugifyWithCounter()
): TableOfContents {
let sections = [];
let sections: TableOfContents = [];

for (let renderableNode of nodes) {
if (!renderableNode || typeof renderableNode !== "object") {
continue;
}

let node = renderableNode as Tag;

for (let node of nodes) {
if (!node || typeof node !== "object") continue;
if (node.name === "h2" || node.name === "h3") {
let title = getNodeText(node);
if (title) {
let id = slugify(title);
node.attributes.id = id;
let attributes = { children: [], ...node.attributes, id, title };
if (node.name === "h3") {
if (!sections[sections.length - 1]) {
let previousSection = sections[sections.length - 1];
if (!previousSection) {
throw new Error(
"Cannot add `h3` to table of contents without a preceding `h2`"
);
}
sections[sections.length - 1].children.push({
...node.attributes,
title,
});
(previousSection.children as TableOfContents).push(attributes);
} else {
sections.push({ ...node.attributes, title, children: [] });
attributes.children = [];
sections.push(attributes);
}
}
}
Expand All @@ -136,10 +143,11 @@ export function collectHeadings(
}

export interface Frontmatter {
description?: string;
title: string;
}

const tags = {
const tags: Record<string, Schema> = {
callout: {
attributes: {
title: { type: String },
Expand Down Expand Up @@ -205,7 +213,9 @@ export function parseMarkdoc(markdown: string) {

let tableOfContents =
content && typeof content !== "string"
? collectHeadings(Array.isArray(content) ? content : content.children)
? collectHeadings(
Array.isArray(content) ? content : (content as Tag).children
)
: [];

return { content, frontmatter, tableOfContents, title, description };
Expand Down
48 changes: 24 additions & 24 deletions apps/site/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,39 @@ import {
json,
type LinksFunction,
type MetaFunction,
type LoaderArgs,
type LoaderFunctionArgs,
} from "@remix-run/cloudflare";
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
useLoaderData,
} from "@remix-run/react";
import styles from "./styles/tailwind.css";
import "focus-visible";
import "./styles/tailwind.css";

export const meta: MetaFunction = () => ({
charset: "utf-8",
title: "Superflare",
"twitter:title": "Superflare",
viewport: "width=device-width,initial-scale=1",
description:
"Superflare is a full-stack toolkit for building applications on Cloudflare Workers.",
"twitter:description":
"Superflare is a full-stack toolkit for building applications on Cloudflare Workers.",
"twitter:card": "summary_large_image",
"twitter:creator": "@jplhomer",
"og:type": "website",
"og:image": "https://superflare.dev/superflare-og.jpg",
"twitter:image": "https://superflare.dev/superflare-og.jpg",
});
export const meta: MetaFunction = () => [
{ charset: "utf-8" },
{ title: "Superflare", "twitter:title": "Superflare" },
{ viewport: "width=device-width,initial-scale=1" },
{
description:
"Superflare is a full-stack toolkit for building applications on Cloudflare Workers.",
},
{
"twitter:description":
"Superflare is a full-stack toolkit for building applications on Cloudflare Workers.",
},
{ "twitter:card": "summary_large_image" },
{ "twitter:creator": "@jplhomer" },
{ "og:type": "website" },
{ "og:image": "https://superflare.dev/superflare-og.jpg" },
{ "twitter:image": "https://superflare.dev/superflare-og.jpg" },
];

export const links: LinksFunction = () => [
{ rel: "stylesheet", href: styles },
{
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=Kanit:wght@400&display=swap",
Expand All @@ -44,12 +45,12 @@ export const links: LinksFunction = () => [
},
];

export async function loader({ context: { env } }: LoaderArgs) {
export async function loader({ context: { cloudflare } }: LoaderFunctionArgs) {
return json({
ENV: {
DOCSEARCH_APP_ID: env.DOCSEARCH_APP_ID,
DOCSEARCH_API_KEY: env.DOCSEARCH_API_KEY,
DOCSEARCH_INDEX_NAME: env.DOCSEARCH_INDEX_NAME,
DOCSEARCH_APP_ID: cloudflare.env.DOCSEARCH_APP_ID,
DOCSEARCH_API_KEY: cloudflare.env.DOCSEARCH_API_KEY,
DOCSEARCH_INDEX_NAME: cloudflare.env.DOCSEARCH_INDEX_NAME,
},
});
}
Expand Down Expand Up @@ -110,7 +111,6 @@ export default function App() {
/>
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
23 changes: 15 additions & 8 deletions apps/site/app/routes/$.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { MetaFunction } from "@remix-run/react/dist/routeModules";

export { default, loader } from "./index";

export const meta: MetaFunction = ({ data }) => ({
title: data?.title ? `${data.title} - Superflare` : "Superflare",
"twitter:title": data?.title ? `${data.title} - Superflare` : "Superflare",
description: data?.description,
"twitter:description": data?.description,
});
import { loader as indexLoader } from "./_index";

export { default } from "./_index";

export const loader = indexLoader;

export const meta: MetaFunction<typeof loader> = ({ data }) => [
{
title: data?.title ? `${data.title} - Superflare` : "Superflare",
},
{
"twitter:title": data?.title ? `${data.title} - Superflare` : "Superflare",
},
{ description: data?.description, "twitter:description": data?.description },
];
Loading
Loading