Hi all I ve just starte…

1 minute read

Hi all! I’ve just started using Nx, and I’m trying to set up deployments. Previously we used a JS script, so I thought use it to create a new builder within the monorepo (nx generate @nrwl/nx-plugin:plugin <name>). This seems to work OK, except I can’t use the builder without building it first.

Is there a way to use a custom builder without building/publishing it first? Or would I be better off running the original script with @nrwl/workspace:run-commands?

Responses:

There are already nice tools which help you a lot. Where do you want to deploy and what kind of apps?

Thanks for the reply. We’re deploying several Next.js app to Vercel/Now. All sites get production/staging/branch deploys: the production and staging aliases are fixed, while the branch aliases are generated from the branch and app names.

I’m really just trying to keep as much logic out of CI, and use the Nx’s affected whenever I can to avoid unneccessary deployments.

Would be very interesting in seeing how you achieve this – I’m doing something similar to deploy static storybook output to vercel and I went with run-commands that looks like this basically:

"commands": [ { "command": "ncp libs/stories/.vercel dist/storybook/stories/.vercel" }, { "command": "vercel -C --token=$VERCEL_TOKEN dist/storybook/stories" } ], "cwd": "./" we’re using heroku right now for the next.js app so I just build it into a docker container and push it, using run-commands as well.

I’d be interested in seeing how people do that with vercel in this setup.

Have you tried @zeit/ng-deploy?

Thanks all. I ended up using run-commands with a custom script and command line arguments: "deploy": { "builder": "@nrwl/workspace:run-commands", "options": { "commands": [ { "command": "npm run deploy -- --name=foo" } ] } }

Updated: