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

tns-android inside dependencies when tns build/run android fails #2547

Closed
dtopuzov opened this issue Feb 16, 2017 · 4 comments
Closed

tns-android inside dependencies when tns build/run android fails #2547

dtopuzov opened this issue Feb 16, 2017 · 4 comments
Assignees
Milestone

Comments

@dtopuzov
Copy link
Contributor

Steps to reproduce:

tns create TestApp  && tns build android --path TestApp -> Everything is fine
rm -rf TestApp/platforms/android
tns build android --path TestApp --compileSdk 99 (some invalid sdk version in order to fail build command)

Result: tns-android is found in dependencies of package.json.
This later breaks tns platform add/remove android

@dtopuzov dtopuzov added the bug label Feb 16, 2017
@dtopuzov dtopuzov added this to the 3.0.0 milestone Feb 16, 2017
@petekanev
Copy link
Contributor

The underlying problem is a lot different than we first anticipated, and thus the supposed "fix" cannot handle the inconsistent CLI behavior. I'll look into a more general solution.

@Plamen5kov Plamen5kov self-assigned this Feb 22, 2017
@pkoleva pkoleva removed this from the 3.0.0-RC milestone Feb 24, 2017
@Plamen5kov Plamen5kov removed their assignment Mar 1, 2017
@dtopuzov
Copy link
Contributor Author

dtopuzov commented Mar 8, 2017

The same happens with those steps:

tns create TestApp
tns run android --path TestApp
Ctrl+C

Project is broken and no chance to get in working until you manually delete tns-android from dependencies.

Workaround:
Manually delete tns-android from dependencies in package.json

@etabakov etabakov added this to the 3.1.0 milestone Apr 27, 2017
@pkoleva pkoleva removed this from the 3.1.0 milestone Jun 6, 2017
@rosen-vladimirov
Copy link
Contributor

One idea to handle this is to attach to process exit signals in the block where we install tns-android as dependency, for example here.
The code should be something like:

this.$processService.attachToProcessExitSignals(this, () => {
        const packageJsonContent = this.$fs.readJson(pathToPackageJson);
        if (packageJsonContent && packageJsonContent.dependencies && packageJsonContent.dependencies["tns-android"] ) {
            delete packageJsonContent.dependencies["tns-android"];
            this.$fs.writeJson(pathToPackageJson, packageJsonContent);
        }
}

This way, in case Ctrl + C is used during installation of the runtime, before exiting the process, CLI will execute the logic in the lambda and will not leave the project in incorrect state.

@rosen-vladimirov
Copy link
Contributor

With latest changes, this issue is no longer valid as runtimes are not added as dependencies of the project anymore (and removed after that). The new behavior will be available in CLI 4.2.0

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

8 participants