Skip to content

"tns debug {platform} --watch" inconvenient behavour #2292

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

Closed
ivanbuhov opened this issue Dec 1, 2016 · 6 comments
Closed

"tns debug {platform} --watch" inconvenient behavour #2292

ivanbuhov opened this issue Dec 1, 2016 · 6 comments

Comments

@ivanbuhov
Copy link
Contributor

ivanbuhov commented Dec 1, 2016

tns debug ios --no-rebuild --watch doesn't build the app (as expected). If --no-rebuild argument is dropped still no build is triggered. In both cases if the app was not previously built (there is no app bundle in the platform's build directory) the command will fail with ENOENT: no such file or directory, scandir '/Users/buhov/Desktop/TheApp/platforms/ios/build/emulator.
This means that the command will always fail in a brand new or newly cloned application:

tns create MyApp
cd MyApp
tns debug ios --watch // This will fail. To make it work you have to run `tns build ios` first

Additionally, this command is run by the VSCode extension when the Sync on iOS/Android operation is triggered. In the extension we can "predict" whether the command will fail and trigger a build in such case, but this is a workaround. The real solution should be to trigger build in the CLI if the app hasn't been previously built. If triggering a build when --no-rebuild is explicitly set looks strange to someone, we can at least trigger a build on tns debug ios --watch. As a result the following scenario should not fail with error:

tns create MyApp
cd MyApp
tns debug ios --watch

Any ideas are welcome.

@petekanev
Copy link
Contributor

petekanev commented Dec 1, 2016

@ivanbuhov @Plamen5kov @rosen-vladimirov

Can we throw errors/output messages and terminate process when an app bundle is not available instead of implicitly triggering a build?

How do you think that would affect the user experience?

Currently some of the CLI commands and flag combinations act unpredictably, and that can cause frustration for the users. At the very least we can do is to write an elaborate list of all commands, valid flags for each, and expected behavior, along with listing of quirks, if any.

@ivanbuhov
Copy link
Contributor Author

ivanbuhov commented Dec 1, 2016

@Pip3r4o

Can we throw errors/output messages and terminate process when an app bundle is not available instead of implicitly triggering a build?

How do you think that would affect the user experience?

tns run ios/android will implicitly trigger a build when an app bundle is not available
tns deploy ios/android will implicitly trigger a build when an app bundle is not available
tns emulate ios/android will implicitly trigger a build when an app bundle is not available
tns livesync ios/android will implicitly trigger a build when an app bundle is not available
tns debug ios/android will implicitly trigger a build when an app bundle is not available
but
tns debug ios/android --watch fails with error message.
I find this behavour to be inconsistent and unexpected. I suggest implicitly triggering a build (if needed) even if the --watch flag is passed.

@petekanev
Copy link
Contributor

petekanev commented Dec 1, 2016

@ivanbuhov I agree on the above, I was referring more to the --no-rebuild (--rebuild false) flag, respect it when it's passed as-is

@ivanbuhov
Copy link
Contributor Author

@Pip3r4o I also agree that --no-rebuild should be respected. Ideally tns debug ios/android --watch will trigger a build if needed and tns debug ios/android --no-rebuild --watch will never trigger a build.

@ivanbuhov ivanbuhov changed the title "tns debug {platform} --no-rebuild --watch" inconvenient behavour "tns debug {platform} --watch" inconvenient behavour Dec 1, 2016
ivanbuhov added a commit to nativescript-community/nativescript-vscode-extension that referenced this issue Dec 1, 2016
@tzraikov tzraikov added this to the 2.5.0 milestone Dec 1, 2016
@tzraikov tzraikov self-assigned this Dec 1, 2016
@tzraikov
Copy link
Contributor

tzraikov commented Dec 5, 2016

Actually the current implementation of tns debug --watch behaves exactly as you described. It will trigger a new build implicitly when necessary. Maybe you used an old version? Could you confirm that?

@ivanbuhov
Copy link
Contributor Author

After @tzraikov and I investigated the issue we found that tns debug {platform} --watch works as expected - it will rebuild the app only if needed. The error is caused by this issue: #2315 so I am closing this one.

ivanbuhov added a commit to nativescript-community/nativescript-vscode-extension that referenced this issue Dec 7, 2016
@pkoleva pkoleva removed the 3 - Done label Dec 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants