Problem: Writing NativeScript tutorials is hard because the core templates we use are constantly changing. If step 1 of your tutorial is tns create my-project, you can鈥檛 be sure your tutorial will work the same way a few weeks later. While you certainly can create your own template for your tutorial (which is what I do today), it gets a bit tedious; you essentially have to create a new template for every tutorial you write.
@nraboy and I have both hit this problem, and after we chatted for a while we wanted to suggest a new feature that could make this workflow a bit simpler.
Proposal: Allow people to start projects from templates as of a specific version. The specific syntax isn鈥檛 all that important, but maybe something like.
tns create my-project --template-version 2.3
The idea is that this would use the version 2.3 of https://www.npmjs.com/package/tns-template-hello-world from npm (or, alternatively, a git tag).
We鈥檙e hoping to come up with an easy-to-implement shortcut that makes NativeScript tutorials easier to write and maintain. Let us know what you think.
@tjvantoll you can use versioning in the same manner as npm does. For example in case you want to use version 2.3.0 of the angular template, you can write
tns create my-project --template [email protected]
Other supported options are:
tns create my-project --template default@<version>
tns create my-project --template angular@<version>
tns create my-project --template typescript@<version>
In case you want to use any npm package for template, you can use:
tns create my-project --template <package name>@<package version>
Will this work for you?
One more note - you can also use git tag:
tns create my-project --template https://github.com/NativeScript/template-hello-world/tarball/v1.5.1
This way you'll use the 1.5.1 tag of the template ;)
So I see a few problems with this:
Thanks,
Thanks @rosen-vladimirov!
@nraboy npm info can help you get the first part of that, so npm info tns-template-hello-world-ng, for instance. The second part of that I鈥檓 not sure you can derive. Ideally the repo would have git tags that match the npm versions, but it doesn鈥檛 appear we鈥檝e been doing that with our NativeScript templates (unfortunately).
To me I think the {N} CLI gives plenty of options for handling this, and therefore I think we鈥檙e good to close this issue, but we (the NativeScript team) need to follow up on better version management on the various templates that we provide.
Tag a commit (you can move tags around at any time) with a "gettingstarted" and use that in the article. When the article is updated or when a new release compatible with the article is released you can move the tag to be at sync with the article. If the tagged version and the tooling diverge a lot the getting started experience may still brake.
Hey guys,
I'm closing this one, as CLI already provides the required functionality. For any issues with it or any other requirements, please open a separate issue.
@rosen-vladimirov Both @tjvantoll and I have opened other tickets on this as well.
None of the tickets seem to solve this in a satisfactory way. There is no functionality to create a project based on a specific version even though you say we can. For example, in the other ticket, the App_Resources directory is not created.
Most helpful comment
Thanks @rosen-vladimirov!
@nraboy
npm infocan help you get the first part of that, sonpm info tns-template-hello-world-ng, for instance. The second part of that I鈥檓 not sure you can derive. Ideally the repo would have git tags that match the npm versions, but it doesn鈥檛 appear we鈥檝e been doing that with our NativeScript templates (unfortunately).To me I think the {N} CLI gives plenty of options for handling this, and therefore I think we鈥檙e good to close this issue, but we (the NativeScript team) need to follow up on better version management on the various templates that we provide.