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

Question about post-targets and ngx-deploy-npm:deploy #760

Closed
eXigentCoder opened this issue Dec 21, 2023 · 2 comments
Closed

Question about post-targets and ngx-deploy-npm:deploy #760

eXigentCoder opened this issue Dec 21, 2023 · 2 comments
Labels
question Further information is requested

Comments

@eXigentCoder
Copy link

Hey there,

Firstly thanks so much, this library is awesome!
My question is do the post-targets all run in parallel or in series? I took a look at the code and i'm not familiar with rxjs but I suspect it's in parallel?

The reason I ask is that my GitHub Action for my NX monorepo workflow is as follows:

  1. Version all affected local npm packages using your library. Sometimes there is no need for a version bump
  2. Push the commit + tags back to the origin (commit messages have [skip ci] so doesn't fire off a new GitHub Action).
  3. Build the package.json dependencies for the local npm libraries so that they have the latest versions of cross dependencies in them
  4. publish all affected local libraries to npm. ⬅️ This step is failing because it's trying to push a version that already exists as there is no change to some of the libs.

I wanted to look at using the post-targets as described in this issue to kick off my build-package-json target and then the publish target, but if they happen in parallel It might build the package before dependencies have been injected.

Right now I have just added continue-on-error: true to my publish action, but it's not great since if it fails to publish for a legitimate reason the build will still succeed.

Also, just to confirm, both my version and publish targets have configurations within them, I can't see a way to specify which configuration the post-target should use, but from looking at the code I think it will inherit whichever configuration the version target was using, is that correct?

Would love some clarification/advice here, thanks!

@edbzn
Copy link
Member

edbzn commented Dec 21, 2023

Hi @eXigentCoder,

My question is do the post-targets all run in parallel or in series? I took a look at the code and i'm not familiar with rxjs but I suspect it's in parallel?

By design post-targets run in series to avoid race-conditions.

I wanted to look at using the post-targets as bikecoders/ngx-deploy-npm#70 to kick off my build-package-json target and then the publish target, but if they happen in parallel It might build the package before dependencies have been injected.

Yes, it's exactly why we introduced post-targets, they only run on versioned projects so I think it's what you need in your case.

I can't see a way to specify which configuration the post-target should use, but from looking at the code I think it will inherit whichever configuration the version target was using, is that correct?

You can pass a configuration to your post-target like this: "postTargets": ["my-proj:target:config"].

Hope it helps.

@edbzn edbzn added the question Further information is requested label Dec 21, 2023
@eXigentCoder
Copy link
Author

Awesome stuff, thanks so much and keep up the great work, appreciate it! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants