From 1b2ee7f39aea6975b526bea57a737c57160e2f8e Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Fri, 15 Nov 2024 11:46:09 -0800 Subject: [PATCH] Adapt Superflare to work with Wrangler 3 and Remix v2 (vite compiler) (#66) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :arrow_up: Upgrade pnpm/wrangler/better-sqlite3 plus remove the @remix-run/dev patch * Remove defunct NO_D1_WARNING env var * :arrow_up: Upgrade to latest remix v2.x * :arrow_up: Upgrade to latest typescript (v5.x) * Remove defunct custom pnpm resolutions * Update remix vite cloudflare-workers dependencies • reference: https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers • also, update @superflare/remix peerDependencies • remove unused @remix-run/serve dependency • move @remix-run/server-runtime from devDependencies → dependencies • upgrade to latest @cloudflare/workers-types + make it consistent across workspaces * Upgrade to latest tailwind + markdoc * Update docs site to work w/ remix v2 + vite (WIP) * Update remix-cms example for remix v2 + vite (WIP) * Update remix template for remix v2 + vite (WIP) * Make generateTypesFromSqlite take D1Database db …and refactor it to be an async function, plus add a D1DatabaseAdaptor for exposing a compatible API for a SqlliteDB instance * Fix types via generics + conditional in Button.tsx * Handle rename LoaderArgs → LoaderFunctionArgs * Handle rename ActionArgs → ActionFunctionArgs * Make meta functions remix v2 compatible …plus take advantage of MetaFunction type’s generics * Remove deprecated (now default) wrangler CLI flags * :memo: Update docs site README env var info * Regenerate docs site worker types with .dev.vars * Fix types in docs site’s docs.server.ts * Update docs site’s env var names in .env.example * Adapt docs site’s loaders to new ctx shape * Remove redundant wrangler dev script arg From the wrangler docs: “Only required if your wrangler.toml does not include a main key” Source: https://developers.cloudflare.com/workers/wrangler/commands/#dev * Restore TS cloudflare worker’s entry file + name reproduces the changes suggested in https://github.com/remix-run/remix/pull/9774 * Remove defunct cloudflare Env type declarations • the Env type is now generated by the wrangler types command and written to worker-configuration.d.ts • note however that it doesn’t include CF_PAGES or APP_KEY, which are both used in examples/remix-cms/functions/[[remix]].ts * Restore focus-visible polyfill * :memo: Fix a typo in superflare/cli/new.ts * Import + use types from @cloudflare/workers-types * Adapt superflare’s loadContext to getPlatformProxy * Add auth + session to AppLoadContext type * Restore superflare handlers in remix template * :memo: Update docs based on latest APIs * Fix package.json types location for TS v.4.7+ * Add typecheck run script to packages/* * Add missing @cloudflare/workers-types devDep * :arrow_up: Upgrade @cloudflare/workers-types * Restore ambient workers types + original filenames • no need to rename cloudlfare.env.d.ts → env.d.ts • i kept the new env.d.ts name for the remix template in order to match the setup of the “official” cloudflare workers remix template (reference: https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers) * Disambiguate workers Request type (from global) * Fix superflare build by making redis pkgs external * :arrow_up: Upgrade latest eslint-plugin-turbo * Use createTestDatabase in /d1-types.test.ts this means that superflare/cli/d1-database.ts’ createSQLiteDB util is no longer used anywhere * Specify latest version for @miniflare/* deps * Migrate from local /d1js → @miniflare/d1 * Add .dev.vars to .gitignore * Remove global process type from examples/remix-cms * Use createD1Database util in migrateHandler * Use .dev.vars to define APP_KEY + regen types * Simplify secure protocol check for session cookie * Fix reference to remix build in remix-cms worker * Replace non-existent Auth import → SuperflareAuth * :arrow_up: Upgrade to latest vite (v5.3.4) * :arrow_up: Upgrade latest docs site UI libs the prism-react-renderer upgrade includes some breaking changes, so Fence.tsx and Hero.tsx have been updated to work with those changes as well * Add ssr.noExternal to fix docs site’s build issues based on https://github.com/algolia/docsearch/issues/2259 * Restore remix-cms DO Channel export to main * :shower: Cleanup unneeded TS config values * Restore queue + scheduled to remix-cms/worker.ts * Fix naming of docs site’s root route’s index route https://remix.run/docs/en/main/file-conventions/routes#basic-routes * Filter out "_cf_KV" table when handling D1 models * :shower: Remove need for intermediate foo var * Crane + file cabinet emojis need an extra space 🤷 * Replace better-sqlite3 → @miniflare/d1 in tests this means no more direct dependency on better-sqlite3 * :shower: Remove direct deps on better-sqlite3 * :shower: Remove unused generate migration option * Add getD1Database(dbName) using getPlatformProxy * Refactor getD1Database from wrangler → miniflare@3 • the CLI migrate command doesn’t work if miniflare is imported statically • adding it as a dependency ensures we get the correct types for miniflare v3.x (otherwise we get miniflare v2.x types) • the previous version (using wrangler’s getPlatformProxy) was resulting in the following error: service core:user:__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER: Worker "core:user:__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER"'s binding "Channel" refers to a service "core:user:worker", but no such service is defined. * Refactor d1 commands from dbPath → dbName • also refactor from using createD1Database → getD1Database • refactor migrate --fresh option from using fs.rm() to delete the existing database file to dropping all user-facing tables tables from the existing database * Explicitly exit CLI migrate command * Update workers compatibility_date to latest https://developers.cloudflare.com/workers/configuration/compatibility-dates/#properly-extract-blob-mime-type-from-content-type-headers * Remove defunct component reference: https://remix.run/docs/en/main/guides/vite#hmr--hdr * Remove inapplicable dev:superflare command * Use vite’s built-in CSS handling in docs site * Use CJS-compatible pluralize import * Use remix vite:dev for superflare dev command preserved the “Using (D1|R2) bindings: …” console logging and updated it to always print (not just in pages mode), because the remix vite:dev command doesn’t provide any of that info to the user * Use superflare dev command for dev run script * :arrow_up: Upgrade to latest @clack/prompts * Remove redundant ellipsis from spinner text the spinner already animates a repeating ellipsis onto the end of the text as it spins, so having the text end with “...” is redundant * Shorten spinner text to avoid text wrap bug the bug: https://github.com/bombshell-dev/clack/issues/132 * Remove defunct --legacy-peer-deps all of the remix cloudflare packages have been upgraded to @cloudlfare/workers-types v4 (e.g. https://github.com/remix-run/remix/blob/main/packages/remix-cloudflare/package.json) * Tighten up headers whitespace for readability * Add snapshot publishing * No compacting * Allow `--repo` to be passed to `superflare new` * feat: add support for account selection during `superflare new` * Add getLoadContext to @superflare/remix * Add superflareDevProxyVitePlugin for convenience * Cast-to-any as type incompatibility workaround * Use superflareDevProxyVitePlugin in vite.config * Remove duplicate local load-context.ts already supplied by @superflare/remix * :shower: Remove unused variable * Add experimentalJsonConfig for wrangler.json enables wrangler to pick up the bindings and provide them from getPlatformProxy * Use getLoadContext to instantiate config singleton getLoadContext is the common function invoked when handling requests across all environments (dev with vite and prod with workers) * Use relative import to work pre-tsconfig the superflare.config.ts is imported into the vite.config.ts, so the imports have to be resolved before the vite-tsconfig-paths plugin has been enabled, so `~/…` imports don’t work * Resolve type error by updating config type * Update types to resolve no implicit any errors • HasMany’s save argument looks like Model[] | Model to me • HasMany’s create argument is any, so i made that explicit in the map() * Add script_name for Channel DO binding wrangler’s getPlatformProxy requires the script_name in order to be able to proxy any Durable Object bindings: https://developers.cloudflare.com/workers/wrangler/api/#supported-bindings * Clarify comments + use implicit return * Differentiate index.types.ts type exports * Replace type DefineConfigResult → DefineConfigReturn allows us to only import the DefineConfigReturn type instead of importing the actual defineConfig function and using ReturnType> * Fix superflare-remix vite plugin + getLoadContext • calling getLoadContext from a vite plugin means that it doesn’t execute in the same context as the actual application, so it gets its own Config class singleton • update getLoadContext to take SuperflareAuth and SuperflareSession, then use viteDevServer.ssrLoadModule from the vite plugin to load both classes and provide them to getLoadContext • use viteDevServer.ssrLoadModule from the vite plugin to load superflare.config.ts and provide it to getLoadContext * Update vite.configs to not pass superflare.config * Restore ~/ import in superflare.config.ts the fixed implementation for initializing the config in getLoadContext means that the config file is now imported by vite and so the import alias now works * Use entry.(client|server).tsx from remix example sources: https://github.com/remix-run/remix/blob/main/templates/cloudflare-workers/app/entry.client.tsx https://github.com/remix-run/remix/blob/main/templates/cloudflare-workers/app/entry.server.tsx * :package: Update postcss + autoprefixer deps * Fix tailwind styles in examples/remix-cms * Fix input width on mobile + add a max width • they were defaulting to .col-span-1 below 640px • now they span across the full row at all breakpoints but with a 24rem (384px) max-width * Add props.autoComplete to inputs + typeof action * Fix getSessionCookie, consistent superflare import adds getSessionCookie to AppLoadContext and provides it from load-context.ts * Move config init to superflareDevProxyVitePlugin also, bring over code to ensure session has a sessionId from superflare#handleFetch * Ensure type-only superflare import + remove unused * Add commitSession logic to entry.server.tsx * Use wrangler’s getPlatformProxy in getD1Database • reverts the changes implemented in 22f47d4 • the reason getPlatformProxy didn’t work when implemented in fe766b9 is that getPlatformProxy cannot handle Durable Objects if a script_name isn’t provided for the bindings (which was resolved in f5874c0) * Refactor @superflare/remix types to take Env • move @remix-run/cloudflare AppLoadContext definition to index.ts • use AppLoadContext where necessary • use WorkersRequest for accuracy + global Request for @remix-run/cloudflare’s createRequestHandler return value compatibility • restore local ./load-context.ts to expand @remix-run/cloudflare’s AppLoadContext type to include a cloudflare property based on Env interface from ./worker-configuration.d.ts * Remove defunct "superflare" import * Fix import TextareaMarkdown for vite related: https://github.com/vitejs/vite/issues/2139#issuecomment-802981228 * Fix types for routes/auth/hooks.ts’ useAdmin * Upgrade isbot + eslint-(config|plugin)-turbo * :shower: Remove defunct concurrently deps * :package: Upgrade to latest concurrently * Use experimental json config for wrangler deploy * :shower: Cleanup unused dependencies * Export getLoadContext from @superflare/remix * Move superflareDevProxyVitePlugin → remix-dev pkg added new @superflare/remix-dev package to host the superflareDevProxyVitePlugin in such a way that it can be independently imported into users’ vite.config.ts file without then getting included in the built cloudflare workers bundle * Use @superflare/remix-dev in remix-cms + template the template dependency string will have to be changed from "workspace:*" → "*" once the new package has been published * Update superflare dev to also run wrangler dev fixes durable objects in dev: https://developers.cloudflare.com/workers/wrangler/api/#supported-bindings * Run build serially (superflare/remix depends on superflare) * Remove unused dependency from apps/site/ * Fix tsconfig’s cloudflare.env.d.ts include path * Move vite dev plugin to @superflare/remix/dev previously available as @superflare/remix-dev, but this is simpler * Use @superflare/remix/dev in examples * Use installed wrangler version (not latest) in CLI * Use static assets for workers feature * Remove defunct DBConfig type * Fix d1_databases wrangler config field name * Add script_name for Channel DO binding in CLI same fix as f5874c0e7b5873185a2e1f2d03cb59c4bcb573e7 but applied to the superflare CLI new command wrangler’s getPlatformProxy requires the script_name in order to be able to proxy any Durable Object bindings: https://developers.cloudflare.com/workers/wrangler/api/#supported-bindings * Adopt default remix v2 flat routing convention https://remix.run/docs/en/main/file-conventions/routes * Add generic types to template useActionData * Drop migrations table for migrate --fresh option * Don’t return handleQueue Promise.all • the return value will be an array of undefined values of the same length as batch.messages, which doesn’t seem useful * returning that array leads to a type error in the main worker file due to incompatibility with the return value of the ExportedHandlerQueueHandler type * Fix request object type in handleFetch * Fix type of scheduled event argument reference: https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/templates/new-worker-scheduled.ts#L26 * DO script_name is worker app name (not file name) follow-up to ebdbc9914c949c5e6b83db34a13ad191fefd6488 * Fix script_name for DO binding in remix-cms example • follow-up to f5874c0e7b5873185a2e1f2d03cb59c4bcb573e7 • turns out the script_name should be the worker’s app name (not its file name) * Separate @superflare/remix/dev completely from @superflare/remix removing the ;./index' import from superflare-remix/dev.ts makes it so that there is no possible issue with using static `import {…} from 'superflare'` in superflare-remix/index.ts, because that file won’t be executed outside of the vite bundle/execution context * Specify a wrangler version that supports static assets * Fix superflare dev command + suppress wrangler dev io * Add @remix-run/server-runtime, use latest pnpm * Specify minimum remix version for devProxyVite plugin v2.12.1 includes https://github.com/remix-run/remix/pull/9976, which changed the API contract of the fromNodeRequest util that we will depend on in superflareDevProxyVitePlugin * Fix committing session changes on response in dev using entry.server.tsx meant that sessions weren’t committed for redirects, e.g. the default logout route action, which calls ``` auth.logout(); return redirect("/"); ``` this commit takes over the middleware portion of the cloudflareDevProxyVitePlugin logic and frames the request/response lifecycle with superflare.config initialization + getLoadContext before the request handler is invoked, and commit session cookie handling after * Ensure is first thing rendered fixes UTF 8 text encoding / rendering, at least when running the docs app locally * Include “.md” ext in default docs filepath * Upgrade to latest version of turbo (2.x) * :shower: Strip down entry.server.tsx files * Add lang to all code blocks for prism-react-renderer not having a language identifier results in: TypeError: Cannot read properties of undefined (reading 'toLowerCase') at Highlight (/Users/foo/superflare/node_modules/.pnpm/prism-react-renderer@2.3.1_react@18.2.0/node_modules/prism-react-renderer/src/components/highlight.ts:14:30) * Fix server-runtime imports (should be cloudflare) * Add better-sqlite3 devDependency in packages/superflare fixes tests locally on my machine * Make getPlatformProxy experimentalJsonConfig: true also, allow it to be overwritten in case someone wants to make superflare work with a wrangler.toml * Add proper migrations to Remix CMS --------- Co-authored-by: Josh Larson --- .github/workflows/publish-snapshot.yml | 2 +- .gitignore | 1 + .nvmrc | 2 +- apps/site/.env.example | 6 +- apps/site/README.md | 8 +- apps/site/app/components/Button.tsx | 18 +- apps/site/app/components/Fence.tsx | 9 +- apps/site/app/components/Hero.tsx | 3 +- apps/site/app/components/QuickLinks.jsx | 2 +- .../app/components/icons/InstallationIcon.jsx | 2 +- .../app/components/icons/LightbulbIcon.jsx | 2 +- .../site/app/components/icons/PluginsIcon.jsx | 2 +- .../site/app/components/icons/PresetsIcon.jsx | 2 +- .../site/app/components/icons/ThemingIcon.jsx | 2 +- .../site/app/components/icons/WarningIcon.jsx | 2 +- apps/site/app/docs.server.ts | 48 +- apps/site/app/root.tsx | 48 +- apps/site/app/routes/$.tsx | 23 +- .../site/app/routes/{index.tsx => _index.tsx} | 29 +- apps/site/cloudflare.env.d.ts | 25 - apps/site/load-context.ts | 14 + apps/site/package.json | 49 +- apps/site/postcss.config.js | 4 +- apps/site/remix.config.js | 10 - apps/site/remix.env.d.ts | 15 - apps/site/scripts/serve-local-docs.mjs | 2 +- ...{tailwind.config.js => tailwind.config.ts} | 13 +- apps/site/tsconfig.json | 11 +- apps/site/types/cloudflare.d.ts | 7 - apps/site/typography.js | 4 +- apps/site/vite.config.ts | 32 + apps/site/worker-configuration.d.ts | 8 + apps/site/worker.ts | 83 +- apps/site/wrangler.json | 10 +- examples/remix-cms/app/components/Form.tsx | 2 +- .../app/components/admin/MarkdownComposer.tsx | 7 +- examples/remix-cms/app/entry.client.tsx | 32 +- examples/remix-cms/app/entry.server.tsx | 12 +- examples/remix-cms/app/root.tsx | 19 +- examples/remix-cms/app/routes/admin.tsx | 6 +- .../routes/admin/articles.$slug.preview.tsx | 6 +- .../app/routes/admin/articles.$slug.tsx | 4 +- .../routes/admin/components/article-form.tsx | 4 +- .../remix-cms/app/routes/admin/profile.tsx | 4 +- .../remix-cms/app/routes/admin/upload.$.ts | 4 +- examples/remix-cms/app/routes/auth/hooks.ts | 6 +- examples/remix-cms/app/routes/auth/login.tsx | 29 +- examples/remix-cms/app/routes/auth/logout.ts | 4 +- .../remix-cms/app/routes/auth/register.tsx | 29 +- .../app/routes/channel.$channelName.ts | 4 +- examples/remix-cms/app/routes/storage.$.tsx | 4 +- examples/remix-cms/cloudflare.env.d.ts | 28 - .../db/migrations/0000_create_users.ts | 11 + .../db/migrations/0001_create_articles.ts | 13 + examples/remix-cms/functions/[[remix]].ts | 11 +- examples/remix-cms/load-context.ts | 7 + .../migrations/0000_create_users.sql | 10 + examples/remix-cms/migrations/0000_init.sql | 22 - .../migrations/0001_create_articles.sql | 12 + examples/remix-cms/package.json | 44 +- examples/remix-cms/postcss.config.js | 6 + examples/remix-cms/remix.config.js | 10 - examples/remix-cms/remix.env.d.ts | 9 - examples/remix-cms/superflare.config.ts | 1 + examples/remix-cms/tailwind.config.js | 8 - examples/remix-cms/tailwind.config.ts | 11 + examples/remix-cms/tsconfig.json | 11 +- examples/remix-cms/types/cloudflare.d.ts | 7 - examples/remix-cms/vite.config.ts | 40 + examples/remix-cms/worker-configuration.d.ts | 10 + examples/remix-cms/worker.ts | 66 +- examples/remix-cms/wrangler.json | 13 +- package.json | 14 +- packages/eslint-config-custom/package.json | 2 +- ...loudflare-env.d.ts => cloudflare.env.d.ts} | 0 packages/superflare-remix/dev.ts | 106 + packages/superflare-remix/index.ts | 83 +- packages/superflare-remix/load-context.ts | 62 + packages/superflare-remix/package.json | 28 +- packages/superflare-remix/tsconfig.json | 2 +- packages/superflare-remix/tsup.config.ts | 2 +- packages/superflare/cli.ts | 4 +- packages/superflare/cli/console.ts | 24 +- packages/superflare/cli/d1-database.ts | 24 +- packages/superflare/cli/d1-types.ts | 37 +- packages/superflare/cli/db/seed.ts | 25 +- packages/superflare/cli/dev.ts | 72 +- packages/superflare/cli/generate/migration.ts | 13 +- packages/superflare/cli/migrate.ts | 73 +- packages/superflare/cli/new.ts | 104 +- packages/superflare/cli/wrangler.ts | 94 +- ...loudflare-env.d.ts => cloudflare.env.d.ts} | 0 packages/superflare/d1js/api.ts | 210 - packages/superflare/d1js/d1js.ts | 283 - packages/superflare/d1js/index.ts | 2 - packages/superflare/d1js/splitter.ts | 173 - packages/superflare/docs/file-storage.md | 4 +- packages/superflare/docs/getting-started.md | 22 +- packages/superflare/docs/models.md | 12 +- .../docs/security/authentication.md | 4 +- packages/superflare/index.types.ts | 10 +- packages/superflare/package.json | 23 +- packages/superflare/src/config.ts | 7 +- packages/superflare/src/fetch.ts | 10 +- packages/superflare/src/queue.ts | 12 +- packages/superflare/src/relations/has-many.ts | 7 +- packages/superflare/src/scheduled.ts | 6 +- packages/superflare/src/string.ts | 4 +- packages/superflare/tests/d1-types.test.ts | 24 +- packages/superflare/tests/db.ts | 12 +- packages/superflare/tsconfig.json | 2 +- packages/superflare/tsup.config.ts | 1 + patches/@remix-run__dev@1.14.1.patch | 19 - pnpm-lock.yaml | 17059 ++++++++-------- templates/remix/app/entry.client.tsx | 32 +- templates/remix/app/entry.server.tsx | 17 +- templates/remix/app/root.tsx | 12 +- templates/remix/app/routes/__auth/logout.ts | 7 - .../{__auth/login.tsx => _auth.login.tsx} | 9 +- templates/remix/app/routes/_auth.logout.ts | 7 + .../register.tsx => _auth.register.tsx} | 9 +- .../app/routes/{index.tsx => _index.tsx} | 0 templates/remix/app/routes/dashboard.tsx | 4 +- templates/remix/cloudflare.env.d.ts | 28 - templates/remix/load-context.ts | 7 + templates/remix/package.json | 41 +- templates/remix/remix.config.js | 10 - templates/remix/remix.env.d.ts | 9 - templates/remix/tsconfig.json | 11 +- templates/remix/vite.config.ts | 29 + templates/remix/worker-configuration.d.ts | 5 + templates/remix/worker.ts | 66 +- templates/remix/wrangler.json | 10 +- turbo.json | 2 +- 134 files changed, 10191 insertions(+), 9823 deletions(-) rename apps/site/app/routes/{index.tsx => _index.tsx} (66%) delete mode 100644 apps/site/cloudflare.env.d.ts create mode 100644 apps/site/load-context.ts delete mode 100644 apps/site/remix.config.js delete mode 100644 apps/site/remix.env.d.ts rename apps/site/{tailwind.config.js => tailwind.config.ts} (78%) delete mode 100644 apps/site/types/cloudflare.d.ts create mode 100644 apps/site/vite.config.ts create mode 100644 apps/site/worker-configuration.d.ts delete mode 100644 examples/remix-cms/cloudflare.env.d.ts create mode 100644 examples/remix-cms/db/migrations/0000_create_users.ts create mode 100644 examples/remix-cms/db/migrations/0001_create_articles.ts create mode 100644 examples/remix-cms/load-context.ts create mode 100644 examples/remix-cms/migrations/0000_create_users.sql delete mode 100644 examples/remix-cms/migrations/0000_init.sql create mode 100644 examples/remix-cms/migrations/0001_create_articles.sql create mode 100644 examples/remix-cms/postcss.config.js delete mode 100644 examples/remix-cms/remix.config.js delete mode 100644 examples/remix-cms/remix.env.d.ts delete mode 100644 examples/remix-cms/tailwind.config.js create mode 100644 examples/remix-cms/tailwind.config.ts delete mode 100644 examples/remix-cms/types/cloudflare.d.ts create mode 100644 examples/remix-cms/vite.config.ts create mode 100644 examples/remix-cms/worker-configuration.d.ts rename packages/superflare-remix/{cloudflare-env.d.ts => cloudflare.env.d.ts} (100%) create mode 100644 packages/superflare-remix/dev.ts create mode 100644 packages/superflare-remix/load-context.ts rename packages/superflare/{cloudflare-env.d.ts => cloudflare.env.d.ts} (100%) delete mode 100644 packages/superflare/d1js/api.ts delete mode 100644 packages/superflare/d1js/d1js.ts delete mode 100644 packages/superflare/d1js/index.ts delete mode 100644 packages/superflare/d1js/splitter.ts delete mode 100644 patches/@remix-run__dev@1.14.1.patch delete mode 100644 templates/remix/app/routes/__auth/logout.ts rename templates/remix/app/routes/{__auth/login.tsx => _auth.login.tsx} (82%) create mode 100644 templates/remix/app/routes/_auth.logout.ts rename templates/remix/app/routes/{__auth/register.tsx => _auth.register.tsx} (84%) rename templates/remix/app/routes/{index.tsx => _index.tsx} (100%) delete mode 100644 templates/remix/cloudflare.env.d.ts create mode 100644 templates/remix/load-context.ts delete mode 100644 templates/remix/remix.config.js delete mode 100644 templates/remix/remix.env.d.ts create mode 100644 templates/remix/vite.config.ts create mode 100644 templates/remix/worker-configuration.d.ts diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index ce822ebd..2b9b15ea 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -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' \ No newline at end of file diff --git a/.gitignore b/.gitignore index 68758b89..85b4769d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ yarn-error.log* .env.development.local .env.test.local .env.production.local +.dev.vars # turbo .turbo diff --git a/.nvmrc b/.nvmrc index 58a4133d..209e3ef4 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.13.0 +20 diff --git a/apps/site/.env.example b/apps/site/.env.example index f88f5150..71272a7e 100644 --- a/apps/site/.env.example +++ b/apps/site/.env.example @@ -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 diff --git a/apps/site/README.md b/apps/site/README.md index 4aee42cd..98882a57 100644 --- a/apps/site/README.md +++ b/apps/site/README.md @@ -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: @@ -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 diff --git a/apps/site/app/components/Button.tsx b/apps/site/app/components/Button.tsx index ab4cf4de..cdca49ae 100644 --- a/apps/site/app/components/Button.tsx +++ b/apps/site/app/components/Button.tsx @@ -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({ variant = "primary", className, href, ...props -}: { +}: Omit< + React.ComponentProps, + "to" +> & { variant?: keyof typeof styles; className?: string; - href?: string; -} & React.ComponentProps<"button" | typeof Link>) { + href?: Href; +}) { className = clsx(styles[variant], className); return href ? ( - + ) : ( -