Skip to content

[@next] tns create TestApp --ng (or --tsc) takes too long #2299

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
dtopuzov opened this issue Dec 2, 2016 · 7 comments
Closed

[@next] tns create TestApp --ng (or --tsc) takes too long #2299

dtopuzov opened this issue Dec 2, 2016 · 7 comments
Assignees
Milestone

Comments

@dtopuzov
Copy link
Contributor

dtopuzov commented Dec 2, 2016

Steps:

npm install -g nativescript@next
tns create TestApp --tsc

Result: It takes 60+ sec.

Notes: This issue does not exist in {N} 2.4.0 official release

@dtopuzov dtopuzov added this to the 2.5.0 milestone Dec 2, 2016
@dtopuzov dtopuzov changed the title tns create TestApp --ng (or --tsc) takes too long [@next] tns create TestApp --ng (or --tsc) takes too long Dec 2, 2016
@tzraikov tzraikov self-assigned this Dec 2, 2016
@tzraikov
Copy link
Contributor

tzraikov commented Dec 2, 2016

@dtopuzov
Copy link
Contributor Author

dtopuzov commented Dec 2, 2016

Not sure template is best place to fix it, what if we have another plugin with postinstall script that do npm install?

@tzraikov
Copy link
Contributor

tzraikov commented Dec 5, 2016

I am not sure that it is a good practice to call npm install within a postinstall script. Is this a common practice in our scripts?

@rosen-vladimirov
Copy link
Contributor

It's not common practice to have npm install in postinstall script. In fact it's a bad practice. However I'm wondering how adding a new dependency fixes this issue. Can you provide more details, @tzraikov ?

@tzraikov
Copy link
Contributor

tzraikov commented Dec 6, 2016

@rosen-vladimirov CLI calls npm install of the template, which now has a reference to nativescript-dev-typescript module, which has a postinstall script that calls npm install typescript. Calling npm install during npm install seems to slow down the process. The template creates a typescript project, so it seems natural to include typescript as a dependency here. As the module is already included, the second npm install does nothing and takes 0 time.

@rosen-vladimirov
Copy link
Contributor

@tzraikov thanks for the explanation. I agree that our TypeScript template must have TypeScript as devDependency. However there's one thing that concerns me - in version 2.4.0 of NativeScript CLI, the issue is not reproducible, but the template there does not have TypeScript as dependency. So something in CLI's master is causing the slowness and maybe (just maybe) the current fix is hiding some other issue.
Anyway, adding TypeScript as devDependency seems absolutely correct.

@tzraikov
Copy link
Contributor

tzraikov commented Dec 6, 2016

@rosen-vladimirov I agree, this could be possible. AFAIK we changed the way how project templates are installed and we removed npm2 dependencies. I would suspect those changes. However, this is not necessary an issue.

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