NativeScript / nativescript-cli

Command-line interface for building NativeScript apps
https://www.npmjs.com/package/nativescript
Apache License 2.0
1.04k stars 195 forks source link

Add support for urls as tns create --copy-from parameter #1983

Closed georgeedwards closed 7 years ago

georgeedwards commented 8 years ago

It would be great if the command tns create MyApp --copy-from https://github.com/NativeScript/sample-Groceries worked at the moment, it just errors saying that the directory "path-to-current-position/https://github.com/NativeScript/sample-Groceries" doesn't exist.

dtopuzov commented 8 years ago

Hi @georgeedwards , you can use:

tns create MyApp --template https://github.com/NativeScript/sample-Groceries

May be --copy-from and --template are a bit confusing and may be it will be better if we have a single command. Ideas for improvement of commands and user experience are welcome :)

georgeedwards commented 8 years ago

@dtopuzov Thanks for clearing that up, I think one command would be more intuitive. Does template support branch info? e.g. could I do tns create sample-groceries --template https://github.com/NativeScript/sample-Groceries/tree/start ? - I know that doesn't work as I got HTTP 406 errors. Maybe something like tns create sample-groceries --template https://github.com/NativeScript/sample-Groceries --branch start?

dtopuzov commented 8 years ago

--template support branching, those are valid options: "https://github.com/NativeScript/template-hello-world-ts/tarball/master" "https://github.com/NativeScript/template-hello-world-ts.git#master"

Note: --template behavior is a bit different compared to --copy-form option. --template will copy content of the package/url inside your app folder. --copy-from will copy everything (not only app folder) What you actually try to do is: git clone https://github.com/NativeScript/sample-Groceries cd sample-Groceries and may be --template is not a good option for you, because sample-Groceries has some other things outside app folder.

georgeedwards commented 8 years ago

@dtopuzov Ahh, I see, a tns command which replicated:

git clone -b start --single-branch https://github.com/NativeScript/sample-Groceries

would be really helpful. In which case, a --copy-from url support + branch support would be the solution.

Also, the --template flag doesn't seem to be documented on this repo's README?

dtopuzov commented 7 years ago

--copy-from is now deprecated in flavor of --template. tns create MyApp --template can be used with everything that can be npm installed, but don't forget it should be template, not complete application!