Skip to content

Provide TypeScript/Babel shorthands for app creation #1355

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
tjvantoll opened this issue Dec 16, 2015 · 7 comments
Closed

Provide TypeScript/Babel shorthands for app creation #1355

tjvantoll opened this issue Dec 16, 2015 · 7 comments

Comments

@tjvantoll
Copy link
Contributor

Feature request submitted by @nraboy: add --typescript and --babel flags to the tns create command

So basically tns create hello-world --typescript would be a shorthand for running both tns create hello-world and tns install typescript.

@nraboy
Copy link

nraboy commented Dec 16, 2015

Thanks!

I'd also like to request that the JavaScript files that would typically be created when creating a project get replaced with their TypeScript equivalent should the --typescript flag be included.

@rosen-vladimirov
Copy link
Contributor

Hi @tjvantoll , @nraboy
We have decided to use another approach - in our master branch, there's support for

tns create app1 --template typescript

or

tns create app1 --template tsc

This will create a new project from tns-template-hello-world-ts template. Also the nativescript-dev-typescript dependency will be added to the project so it will basically do the same thing you have requested.
Do you like this approach?

@rosen-vladimirov
Copy link
Contributor

Also the --template option gives you the ability to use anything that can be npm installed. It will be placed in the app directory of the new project. This way you can easily create project based on local folder, .tgz file or even npm package.
All dependencies and devDependencies from the selected template will be added to the new project.

@nraboy
Copy link

nraboy commented Dec 16, 2015

I think it is fine, but I have two concerns.

  1. Are we going to be overwhelmed with templates to remember?
  2. If these are actual templates we're using instead of script revisions, will all these templates be in line with each other? To be more clear will the TypeScript version get the same level of love as the JavaScript version and the other way around? I'd hate to find out the TypeScript version is 3 months behind or similar.

@rosen-vladimirov
Copy link
Contributor

@nraboy , straight to your questions:

  1. No, the idea is to have a small set of default names (like typescript and babel) and only when they are used to apply some special logic. For example when you use --template typescript we'll get the tns-template-hello-world-ts package from npm and use it as template for the newly created project. Once we have such template for babel, we'll provide the same logic. For any other value passed to --template option, we'll try to call npm install. For example tns create app1 --template ../myTemplateDir will get the files from your template dir and will try to call npm install. If this succeeds, we'll use the files and move them in the app directory of your project. The last step is to verify all mandatory files from app/App_Resources exist in the newly created project. In case you do not have some of them in your template (you can even miss the App_Resources dir in your template), we'll complete them from the default template.
    Also all "reserved" words for --template will be included in our help, so you can check them easily by calling tns create -h or tns help create.
  2. The TypeScript template is already included in our release procedure, so whenever we update the JavaScript template, we'll make sure to include the changes in its TypeScript version.

Hope this answers your questions.

@nraboy
Copy link

nraboy commented Dec 16, 2015

Then this sounds like a good plan to me. Looking forward to making TypeScript my primary.

Thanks,

@rosen-vladimirov
Copy link
Contributor

I'm glad you liked the suggested approach. I'm closing this thread now, you can find the details about --template option in the original issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants