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

Commits on Jul 17, 2024

  1. ⬆️ Upgrade pnpm/wrangler/better-sqlite3

    plus remove the @remix-run/dev patch
    acusti committed Jul 17, 2024
    Configuration menu
    Copy the full SHA
    733a4f4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b8672c9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7a4579f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    88886ee View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2d834ef View commit details
    Browse the repository at this point in the history
  6. 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
    acusti committed Jul 17, 2024
    Configuration menu
    Copy the full SHA
    7ca376f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c94d3c9 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    4d2e0e7 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    339afff View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    85172f0 View commit details
    Browse the repository at this point in the history
  11. 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
    acusti committed Jul 17, 2024
    Configuration menu
    Copy the full SHA
    b13ba42 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    f832a5b View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    a235049 View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2024

  1. Configuration menu
    Copy the full SHA
    c6b1217 View commit details
    Browse the repository at this point in the history
  2. Make meta functions remix v2 compatible

    …plus take advantage of MetaFunction type’s generics
    acusti committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    e5b6f65 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9bc6422 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    34c6c43 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5394636 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6defafb View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c058dc2 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7ddc464 View commit details
    Browse the repository at this point in the history
  9. 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
    acusti committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    a209b26 View commit details
    Browse the repository at this point in the history
  10. Restore TS cloudflare worker’s entry file + name

    reproduces the changes suggested in remix-run/remix#9774
    acusti committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    0f9bcab View commit details
    Browse the repository at this point in the history
  11. 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
    acusti committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    586f8a8 View commit details
    Browse the repository at this point in the history
  12. Restore focus-visible polyfill

    acusti committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    4e4fbdb View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    4f9da67 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    05cf820 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    6fbd8bd View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    ffc5677 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    18738b2 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    029dd81 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    c12ceaa View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    56f6eda View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    d0c7ea1 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    983ce3e View commit details
    Browse the repository at this point in the history
  23. 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)
    acusti committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    5c9e50d View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    ada2441 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    3e3564e View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    1e3dada View commit details
    Browse the repository at this point in the history

