qwikifiers / qwik-nx

Nx plugin for Qwik
131 stars 24 forks source link

feat: cloudflare pages integration #48

Closed dmitry-stepanenko closed 1 year ago

dmitry-stepanenko commented 1 year ago

Adding integration for cloudflare pages https://qwik.builder.io/integrations/deployments/cloudflare-pages/

The behavior is slightly different from what qwik generates: we're providing an actual deployment target deploy (equivalent of npx wrangler pages publish) along with preview-cloudflare-pages, while in qwik's internal generator they're giving only a preview option (npx wrangler pages dev).

dmitry-stepanenko commented 1 year ago

@shairez need your input on this one. Deploying or running preview with qwik is a bit clunky: both preview-cloudflare-pages and deploy targets require build-ssr to be executed beforehand, but we can't use it with dependsOn, since targets above would need to depend on build-ssr:cloudflare-pages configuration, which is not possible (nx can only apply the same configuration on dependant targets https://github.com/nrwl/nx/discussions/9236). So it ends up being something like nx run myapp:build-ssr:cloudflare-pages && nx run myapp:preview-cloudflare-pages. In the private project I'm creating a separate target build-preview-cf that uses nx:run-commands to wrap this, but should we do the same in our generator here?

Let me know if you want to hop on a quick call or an issue above does make sense 🙂

shairez commented 1 year ago

yes let's meet and discuss this

dmitry-stepanenko commented 1 year ago

@shairez decided not to go with an executor, instead added an intermediate target

    "build-ssr-cloudflare-pages": {
      "executor": "nx:run-commands",
      "options": {
        "command": "npx nx run asd:build-ssr:cloudflare-pages"
      }
    }

and simply pointing to it in the "dependsOn"