naxodev / oss

Open Source Software (OSS) projects by naxodev
https://naxo.dev
MIT License
19 stars 1 forks source link

Nx dependencies pinned versions #24

Closed maphe closed 11 months ago

maphe commented 11 months ago

Current Behavior

The current version 0.7.0 points to specific versions of Nx libraries, eg. @nx/js@:16.8.1

If my project is using anything other than this specific version, npm is not happy as versions are conflicting.

Expected Behavior

Is there any chance you can make it a little more permissive, maybe pointing to ^16.8.1 so I can use a more recent version of the nx libraries in my nx workspace and still use your library (which is super helpful btw).

GitHub Repo

No response

Steps to Reproduce

1.

Nx Report

Node   : 20.7.0
   OS     : darwin-arm64
   npm    : 10.1.0

   nx                 : 16.9.1
   @nx/js             : 16.10.0
   @nx/jest           : 16.10.0
   @nx/linter         : 16.9.1
   @nx/workspace      : 16.9.1
   @nx/cypress        : 16.9.1
   @nx/devkit         : 16.9.1
   @nx/esbuild        : 16.10.0
   @nx/eslint-plugin  : 16.9.1
   @nx/node           : 16.10.0
   @nrwl/tao          : 16.9.1
   @nx/vite           : 16.9.1
   @nx/web            : 16.9.1
   nx-cloud           : 16.4.0
   typescript         : 5.1.6
   ---------------------------------------
   Community plugins:
   @naxodev/nx-cloudflare : 0.7.0
   ---------------------------------------
   The following packages should match the installed version of nx
     - @nx/js@16.10.0
     - @nrwl/js@16.10.0
     - @nx/jest@16.10.0
     - @nrwl/jest@16.10.0
     - @nx/esbuild@16.10.0
     - @nrwl/esbuild@16.10.0
     - @nx/node@16.10.0
     - @nrwl/node@16.10.0

Failure Logs

No response

Operating System

Additional Information

Great work, hope you can keep maintaining it

NachoVazquez commented 11 months ago

Hey, @maphe, thanks for the feedback. Yeah, I can do that. Nx is setting those dependencies for me now, so I didn't look too much there, but what you say makes sense.

I will update all dependencies now and ensure they are less strict for future dependencies.

In the meantime, you can try running the following.

npm install --legacy-peer-dep
maphe commented 11 months ago

Cool thanks. Yeah that's what I did for now, using --legacy-peer-dep, but it's gonna be nicer not to have to do it anymore. Thanks again

NachoVazquez commented 11 months ago

I will push a fix soon. I tried to also upgrade to the latest Nx and Wrangler, but I'm having some issues with wrangler dev.

Out of curiosity, how are you using the plugin?

Are you using it for working with workers or the NextJS adapter?

Thanks.

maphe commented 11 months ago

I'm using it for a worker within a monorepo, among other non-cloudflare apps and libraries.

Not sure if that's helpful info to you but I was able to upgrade my monorep to use "wrangler": "^3.11.0" and the serve command for the worker seems to still be working fine.

NachoVazquez commented 11 months ago

Thanks for the info; I'm glad it is helpful to you.

Yeah, it is only affecting a few users. I will try restarting my computer and see if that helps, lol.

I will publish the fix for this issue later today.

maphe commented 11 months ago

Sure, no worries, no rush. Thanks for the effort 👍

maphe commented 11 months ago

Hey, sorry I have a couple questions I figured I can just put them in this thread

  1. would it be possible for the publish task to run npx wrangler deploy instead of wrangler deploy? so it relies on whatever wrangler version the package.json points to, and doesn't require the team to install wrangler globally and keep up to date
  2. is there a way to pass an environment to the publish command? like I have some stuff in [env.production] and [env.production.vars] in wrangler.toml which I'd like to be applied on publish

As you may be able to tell, this is my first time playing around with cloudflare workers so let me know if I'm missing something.

Thanks again

NachoVazquez commented 11 months ago

Hey! No problem.

  1. Thanks for bringing this on. I should do the same as with the serve and read wrangler from the project's node_modules. That's the way the nx teams do it. I just remembered that I needed to migrate the publish command when I migrated the serve command.
  2. Ideally, you should be able to pass your arguments, which will be forwarded to the nx command, but I will double-check that when I start working on the publish migration PR.
NachoVazquez commented 11 months ago

But you are right. I need to align with the wrangler options on my schema. I'll be sure to have it done.

That said, you should be able to install the package without the previous problems on version 0.8.0. It should be live later tonight.

maphe commented 11 months ago

Cool thanks a lot.

NachoVazquez commented 11 months ago

It is live now!

NachoVazquez commented 11 months ago

Give it a try whenever you can, and let me know if it worked

maphe commented 11 months ago

I'm still getting some conflicts but I can't tell anymore if they're directly coming from your package or some others. There is some mention of wrangler but mostly it's esbuild causing mess.

npm ERR! While resolving: @nx/esbuild@16.10.0
npm ERR! Found: esbuild@0.17.19
npm ERR! node_modules/esbuild
npm ERR!   dev esbuild@"^0.17.17" from the root project
npm ERR!   peer esbuild@"*" from @esbuild-plugins/node-globals-polyfill@0.2.3
npm ERR!   node_modules/@esbuild-plugins/node-globals-polyfill
npm ERR!     @esbuild-plugins/node-globals-polyfill@"^0.2.3" from wrangler@3.11.0
npm ERR!     node_modules/wrangler
npm ERR!       dev wrangler@"^3.11.0" from the root project
npm ERR!       2 more (@naxodev/nx-cloudflare, @cloudflare/next-on-pages)
npm ERR!   3 more (@esbuild-plugins/node-modules-polyfill, vite, wrangler)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional esbuild@"~0.19.2" from @nx/esbuild@16.10.0
npm ERR! node_modules/@nx/esbuild
npm ERR!   dev @nx/esbuild@"16.10.0" from the root project
npm ERR!   @nx/esbuild@"16.10.0" from @nrwl/esbuild@16.10.0
npm ERR!   node_modules/@nrwl/esbuild
npm ERR!     @nrwl/esbuild@"16.10.0" from @nx/esbuild@16.10.0
npm ERR! 
npm ERR! Conflicting peer dependency: esbuild@0.19.4
npm ERR! node_modules/esbuild
npm ERR!   peerOptional esbuild@"~0.19.2" from @nx/esbuild@16.10.0
npm ERR!   node_modules/@nx/esbuild
npm ERR!     dev @nx/esbuild@"16.10.0" from the root project
npm ERR!     @nx/esbuild@"16.10.0" from @nrwl/esbuild@16.10.0
npm ERR!     node_modules/@nrwl/esbuild
npm ERR!       @nrwl/esbuild@"16.10.0" from @nx/esbuild@16.10.0

Anyway that's for sure better than before. Thanks for the fix 👍

NachoVazquez commented 11 months ago

Yeah, @nx/esbuild is not mine. That's coming from somewhere else.

NachoVazquez commented 11 months ago

@maphe version 0.8.0 is out, and I added support for all wrangler dev and wrangler deploy args.

Also, now the deploy (aka publish) executor reads the binary directly from the node_modules.

maphe commented 11 months ago

Perfect. Thanks a lot!