Commits on Jul 23, 2024

  1. Use createTestDatabase in /d1-types.test.ts

    this means that superflare/cli/d1-database.ts’ createSQLiteDB util is no longer used anywhere
    acusti committed Jul 23, 2024
    Configuration menu
    Copy the full SHA
    0ca86a2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    160950b View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2024

  1. Configuration menu
    Copy the full SHA
    0de2d93 View commit details
    Browse the repository at this point in the history
  2. Add .dev.vars to .gitignore

    acusti committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    b6139c1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    41ce1e7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9b1d7d3 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0c66959 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    048a2b2 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    03e4cb1 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f002442 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    00917fb View commit details
    Browse the repository at this point in the history
  10. ⬆️ 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
    acusti committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    61df979 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    755dca4 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    b800de0 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    1146c09 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    c08b78e View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    ff17a9e View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    7073a76 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    2fcd89a View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    e723ad6 View commit details
    Browse the repository at this point in the history
  19. Replace better-sqlite3 → @miniflare/d1 in tests

    this means no more direct dependency on better-sqlite3
    acusti committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    33fe1fe View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    c6652c7 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    9889492 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    fe766b9 View commit details
    Browse the repository at this point in the history
  23. 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.
    acusti committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    22f47d4 View commit details
    Browse the repository at this point in the history
  24. 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
    acusti committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    6beeeb5 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    fd0dbc6 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2024

  1. Configuration menu
    Copy the full SHA
    6f4d861 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b044a0e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    23100a8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ddf3cd9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    fbe589c View commit details
    Browse the repository at this point in the history
  6. 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
    acusti committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    f7359b2 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    dd270fe View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2024

  1. Configuration menu
    Copy the full SHA
    0ffe24a View commit details
    Browse the repository at this point in the history
  2. 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
    acusti committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    ade2cf4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a35e538 View commit details
    Browse the repository at this point in the history
  4. 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)
    acusti committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    f680ba4 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    bdc3b4c View commit details
    Browse the repository at this point in the history
  6. Add snapshot publishing

    jplhomer committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    b5c94d9 View commit details
    Browse the repository at this point in the history
  7. No compacting

    jplhomer committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    4f96a9b View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    32986c1 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    b5d5d06 View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2024

  1. Configuration menu
    Copy the full SHA
    66bc307 View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2024

  1. Configuration menu
    Copy the full SHA
    fb38d74 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b9ecf0d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    edb0467 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    031ab99 View commit details
    Browse the repository at this point in the history
  5. Remove duplicate local load-context.ts

    already supplied by @superflare/remix
    acusti committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    339d246 View commit details
    Browse the repository at this point in the history
  6. 🚿 Remove unused variable

    acusti committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    88f44da View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2024

  1. Add experimentalJsonConfig for wrangler.json

    enables wrangler to pick up the bindings and provide them from getPlatformProxy
    acusti committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    40f027c View commit details
    Browse the repository at this point in the history
  2. 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)
    acusti committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    feae062 View commit details
    Browse the repository at this point in the history
  3. 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
    acusti committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    62173ee View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9de0a9e View commit details
    Browse the repository at this point in the history
  5. 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()
    acusti committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    08faf1c View commit details
    Browse the repository at this point in the history
  6. 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
    acusti committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    f5874c0 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2024

  1. Configuration menu
    Copy the full SHA
    21dbb19 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    260b23f View commit details
    Browse the repository at this point in the history
  3. Replace type DefineConfigResult → DefineConfigReturn

    allows us to only import the DefineConfigReturn type instead of importing the actual defineConfig function and using ReturnType<typeof defineConfig<Env>>
    acusti committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    eb6af05 View commit details
    Browse the repository at this point in the history
  4. 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
    acusti committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    f4d25c7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8f10d88 View commit details
    Browse the repository at this point in the history
  6. 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
    acusti committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    2718c38 View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2024

  1. Configuration menu
    Copy the full SHA
    821f402 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a766a7e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fb31936 View commit details
    Browse the repository at this point in the history
  4. 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
    acusti committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    cf584b6 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2024

  1. Configuration menu
    Copy the full SHA
    864ecfc View commit details
    Browse the repository at this point in the history
  2. Fix getSessionCookie, consistent superflare import

    adds getSessionCookie to AppLoadContext and provides it from load-context.ts
    acusti committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    12c654a View commit details
    Browse the repository at this point in the history
  3. Move config init to superflareDevProxyVitePlugin

    also, bring over code to ensure session has a sessionId from superflare#handleFetch
    acusti committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    b6e556d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f1b8c17 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    bbd093f View commit details
    Browse the repository at this point in the history

Commits on Aug 14, 2024

  1. 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)
    acusti committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    b2f83ae View commit details
    Browse the repository at this point in the history
  2. 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
    acusti committed Aug 14, 2024
    Configuration menu
    Copy the full SHA
    c9f5157 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    43d9e99 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4574c3c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    224fb0e View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2024

  1. Configuration menu
    Copy the full SHA
    9373f60 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    86be592 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    55aa977 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1ac6ade View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    573179a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    fa224be View commit details
    Browse the repository at this point in the history
  7. 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
    acusti committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    6f504e9 View commit details
    Browse the repository at this point in the history
  8. 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
    acusti committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    5e8b590 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    602249d View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    f944a60 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    2e7b3b6 View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2024

  1. Configuration menu
    Copy the full SHA
    82ccdde View commit details
    Browse the repository at this point in the history
  2. Move vite dev plugin to @superflare/remix/dev

    previously available as @superflare/remix-dev, but this is simpler
    acusti committed Aug 21, 2024
    Configuration menu
    Copy the full SHA
    0149e1f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    10619af View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2024

  1. Configuration menu
    Copy the full SHA
    1d12080 View commit details
    Browse the repository at this point in the history