Skip to content

[Feature Request] Interactive tns create #3829

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
radeva opened this issue Aug 21, 2018 · 10 comments
Closed

[Feature Request] Interactive tns create #3829

radeva opened this issue Aug 21, 2018 · 10 comments
Assignees
Milestone

Comments

@radeva
Copy link

radeva commented Aug 21, 2018

Current Behavior

The current behavior of tns create command used to create a NativeScript project is described in details in our documentation. Here is how it works in short:

  • tns create MyApp creates MyApp project using pure JavaScript
  • additional options --ng, --tsc are available to create the project in TypeScript or Angular flavor (tns create MyApp --ng, tns create MyApp --tsc)
  • project can be created from a predefined template (Tabs, Master-Detail, SideDrawer, etc)

Proposed Behavior

Provide an interactive tns create command as follows:

tns create MyApp

? Choose a framework
> Angular
> Vue.js
> None

? Choose a template
> Hello World
> Blank
> SideDrawer
> Tabs

If Angular framework is chosen, the Blank option should be split in two:

> Blank (Mobile)
> Blank (Web + Mobile)

Choosing None will create the project in TypeScript flavor.

All existing options will continue to work as is. In addition,

  • a new option --js should be added to allow the creation of a JavaScript project directly
  • a new option --vue should be added to allow the creation of a Vue.js project directly
@radeva radeva added the feature label Aug 21, 2018
@radeva radeva changed the title [Feature request] Interactive tns create [Feature Request] Interactive tns create Aug 21, 2018
@NickIliev
Copy link
Contributor

Sounds great!

One suggestion - perhaps instead of none the prompt could give you JavaScript & TypeScript options.

@rigor789
Copy link
Member

LGTM!

Just a few notes about the vue template: I'm not sure if we can add vue with the current vue setup, because right now we are scaffolding new projects using vue-cli. There is a new version of the template on the next branch which has been simplified and is structured more like a typical NS app. We could make this a normal NS template but we would loose some of the prompts we have with vue-cli. We are also working on a vue cli 3.x plugin which will abstract the webpack setup away, so that it can be managed as a dependency (easier upgrades in the future), and I'm not entirely sure if we can have that work as both an NS template, and a vue-cli plugin (needs some researching on my end).

@radeva
Copy link
Author

radeva commented Aug 21, 2018

@NickIliev This is also an option but we thing that TypeScript gives more benefits to the development and that's why we would like to promote is THE option for None framework. There will be still an option to create a JavaScript project using the --js option.

@radeva
Copy link
Author

radeva commented Aug 21, 2018

@rigor789 I realize that with Vue currently we don't have these templates and we need to think how to achieve it. It would be nice to find some solution and give the Vue framework visibility through the tns create.

@sis0k0
Copy link
Contributor

sis0k0 commented Aug 21, 2018

Sounds great! I would add the --force flag which creates a project in the current non-interactive way.

@bundyo
Copy link

bundyo commented Aug 21, 2018

I'm also for TypeScript/JavaScript option, but it should be the next step for Vue/None, not instead of None. Vue landscape has TypeScript but it is not predominant like for Angular.

@tjvantoll
Copy link
Contributor

Love this initiative!

My feedback:

  1. It’s weird that we have both “Blank” and “Hello World” templates, as most people consider those to be the same thing. Can the “Hello World” ones just go away?

  2. I’d like to see more words to guide the user. We don’t have to finalize the exact wording now, but this is a rough idea of what I mean.

tns create MyApp

Let’s create a NativeScript app!

Answer the following two questions to help us build the right app for you. (Note: you
can skip this prompt next time using the --template option, or the --ng, --vue, --ts,
or --js flags.)

? First, which framework would you like to use? (Use arrow keys to select)
> Angular   | Learn more at https://angular.io/
> Vue.js    | Learn more at https://vuejs.org/
> None      | Use NativeScript without any additional JavaScript frameworks

Great!

? Next, which template would you like to start from? (Use arrow keys to select)

> Blank        | An empty app
> SideDrawer   | An app with pre-built pages that uses a drawer for navigation
> Tabs         | An app with pre-built pages that uses tabs for navigation
> Code Sharing | Build iOS, Android, and web apps simultaneously from one codebase.

Perfect! You’re good to go. Here are your next steps:

-> **cd MyApp** to navigate into your new app
-> **tns run** to run your app on a USB-connected device, iOS simulator,
    or Android emulator.

@vjoao
Copy link

vjoao commented Aug 21, 2018

I personally like the vue-cli 3 prompts and flow. It is really neat.

image

@manoldonev
Copy link

+1 for @NickIliev comment
? Choose a framework: None sounds a bit too negative and discouraging to me -- I'd vote about mentioning TypeScript explicitly in there (unless we are intentionally trying to steer newcomers away from no framework :))

@manoldonev
Copy link

+1 for @tjvantoll comment too -- people would love more descriptive choices :)

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