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

postTargets is running build target in watch mode #353

Closed
HassenHichri opened this issue Oct 19, 2021 · 4 comments · Fixed by #361 or garethdjohn/semver#1
Closed

postTargets is running build target in watch mode #353

HassenHichri opened this issue Oct 19, 2021 · 4 comments · Fixed by #361 or garethdjohn/semver#1
Labels
bug Something isn't working

Comments

@HassenHichri
Copy link

HassenHichri commented Oct 19, 2021

Hi,
I have a Nx workspace with a publishable lib. I wanted to add your plugin to automatically publish new versions of this lib to npm registry. My idea is to use nx run my-lib:version to bump the package version then build the lib nx run my-lib:build and publish it npm publish. But when I add the build target as a postTargets and run nx run my-lib:version, it is running on watch mode.
Screenshot 2021-10-19 at 22 36 43

Here is a repo where you can reproduce this behaviour https://github.com/HassenHichri/test-semver

node v12.14.0
npm v6.14.4
macOS 11.6

@yjaaidi yjaaidi added bug Something isn't working Hacktoberfest labels Oct 20, 2021
@yjaaidi
Copy link
Member

yjaaidi commented Oct 20, 2021

Hi @HassenHichri!
Thank you for raising this bug and for the repro. There is in fact a bug due to an interpolation that fails on booleans like watch which is set to false and converted to true by mistake.

The problem comes from the function below. We'll try to fix it as soon as we can but if anyone wants to help, you are welcome!

export function _resolveTargetOptions({

  • add test with a boolean option for _resolveTargetOptions function

@HassenHichri
Copy link
Author

Hi @yjaaidi,
I can have a look at it, any hints on how to make changes/build and test the plugin locally? I don't know exactly how Nx plugins really work 😅

@edbzn
Copy link
Member

edbzn commented Oct 21, 2021

Hi, yeah I remember having troubles with coercing booleans. You can clone the repo, make your changes, build the lib nx build semver, then npm link dist/packages/semver, and finally test your changes in your project by running npm link @jscutlery/semver. Let us know if you need any help!

@yjaaidi
Copy link
Member

yjaaidi commented Oct 25, 2021

Thanks @HassenHichri for raising the issue and @garethdjohn for the fix!
Thanks also to @edbzn for quickly replying to @HassenHichri

yjaaidi added a commit to jscutlery/devkit that referenced this issue Oct 25, 2021
this fixes the build watch issue after running version
Cf. jscutlery/semver#353
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants